Guest User

Untitled

a guest
Oct 20th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. <?php
  2.  
  3. require '_build/_php/functions.php';
  4.  
  5. initialize_database();
  6.  
  7.  
  8. if ( !$_SESSION['username'] ) : ?>
  9.  
  10. Please input your details and then hit 'Register'.
  11.  
  12. <?php if ( !$_POST['register'] ) : ?>
  13.  
  14. <form method="post">
  15.  
  16. <input type="text" name="email" value="" /><br />
  17.  
  18. <input type="text" name="first-name" value="" /><br />
  19.  
  20. <input type="text" name="last-name" value="" /><br />
  21.  
  22. <select name="gender">
  23.  
  24. <option selected="selected" disabled="disabled">Select a gender...</option>
  25.  
  26. <option value="male">Male</option>
  27.  
  28. <option value="female">Female</option>
  29.  
  30. </select><br />
  31.  
  32.  
  33. <input type="text" name="birthday-day" value="" size="1" /> /
  34.  
  35. <input type="text" name="birthday-month" value="" size="1" /> /
  36.  
  37. <input type="text" name="birthday-year" value="" size="2" /><br />
  38.  
  39.  
  40. <input type="text" name="username" value="" /><br />
  41.  
  42. <input type="password" name="password" value="" /><br />
  43.  
  44. <input type="password" name="password-verification" value="" /><br />
  45.  
  46. <input type="submit" name="register" value="Register" />
  47.  
  48. </form>
  49.  
  50. <? else :
  51.  
  52. $user = array(
  53.  
  54. 'email' => $_POST['email'],
  55.  
  56. 'first-name' => $_POST['first-name'],
  57.  
  58. 'last-name' => $_POST['last-name'],
  59.  
  60. 'gender' => $_POST['gender'],
  61.  
  62. 'username' => $_POST['username'],
  63.  
  64. 'password' => md5 ( $_POST['password'] ),
  65.  
  66. 'birthday' => $_POST['birthday-day'] . '/' . $_POST['birthday-month'] . '/' . $_POST['birthday-year']
  67.  
  68. );
  69.  
  70.  
  71. if ( in_array( '', $user ) ) :
  72.  
  73. print 'It looks like you left something blank.';
  74.  
  75. else :
  76.  
  77. print 'You have not left anything blank.';
  78.  
  79. endif;
  80.  
  81. endif; ?>
  82.  
  83. <? else :
  84.  
  85. header('Location: index.php');
  86.  
  87. endif;
  88.  
  89. ?>
Add Comment
Please, Sign In to add comment