Guest User

Untitled

a guest
Aug 25th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. <?php
  2.  
  3. error_reporting(E_ALL);
  4. ini_set('display_errors', '1');
  5.  
  6. include("config.php");
  7. function email_valid ($email) {
  8.  
  9. if (eregi("^[a-z0-9._-]+@[a-z0-9._-]+.[a-z]{2,6}$", $email))
  10. { return TRUE; } else { return FALSE; }
  11. }
  12.  
  13.  
  14.  
  15. if (isset($_POST['username']) && isset($_POST['password']) && isset($_POST['email']) && isset($_POST['secQ']) && isset($_POST['secA'])) {
  16.  
  17.  
  18. // email validation function
  19.  
  20.  
  21. $username = mysql_real_escape_string($_POST['username']);
  22. $email = mysql_real_escape_string($_POST['email']);
  23. if(!email_valid($email))
  24. {
  25. die("email not correct");
  26. }
  27.  
  28. $secQ = mysql_real_escape_string($_POST['secQ']);
  29. $secA = mysql_real_escape_string($_POST['secA']);
  30. $password = $_POST['password'];
  31.  
  32. mysql_query("INSERT INTO admin (username, password, email, secquestion, secanswer, sendemail) VALUES ( '$username', '$password', '$email', '$secQ', '$secA','1')") or die (mysql_error()); echo "Account created.";
  33.  
  34. }
  35.  
  36. ?>
  37.  
  38.  
  39.  
  40. <html></html>
  41.  
  42. <form action="register.php" method="post">
  43. <br>
  44. <br>
  45. Username: <input name="username" type="text" />
  46. <br>
  47. <br>
  48. Password: <input type="password" name="password" />
  49. <br>
  50. <br>
  51. Email: <input name="email" type="text" />
  52. <br>
  53. <br>
  54. Choose a secret question.
  55. <select name="secQ">
  56. <option disabled selected value="0">Choose Option</option>
  57. <option value="1">What is your middle name?</option>
  58. <option value="2">What is your mothers maiden name?</option>
  59. <option value="3">What city were you born in?</option>
  60. <option value="4">What is your favorite color?</option>
  61. <option value="5">What year did you graduate from High School?</option>
  62. <option value="6">What was the name of your first boyfriend/girlfriend?</option>
  63. <option value="7">What is your favorite model of car?</option>
  64. </select>
  65. <br>
  66. <br>
  67. Pick a secret answer: <input name="secA" type="text" />
  68.  
  69. </select>
  70. <br>
  71. <br>
  72. <input type="submit" value="Submit" />
  73.  
  74. </form>
Add Comment
Please, Sign In to add comment