Advertisement
Guest User

Untitled

a guest
Jul 4th, 2017
486
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.14 KB | None | 0 0
  1. <?php
  2. $client_name = $_POST['username'];
  3. $client_email = $_POST['email'];
  4. $client_email_retype = $_POST['email2'];
  5. $client_password = $_POST['password'];
  6. $client_password2 = $_POST['password2'];
  7. $client_realname = $_POST['realname'];
  8. if ($client_name == "")
  9. {
  10. echo "<p>You have not entered your name please enter this when returned.<br /><a href=\"register.php\">Redirect Me</a></p>";
  11. header('Refresh: 5; url=register.php');
  12. exit();
  13. }
  14. if ($client_email == "")
  15. {
  16. echo "<p>You have not entered your email please enter this when returned.<br /><a href=\"register.html\">Redirect Me</a></p>";
  17. header('Refresh: 5; url=register.php');
  18. exit();
  19. }
  20. if ($client_password == "")
  21. {
  22. echo "<p>You have not entered a password please enter this when returned.<br /><a href=\"register.html\">Redirect Me</a></p>";
  23. header('Refresh: 5; url=register.php');
  24. exit();
  25. }
  26. if(!preg_match('/^[a-zA-Z0-9 ._+\-?,():?!$]{0,1000}$/', $client_name))
  27. {
  28. echo "<p>Your name contains illegal characters<br /><a href=\"register.php\">Redirect Me</a></p>";
  29. header('Refresh: 4; url=register.php');
  30. exit();
  31. }
  32. if(!preg_match('/^[a-zA-Z0-9 -._@+\?,():?!$]{0,1000}$/', $client_email))
  33. {
  34. echo "<p>Your email contains illegal characters . - _ and @ only.<br /><a href=\"register.php\">Redirect Me</a></p>";
  35. header('Refresh: 4; url=register.php');
  36. exit();
  37. }
  38. if(!preg_match('/^[a-zA-Z0-9 ._+\-?,():?!$]{0,1000}$/', $client_password))
  39. {
  40. echo "<p>Your password contains illegal characters<br /><a href=\"register.html\">Redirect Me</a></p>";
  41. header('Refresh: 4; url=register.php');
  42. exit();
  43. }
  44.  
  45. if ($client_email != $client_email_retype)
  46. {
  47. echo "<p>Your emails do not match. please after being redirected correct this problem.<br /><a href=\"register.html\">Redirect Me</a></p>";
  48. header('Refresh: 5; url=register.php');
  49. exit();
  50. }
  51. if ($client_password != $client_password2)
  52. {
  53. echo "<p>Your passwords do not match. please after being redirected correct this problem.<br /><a href=\"register.html\">Redirect Me</a></p>";
  54. header('Refresh: 5; url=register.php');
  55. exit();
  56. }
  57. else
  58. {
  59. $client_password = md5('salt',$client_password);
  60. }
  61.  
  62. $host = "removed";
  63. $username = "removed";
  64. $password = "removed";
  65. $db_name = "ACCOUNT_DBF";
  66. $tbl_name = "ACCOUNT_TBL";
  67.  
  68. mysql_connect($host, $username, $password)or die("<p>Could Not connect.</p>");
  69. mysql_select_db($db_name)or die("<p>Could not find or conenct to the data base.</p>");
  70.  
  71. $sql1 = "SELECT realname FROM $tbl_name WHERE realname='$client_realname'";
  72. $result=mysqul_query($sql1);
  73. $count=mysql_num_rows($result);
  74. if($count==1)
  75. {
  76. echo "<p>That account name is already registered.</p>";
  77. exit();
  78. }
  79. $sql2 = "INSERT INTO $tbl_name (username, email, password, realname)
  80. VALUES ('$client_name', '$client_email', '$client_password', '$client_realname')";
  81. mysql_query($sql2);
  82. if ($sql2 == true)
  83. {
  84. echo "<p>Thank you for registering. I will get back to you as soon as I can to discuss your request.<br /><a href=/forums>Redirect Me</a></p>";
  85. header('Refresh: 3; url=login.php');
  86. }
  87. else
  88. {
  89. echo "<p>There seems to be a problem submitting your registration details. Please try again. If it still fails contact me at pulse@zephyrr.com br /><a href=\"register.html\">Redirect Me</a></p>";
  90. header('Refresh: 3; url=register.php');
  91. }
  92. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement