Advertisement
Guest User

Untitled

a guest
Jul 9th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.86 KB | None | 0 0
  1. <?php
  2.  
  3. include ('mysql.php');
  4. include("temp.html");
  5. if (isset ($_POST['agreeregister'])) {
  6.         $username = mysql_escape_string($_POST['username']);
  7.         $password = mysql_escape_string(sha1($_POST['password']));
  8.         $random_num = ($_POST['random_num']);
  9.         $length = 6;
  10.         $query="SELECT * FROM users WHERE username ='$_POST[username]'";
  11.         $result=mysql_query($query);
  12.         $dup=mysql_num_rows($result);
  13.     if ((!empty ($username) && !empty ($password)) && ($random_num > 0 && strlen($random_num) == ($length)) && ($dup == 0)) {
  14.        
  15.         $sql = mysql_query ("INSERT INTO users (
  16.                     user_id,username,user_password,user_regdate)
  17.                     VALUES (
  18.                     '0','".$username."','".$password."','".time()."')
  19.                     ");
  20.                 echo '<font face="arial" size="5"><br /><br /><center><table width="400" align="center" bgcolor="#00ff00"><tr><td><center><b>you are now registered!<br /><Please Log Into Your Account Above</b></center></tr></td></table></center><br /></font>';
  21.     } else {
  22.         echo '<font face="arial" size="5"><br /><br /><center><table width="400" bgcolor="#ff0000"><tr><td><center>Your Username / Password has to be longer than 6 characters<br />AND<br />You have to put in the correct Validation code</center></td></tr></table></center></font><meta http-equiv="refresh" content="5; url="register.php">';
  23. }} else  if (isset($_POST['register1'])) {  {
  24.         echo '<html>
  25. <head>
  26. <br /><center>-PLEASE READ-<br />
  27. </head>
  28. </font>
  29. <font face="arial" size="3">
  30. Before you sgin up i would like to say a few things...<br /><br />
  31. 1. You will not tell anyone you password, Even if they are your best friends<br />
  32. 2. You will not try to hack into the database and steal information<br />
  33. 3. You will not make any crude or racist usernames<br />
  34. 4. You will not upload inapproprate content in the photos/videos section<br /><br />
  35. <center>Failure to follow any of the above WILL result in immediate account termination</center>
  36. <br />
  37. If you would like to complete account making, click  the "I Agree" button
  38. </font>
  39. </html><br />Please enter that desiered username and password<br />
  40.     <right><form action="home.php" method="post">
  41.        Username: <input type="text" name="username" /><br />
  42.        Password: <input type="password" name="password" /><br />
  43.        </right>';
  44. srand(time());
  45. $random = (rand()%6)+1;
  46. $random1 = (rand()%6)+1;
  47. $random2 = (rand()%6)+1;
  48. $random3 = (rand()%6)+1;
  49. $random4 = (rand()%6)+1;
  50. $random5 = (rand()%6)+1;
  51. $random_numbers = "$random$random1$random2$random3$random4$random5";
  52. echo 'Validation code:'; echo ' <input type="text" name="random_num" />'; print(" ($random_numbers)");
  53. echo '<br /><input type="submit" name="agreeregister" value="I Agree & Register" />      
  54.        </form>';
  55. } } else {
  56. echo '<center><form action="home.php" method="post"><input type="submit" name="register1" value="Click Here To Register" /></fotm>';}
  57. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement