Guild Wars stat tracking The idea behind this is to track multiple characters individual stats as well as account stats.
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 

39 строки
1.4 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 ('connection.php');
  11. require "lib/password.php";
  12. $con = new mysqli(DATABASE_HOST, DATABASE_USER, DATABASE_PASS, DATABASE_NAME);
  13. session_start();
  14. $username = mysqli_real_escape_string($con, $_POST['username']);
  15. $password = mysqli_real_escape_string($con, $_POST['password']);
  16. # $password = sha1($password); //this is the original line of code, just found sha1isn't any better than md5
  17. $passhash = password_hash($password, PASSWORD_BCRYPT, array("cost" => 15));
  18. if ($con->connect_errno > 0){
  19. die ('Unable to connect to database [' . $db->connect_errno . ']');
  20. }
  21. $sqllogin = "SELECT * FROM users WHERE users.username = '$username' and passwd = '$passhash'";
  22. if ($result = $con->query($sqllogin)){
  23. $row_cnt = mysqli_num_rows($result);
  24. if ($row_cnt > 0){
  25. while ($row = $result->fetch_array()){
  26. $uname = $row['username'];
  27. $uid = $row['userid'];
  28. $_SESSION['username'] = $uname;
  29. $_SESSION['userid'] = $uid;
  30. }
  31. header("refresh:1;url=index.php");
  32. echo 'You have successfully logged in ...<BR />Returning to index in a few seconds</CENTER>';
  33. } else {
  34. echo 'That was not a valid username or password!<BR /><BR />';
  35. echo 'Please try again <A HREF="index.php" CLASS="navlink">here</A></CENTER>';
  36. }
  37. }
  38. include_once ('footer.php');
  39. ?>