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'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 

62 satır
2.4 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. //$username = 'mauirixxx'; //delete this line after the above is finished
  10. $password = mysqli_real_escape_string($con, $_POST['password']); //enable this after password form is built
  11. //$password = 'drx9175l';
  12. $password = md5($password);
  13. if ($con->connect_errno > 0){
  14. die ('Unable to connect to database [' . $db->connect_errno . ']');
  15. }
  16. $sqllogin = "SELECT * FROM users WHERE users.username = '$username' and password = '$password'";
  17. if (!$result = $con->query($sqllogin)){
  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. # keeping the code below for references material only
  31. /* if(isset($_POST["submit"])){
  32. if(empty($_POST["username"]) || empty($_POST["password"])){
  33. $error = "Both fields are required.";
  34. } else {
  35. // Define $username and $password
  36. $username=$_POST['username'];
  37. $password=$_POST['password'];
  38. // To protect from MySQL injection
  39. $username = stripslashes($username);
  40. $password = stripslashes($password);
  41. $username = mysqli_real_escape_string($con, $username);
  42. $password = mysqli_real_escape_string($con, $password);
  43. $password = md5($password);
  44. //Check username and password from database
  45. $sql-login="SELECT userid FROM users WHERE users.username = '$username' and password = '$password'";
  46. $result=mysqli_query($con,$sql-login);
  47. $row=mysqli_fetch_array($result,MYSQLI_ASSOC);
  48. //If username and password exist in our database then create a session.
  49. //Otherwise echo error.
  50. if(mysqli_num_rows($result) == 1){
  51. $_SESSION['username'] = $login_user; // Initializing Session
  52. header("location: gw-toon.php"); // Redirecting To Other Page
  53. } else {
  54. $error = "Incorrect username or password.";
  55. }
  56. }
  57. } */
  58. ?>