Just a web script to help track when, where, and what you got from the free treasures scattered about Nightfall in the game Guild Wars.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

29 lines
1.2 KiB

  1. <?php
  2. session_start();
  3. if (isset($_SESSION['userid']) && ($_SESSION['access'])){
  4. echo 'Proceed to character selection <A HREF="gw-toon.php">here</A><BR>'; //really should automate this
  5. } else {
  6. include_once 'gw-connect.php';
  7. $con = new mysqli(DATABASE_HOST, DATABASE_USER, DATABASE_PASS, DATABASE_NAME);
  8. $username = mysqli_real_escape_string($con, $_POST['username']); //enable this after username form is built
  9. $password = mysqli_real_escape_string($con, $_POST['password']); //enable this after password form is built
  10. $password = md5($password);
  11. if ($con->connect_errno > 0){
  12. die ('Unable to connect to database [' . $db->connect_errno . ']');
  13. }
  14. $sqllogin = "SELECT * FROM users WHERE users.username = '$username' and password = '$password'";
  15. if (!$result = $con->query($sqllogin)){
  16. echo 'Invalid username or password';
  17. die ('There was an error running the query [' . $con->error . ']');
  18. }
  19. while ($row = $result->fetch_array()){
  20. $uname = $row['username'];
  21. $uid = $row['userid'];
  22. $access = $row['access'];
  23. $_SESSION['username'] = $uname;
  24. $_SESSION['userid'] = $uid;
  25. $_SESSION['access'] = $access;
  26. echo 'Your username is ' . $uname . '. Your userid is ' . $uid . '. Your access level is ' . $access . '.<BR />';
  27. }
  28. }
  29. ?>