Advertisement
Guest User

Untitled

a guest
Aug 1st, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.77 KB | None | 0 0
  1. <?php
  2. session_start();
  3. require('/home/phpboard/public_html/includes/config.php');
  4. ?>
  5. <table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
  6. <tr>
  7. <form name="form1" method="post" action="">
  8. <td>
  9. <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
  10. <tr>
  11. <td colspan="3"><strong>Registration</strong></td>
  12. </tr>
  13. <tr>
  14. <td width="78">Username</td>
  15. <td width="6">:</td>
  16. <td width="294"><input name="username" type="username" id="username"></td>
  17. </tr>
  18. <tr>
  19. <td>Password</td>
  20. <td>:</td>
  21. <td><input name="password" type="password" id="password"></td>
  22. </tr>
  23. <tr>
  24. <td>Retype Password</td>
  25. <td>:</td>
  26. <td><input name="password2" type="password" id="password"></td>
  27. </tr>
  28. <tr>
  29. <td>Email</td>
  30. <td>:</td>
  31. <td><input name="email" type="email" id="email"></td>
  32. </tr>
  33. <tr>
  34. <td>&nbsp;</td>
  35. <td>&nbsp;</td>
  36. <td><input type="submit" name="submit" value="Register"></td>
  37. </tr>
  38. </table>
  39. </td>
  40. </form>
  41. </tr>
  42. </table>
  43. <html><center><a href="/index.php">Click Here To Go To Main Page</a></center><html>
  44. <?php
  45. if(isset($_POST['submit']))
  46. {
  47. // Here we save the things people wrote in the variables
  48. $username=$_POST['username'];
  49. $password=$_POST['password'];
  50. $password2=$_POST['password2'];
  51. $email=$_POST['email'];
  52. // Here we set a variable that will check in the database if the username is taken
  53. $result = mysql_query("SELECT * FROM UserData");
  54. $users = mysql_query("SELECT UserID FROM UserData");
  55. $count=mysql_num_rows($result);
  56.  
  57. // Here we check if people wrote the right thing, so we validate what they are trying to submit
  58. if($username=="")
  59. {
  60. // If no username is typed
  61. echo "<html><center><html>Please enter your username.<html></center><html>";
  62. }
  63. else if($count=="1")
  64. {
  65. // If the username is taken
  66. echo "<html><center><html>Username is already taken<html></center><html>";
  67. }
  68. else if($password=="")
  69. {
  70. // If no password is typed
  71. echo "<html><center><html>Please enter your password.<html></center><html>";
  72. }
  73. else if($password2=!$password)
  74. {
  75. // If the passwords doesn't match
  76. echo "<html><center><html>Passwords did not match.<html></center><html>";
  77. }
  78. else if($email=="")
  79. {
  80. // If no email is typed
  81. echo "<html><center><html>Please enter your email address.<html></center><html>";
  82. }
  83. else
  84. {
  85. $encrypt_password=md5($password);
  86. mysql_query("INSERT INTO UserData (UserID, Username, Password, Email, Reputation, Post, Status)
  87. VALUES ('$users', '$username', '$encrypt_password', '$email', '0', '0', 'User')");
  88. echo "<html><center><html>Register Completed!<html></center><html>";
  89. }
  90. }
  91. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement