pgeeweb

30.11.2016 - register.php

Nov 30th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.13 KB | None | 0 0
  1. <?php
  2. if(isset($_POST["username"])) {
  3.     $username = $_POST["username"];
  4. } else {
  5.     die("Hacking attempt detected. Nice try!");
  6. }
  7.  
  8. if(isset($_POST["password"])) {
  9.     $password = $_POST["password"];
  10. } else {
  11.     die("Hacking attempt detected. Nice try!");
  12. }
  13.  
  14. if(isset($_POST["confirm_password"])) {
  15.     $confirm_password = $_POST["confirm_password"];
  16. } else {
  17.     die("Hacking attempt detected. Nice try!");
  18. }
  19.  
  20. if(isset($_POST["email"])) {
  21.     $email = $_POST["email"];  
  22. } else {
  23.     die("Hacking attempt detected. Nice try!");
  24. }
  25.  
  26. if(isset($_POST["name"])) {
  27.     $name = $_POST["name"];
  28. } else {
  29.     die("Hacking attempt detected. Nice try!");
  30. }
  31.  
  32.  
  33. $errors = array();
  34. if(!(strlen($username)>=3 && strlen($username)<=30)) {
  35.     $errors[] = "Error: The username should be between 3 and 30 characters.";
  36. }
  37.  
  38. if(!(strlen($password)>=6 && strlen($password)<=30)) {
  39.     $errors[] = "Error: The password should be between 6 and 30 characters.";
  40. }
  41.  
  42. if($password!=$confirm_password) {
  43.     $errors[] = "Error: The passwords do not match!";
  44. }
  45.  
  46. if(count($errors)>0) {
  47.     foreach($errors as $error) {
  48.         echo $error."<br>";
  49.     }
  50. } else {
  51.     echo "OK";
  52. }
  53.  
  54.  
  55. ?>
Add Comment
Please, Sign In to add comment