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.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 

32 řádky
1.4 KiB

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