Guild Wars stat tracking The idea behind this is to track multiple characters individual stats as well as account stats.
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 line
1.3 KiB

  1. <!DOCTYPE html>
  2. <HTML>
  3. <HEAD>
  4. <link rel="stylesheet" type="text/css" href="style.css">
  5. <TITLE>Logging in</TITLE>
  6. </HEAD>
  7. <BODY>
  8. <CENTER>
  9. <?php
  10. include_once ('connect.php');
  11. $con = new mysqli(DATABASE_HOST, DATABASE_USER, DATABASE_PASS, DATABASE_NAME);
  12. session_start();
  13. $username = mysqli_real_escape_string($con, $_POST['username']);
  14. $password = mysqli_real_escape_string($con, $_POST['password']);
  15. # $password = sha1($password); //this is the original line of code, just found sha1isn't any better than md5
  16. $password = password_hash($password, PASSWORD_BCRYPT);
  17. if ($con->connect_errno > 0){
  18. die ('Unable to connect to database [' . $db->connect_errno . ']');
  19. }
  20. $sqllogin = "SELECT * FROM users WHERE users.username = '$username' and passwd = '$password'";
  21. if ($result = $con->query($sqllogin)){
  22. $row_cnt = mysqli_num_rows($result);
  23. if ($row_cnt > 0){
  24. while ($row = $result->fetch_array()){
  25. $uname = $row['username'];
  26. $uid = $row['userid'];
  27. $_SESSION['username'] = $uname;
  28. $_SESSION['userid'] = $uid;
  29. }
  30. header("refresh:1;url=index.php");
  31. echo 'You have successfully logged in ...<BR />Returning to index in a few seconds</CENTER>';
  32. } else {
  33. echo 'That was not a valid username or password!<BR /><BR />';
  34. echo 'Please try again <A HREF="index.php" CLASS="navlink">here</A></CENTER>';
  35. }
  36. }
  37. include_once ('footer.php');
  38. ?>