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.

38 lines
1.3 KiB

  1. <!DOCTYPE html>
  2. <HTML>
  3. <HEAD>
  4. <link rel="stylesheet" type="text/css" href="gw-style.css">
  5. <?php
  6. session_start();
  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']);
  10. $password = mysqli_real_escape_string($con, $_POST['password']);
  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. $row_cnt = mysqli_num_rows($result);
  18. if ($row_cnt > 0){
  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. }
  27. header("refresh:3;url=gw-index.php");
  28. echo '<TITLE>Logged in</TITLE></HEAD><BODY><CENTER>';
  29. echo 'You have successfully logged in ...<BR />Returning to index in a few seconds</CENTER>';
  30. } else {
  31. echo '<TITLE>Invalid login</TITLE></HEAD><BODY><CENTER>';
  32. echo 'That was not a valid username or password!<BR /><BR />';
  33. echo 'Please try again <A HREF="gw-index.php" CLASS="navlink">here</A></CENTER>';
  34. }
  35. }
  36. ?>
  37. </BODY>
  38. </HTML>