Advertisement
Guest User

Untitled

a guest
May 4th, 2017
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.13 KB | None | 0 0
  1. <?php
  2. $username = htmlspecialchars($_POST['username']);
  3. if (preg_match("/\s/",$username))
  4. {
  5.     die("do not use spaces, tabs or newlines in your username");
  6. }
  7. $email = htmlspecialchars($_POST['email']);
  8. if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/",$email))
  9. {
  10.     die("Invalid E-mail address");
  11. }
  12.  
  13. $Password = htmlspecialchars($_POST['password']);
  14. if (preg_match("/\s/",$Password))
  15. {
  16.     die("do not use spaces, tabs or newlines in your password");
  17. }
  18. ?>
  19.  
  20. <html>
  21. <body>
  22.  
  23. Your name is: <?php echo $username; ?><br />
  24. Your password is: <?php echo $Password; ?><br />
  25. Your e-mail: <?php echo $email; ?><br />
  26. <?php echo "Please remember your details for future registration"; ?><br />
  27. <br />
  28.  
  29. </body>
  30. </html>
  31.  
  32. <?php
  33. function check_input($data)
  34. {
  35.     $data = trim($data);
  36.     $data = stripslashes($data);
  37.     $data = htmlspecialchars($data);
  38.     if ($problem && strlen($data) == 0)
  39.     {
  40.         die($problem);
  41.     }
  42.     return $data;
  43. }
  44.  
  45. function show_error($anyError)
  46. {
  47.     ?>
  48.     <html>
  49.     <body>
  50.    
  51.     <b>Please correct the following errors:</b><br />
  52.     <?php echo $myError; ?>
  53.  
  54.     </body>
  55.     </html>
  56. <?php
  57. exit();
  58. }
  59. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement