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.
 
 
 

33 line
1.2 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']);
  6. $password = mysqli_real_escape_string($con, $_POST['password']);
  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. while ($row = $result->fetch_array()){
  16. $uname = $row['username'];
  17. $uid = $row['userid'];
  18. $access = $row['access'];
  19. $_SESSION['username'] = $uname;
  20. $_SESSION['userid'] = $uid;
  21. $_SESSION['access'] = $access;
  22. }
  23. header("refresh:3;url=gw-index.php");
  24. echo '<!DOCTYPE html><HTML><HEAD><TITLE>Logged in</TITLE></HEAD><BODY><CENTER>';
  25. echo 'You have successfully logged in ...<BR />Returning to index in a few seconds</CENTER>';
  26. } else {
  27. echo '<HTML><HEAD><TITLE>Invalid login</TITLE></HEAD><BODY><CENTER>';
  28. echo 'That was not a valid username or password!<BR>';
  29. echo 'Please try again <A HREF="gw-index.php">here</A></CENTER>';
  30. }
  31. }
  32. echo '</BODY></HTML>';
  33. ?>