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.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

30 行
1.3 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. echo 'Your session userid is ' . $_SESSION['userid'] . ' and your access is ' . $_SESSION['access'] . '<BR />';
  6. } else {
  7. include_once 'gw-connect.php';
  8. $con = new mysqli(DATABASE_HOST, DATABASE_USER, DATABASE_PASS, DATABASE_NAME);
  9. $username = mysqli_real_escape_string($con, $_POST['username']); //enable this after username form is built
  10. $password = mysqli_real_escape_string($con, $_POST['password']); //enable this after password form is built
  11. $password = md5($password);
  12. if ($con->connect_errno > 0){
  13. die ('Unable to connect to database [' . $db->connect_errno . ']');
  14. }
  15. $sqllogin = "SELECT * FROM users WHERE users.username = '$username' and password = '$password'";
  16. if (!$result = $con->query($sqllogin)){
  17. echo 'Invalid username or password';
  18. die ('There was an error running the query [' . $con->error . ']');
  19. }
  20. while ($row = $result->fetch_array()){
  21. $uname = $row['username'];
  22. $uid = $row['userid'];
  23. $access = $row['access'];
  24. $_SESSION['username'] = $uname;
  25. $_SESSION['userid'] = $uid;
  26. $_SESSION['access'] = $access;
  27. echo 'Your username is ' . $uname . '. Your userid is ' . $uid . '. Your access level is ' . $access . '.<BR />';
  28. }
  29. }
  30. ?>