Advertisement
patryk178

Untitled

Sep 12th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Hasło</title>
  6. </head>
  7. <body>
  8. <form action="" method="post">
  9. <input type="text" name="pass">
  10. <input type="submit">
  11. </form>
  12. <?php
  13.  
  14. if(isset($_POST['pass']))
  15. {
  16.  
  17. $baza = new mysqli("localhost","root","","baza");
  18. $pass = $_POST['pass'];
  19. $ok = true;
  20. if (strlen(preg_replace('/[^A-Z]/','',$pass))<2)
  21. {
  22. echo '<br>hasło musi zawierać przynajmniej dwie wielkie litery<br>';
  23. $ok = false;
  24. }
  25. if (strlen(preg_replace('/[^0-9]/','',$pass))<2)
  26. {
  27. echo '<br>hasło musi zawierać przynajmniej dwie cyfry<br>';
  28. $ok = false;
  29. }
  30. if (strlen(preg_replace('/[^!@#$%\^&*()_+~\[\]\{\}\\`,.\/<>?]/','',$pass))<2)
  31. {
  32. echo '<br>hasło musi zawierać przynajmniej dwa znaki specjalne<br>';
  33. $ok = false;
  34. }
  35.  
  36. if($ok)$baza->query("INSERT INTO t VALUES('NULL','$pass')");
  37. }
  38.  
  39. ?>
  40. </body>
  41. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement