Advertisement
Guest User

adfadf

a guest
Dec 4th, 2016
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. <?php
  2. session_start();
  3. include 'dbh.php';
  4.  
  5. ini_set('display_errors', 1);
  6. ini_set('display_startup_errors', 1);
  7. error_reporting(E_ALL);
  8.  
  9. function cryptPass($input, $rounds = 9) {
  10. $salt = "";
  11. $saltChars = array_merge(range('A', 'Z'), range('a', 'z'), range(0, 9));
  12. for($i = 0; $i < 22; $i++) {
  13. $salt .= $saltChars[array_rand($saltChars)];
  14. }
  15. return crypt($input, sprintf('$2y$%02d$', $rounds).$salt);
  16. }
  17.  
  18. $username = $_POST['username'];
  19. $password = cryptPass($_POST['password']);
  20. $stmt = $conn->prepare('INSERT INTO users (Username, Password) VALUES(?, ?)');
  21. $stmt->bind.param('si', $username, $password)
  22. $stmt->execute();
  23. $result1 = $stmt->get_result();
  24.  
  25. $stmt = "INSERT INTO scores (Score2, Score3) VALUES('0', '0');";
  26. $result2 = mysqli_query($conn, $stmt);
  27.  
  28. header("Location: index.php");
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement