Advertisement
Guest User

Untitled

a guest
Mar 18th, 2017
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. <?php
  2. $conn = mysqli_connect('localhost', 'root', '', 'classTest');
  3. if(isset($_POST['submit'])){
  4. echo "Form was submitted" . '<br>';
  5.  
  6. $username = $_POST['username'];
  7. $password = $_POST['password'];
  8.  
  9. $username = mysqli_real_escape_string($conn, $username);
  10. $password = mysqli_real_escape_string($conn, $password);
  11.  
  12. $hashFormat = "$2y$10$";
  13. $salt = "jskdjfnahdklchaksjfhsl";
  14. $hashF_and_salt = $hashFormat . $salt;
  15.  
  16. $password = crypt($password, $hashF_and_salt);
  17.  
  18. echo "Username: " . $username . '<br>';
  19. echo "Password: " . $password . '<br>';
  20. }
  21. ?>
  22.  
  23. <!DOCTYPE html>
  24. <html>
  25. <head>
  26. <meta charset="utf-8">
  27. <title>Test</title>
  28. </head>
  29. <body>
  30.  
  31. <form action="test.php" method="post">
  32. <input type="text" name="username">
  33. <input type="password" name="password">
  34. <input type="submit" name="submit" value="submit">
  35. </form>
  36. </body>
  37. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement