Advertisement
Guest User

Untitled

a guest
Jul 18th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.26 KB | None | 0 0
  1. <?php
  2. ini_set('display_errors', 1);
  3. error_reporting(E_ALL);
  4. include($_SERVER['DOCUMENT_ROOT'].'/dbcon.php');
  5. ?>
  6. <html>
  7. <head>
  8. <title></title>
  9. <script type="text/javascript" src="js/jquery.js"></script>
  10. <script type="text/javascript" src="js/jquery.pstrength-min.1.2.js">
  11. </script>
  12. <script type="text/javascript">
  13. $(function() {
  14. $('.password').pstrength();
  15. });
  16. </script>
  17. </head>
  18. <?
  19.  
  20.  
  21. if(isset($HTTP_POST_VARS['submit']))
  22. {
  23. if(!$_POST['username']) die('Alert: username field was blank.');
  24. $junk = array('.' , ',' , '`' , ';' , '[' ,  ']' , '-', ' ',
  25.               '*', '&', '^', '%', '$', '#', '@', '!', '~', '+', '(', ')',
  26.               '|', '{', '}', '<', '>', '?', ':', '"', '=');
  27.  
  28. $len = strlen($_POST['username']);
  29.  
  30. $_POST['username'] = str_replace($junk, '', $_POST['username']);
  31. $test = $_POST['username'];
  32.  
  33. if(strlen($test) != $len) {
  34. die('Username Error: Username contained invalid characters. You can only use A-Z, 0-9 and the underscore (_).');
  35. }
  36.  
  37. $check = "select id from members where username = '".$_POST['username']."'";
  38. $qry = mysql_query($check) or die ('Could not match data because '.mysql_error());
  39. $num_rows = mysql_num_rows($qry);
  40. if ($num_rows != 0) {
  41. echo "Sorry, there the username '".$_POST['username']."' is already taken./n Try again";
  42. exit;
  43. }
  44.  
  45. if(isset($_POST['vnaam'])) {
  46. echo "Error: Fill in ure first name";
  47. }
  48. if(!$_POST['lnaam']) {
  49. echo "Error: Fill in ure last name";
  50. }
  51. if(!$_POST['password']) {
  52. echo "Error: Password field was blank";
  53. }
  54. if(!$_POST['verify_password']) {
  55. echo "Error: Verify Password field was blank.";
  56. }
  57. if($_POST['password'] != $_POST['verify_password']) {
  58. echo "Error: The passwords do not match.";
  59. }
  60. if(strlen($_POST['password']) < 6 ) {
  61. echo "Error: Your password is too short. Must be 6 or more characters in length.";
  62. }
  63.  
  64. if (!check_email($_POST['email'])) {
  65. echo "<strong>Email is not valid!</strong>";
  66. }
  67. $res = mysql_query("SELECT id FROM members WHERE email='".$_POST['email']."'");
  68. if (mysql_num_rows($res) == 1) {
  69. echo "<strong>Email already existst in database!</strong>";
  70. }
  71.  
  72. if (!$_POST['geslacht']){
  73. echo "error: Please select ure gender";
  74. }
  75.  
  76. else {
  77. $insert ="INSERT INTO `members` (username, password, email, userlevel, vnaam, lnaam, geslacht)
  78.      VALUES
  79. ('".mysql_real_escape_string($_POST['username'])."',
  80. '".md5($_POST['password'])."',
  81.  '".mysql_real_escape_string($_POST['email'])."',
  82.  '1',
  83.  '".mysql_real_escape_string($_POST['vnaam'])."',
  84.  '".mysql_real_escape_string($_POST['lnaam'])."',
  85.  '".$_POST['geslacht']."'
  86. )";
  87.  
  88. $insert2 = mysql_query($insert);
  89. if(!$insert2) die(mysql_error());
  90.  
  91. echo('Registration Successful, Welcome new member! You can now login to your new account.');
  92. }
  93. } else {
  94. ?>
  95. <table>
  96.     <form name="signup" action="<? $_SERVER['PHP_SELF']; ?>" method="POST">
  97.    
  98.    
  99.     <tr>
  100.         <td><font color="#CC0000">*</font>Naam:<BR>
  101.         </td>
  102.         <td><input type="text" id="vnaam" name="vnaam" value="" maxlength="30">
  103.         <BR>
  104.         </td>
  105.     </tr>
  106.     <tr>
  107.         <td><font color="#CC0000">*</font>achter Naam:<BR>
  108.         </td>
  109.         <td><input type="text" id="lnaam" name="lnaam" value="" maxlength="30">
  110.         <BR>
  111.         </td>
  112.     </tr>
  113.     <tr>
  114.         <td><font color="#CC0000">*</font>Username:<br>
  115.         (only A-Z, 0-9 and _ Allowed)<BR>
  116.         </td>
  117.         <td><input type="text" id="username" name="username" value=""
  118.             maxlength="30"> <BR>
  119.         </td>
  120.     </tr>
  121.     <tr>
  122.         <td><font color="#CC0000">*</font>Password:</td>
  123.         <td><input class="password" type="password" id="password"
  124.             name="password" value="" maxlength="30"> (minimum 6 characters)</td>
  125.     </tr>
  126.     <tr>
  127.         <td><font color="#CC0000">*</font>Verify Pass:</td>
  128.         <td><input type="password" id="verify_password" name="verify_password"
  129.             value="" maxlength="30"><BR>
  130.  
  131.         </td>
  132.     </tr>
  133.     <tr>
  134.         <td><font color="#CC0000">*</font>Email:</td>
  135.         <td><input type="text" id="email" name="email" value="" size="30"><br>
  136.         </td>
  137.     </tr>
  138.     <tr>
  139.         <td><font color="#CC0000">*</font>Geslacht:</td>
  140.         <td><select name="geslacht">
  141.             <option value="" selected="selected">Select one...</option>
  142.             <option value="man">Man</option>
  143.             <option value="vrouw">Vrouw</option>
  144.         </select><br>
  145.         </td>
  146.     </tr>
  147.     <tr>
  148.         <td>Click to Complete Signup:</td>
  149.         <td><input type="submit" id="submit" name="submit" value="submit"></td>
  150.     </tr>
  151.     </form>
  152. </table>
  153. <?
  154. }
  155. ?>
  156. </body>
  157. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement