Advertisement
Guest User

Untitled

a guest
Jul 9th, 2017
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.14 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.  
  11. if ((!empty ($username) && !empty ($password)) && ($random_num > 0 && strlen($random_num) == ($length))) {
  12. $sql = mysql_query ("INSERT INTO users (
  13. user_id,username,user_password,user_regdate)
  14. VALUES (
  15. '0','".$username."','".$password."','".time()."')
  16. ");
  17. 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>';
  18. } else {
  19. 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">';
  20. }
  21. } else if (isset($_POST['register1'])) { {
  22. echo '<html>
  23. <head>
  24. <br /><center>-PLEASE READ-<br />
  25. </head>
  26. </font>
  27. <font face="arial" size="3">
  28. Before you sgin up i would like to say a few things...<br /><br />
  29. 1. You will not tell anyone you password, Even if they are your best friends<br />
  30. 2. You will not try to hack into the database and steal information<br />
  31. 3. You will not make any crude or racist usernames<br />
  32. 4. You will not upload inapproprate content in the photos/videos section<br /><br />
  33. <center>Failure to follow any of the above WILL result in immediate account termination</center>
  34. <br />
  35. If you would like to complete account making, click the "I Agree" button
  36. </font>
  37. </html><br />Please enter that desiered username and password<br />
  38. <right><form action="home.php" method="post">
  39. Username: <input type="text" name="username" /><br />
  40. Password: <input type="password" name="password" /><br />
  41. </right>';
  42. srand(time());
  43. $random = (rand()%6)+1;
  44. $random1 = (rand()%6)+1;
  45. $random2 = (rand()%6)+1;
  46. $random3 = (rand()%6)+1;
  47. $random4 = (rand()%6)+1;
  48. $random5 = (rand()%6)+1;
  49. $random_numbers = "$random$random1$random2$random3$random4$random5";
  50. echo 'Validation code:'; echo ' <input type="text" name="random_num" />'; print(" ($random_numbers)");
  51. echo '<br /><input type="submit" name="agreeregister" value="I Agree & Register" />
  52. </form>';
  53. } } else {
  54. echo '<center><form action="home.php" method="post"><input type="submit" name="register1" value="Click Here To Register" /></fotm>';}
  55. ?>
  56.  
  57. #######################################
  58.  
  59. <?php
  60.  
  61. session_start();
  62. include("temp.html");
  63. include ('mysql.php');
  64.  
  65. if (isset ($_POST['login'])) {
  66. $username = mysql_escape_string($_POST['username']);
  67. $password = mysql_escape_string(sha1 ($_POST['password']));
  68.  
  69. if (!empty ($username) && !empty ($password)) {
  70. $sql = mysql_query ("SELECT * FROM users
  71. WHERE username='".$username."' AND
  72. user_password='".$password."' LIMIT 1");
  73.  
  74. if (mysql_num_rows ($sql) > 0) {
  75. $_SESSION['loggedin'] = true;
  76. $_SESSION['username'] = $username;
  77.  
  78. echo '<center><font color="#00ff00">You have been logged in<br />Please wait as we connect you to the member home page<meta http-equiv="Refresh" content="5; url=home.php">';
  79.  
  80. } else {
  81. echo '<center><font color="#ff0000"><br />Your your username and/or password is incorrect. Please try again</center><meta http-equiv="refresh" content="5; url=home.php">';
  82. }
  83.  
  84. } else {
  85. echo '<center><table width="400" table bgcolor="#ff0000"><tr><td><center>You must enter a username and/or password</center></td></tr></table></center><meta http-equiv="refresh" content="5; url="login.php">';
  86. }
  87. } else {
  88. echo '<center><form action="home.php" method="post">
  89. Username: <input type="text" name="username" cols="10" />
  90. Password: <input type="password" name="password" cols="10" />
  91. <input type="submit" name="login" value="Login" />
  92. </form></center>';
  93. }
  94.  
  95. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement