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.
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 

33 righe
1.4 KiB

  1. <?php
  2. session_start();
  3. include_once 'gw-connect.php';
  4. $con = new mysqli(DATABASE_HOST, DATABASE_USER, DATABASE_PASS, DATABASE_NAME);
  5. $username = mysqli_real_escape_string($con, $_POST['username']); //enable this after username form is built
  6. $password = mysqli_real_escape_string($con, $_POST['password']); //enable this after password form is built
  7. $password = md5($password);
  8. if ($con->connect_errno > 0){
  9. die ('Unable to connect to database [' . $db->connect_errno . ']');
  10. }
  11. $sqllogin = "SELECT * FROM users WHERE users.username = '$username' and password = '$password'";
  12. if ($result = $con->query($sqllogin)){
  13. $row_cnt = mysqli_num_rows($result);
  14. if ($row_cnt > 0){
  15. echo 'you should be logging in now!<BR>'; //will move the while loop up to here if successful
  16. } else {
  17. echo 'That was not a valid username or password!<BR>';
  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. } else {
  29. echo 'Login failed - please try again <A HREF="gw-index.php">here</A>'; //saving this for later
  30. exit;
  31. }
  32. echo 'Proceed to character selection <A HREF="gw-toon.php">here</A><BR>'; //really should automate this
  33. ?>