daily pastebin goal
94%
SHARE
TWEET

Untitled

a guest Apr 21st, 2018 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2. <head>
  3. <title>
  4. I herd you liek php
  5. </title>
  6. </head>
  7. <body>
  8. <?php
  9. require('config.php')
  10. ?>
  11. <?php
  12. // Checks if user is logged in
  13.             if(isset($_SESSION['loggedin']) == 1)
  14.     {
  15.         echo 'You are already logged in please go to the index';
  16.     }
  17. //checls for the register button, if found executes the registery
  18.             else if(isset($_POST['register']))
  19.     {
  20.     $username = strip_tags(mysql_real_escape_string($_POST['user']));
  21.     $password = md5( strip_tags(mysql_real_escape_string($_POST['pass'])));
  22.     $pass2 = md5(strip_tags(mysql_real_escape_string($_POST['password'])));
  23.     $ip = $_SERVER['REMOTE_ADDR'];
  24. //checks if all forms were filled in.
  25. if (empty ($username)||empty($password)||empty($pass2))
  26.     {
  27.         echo ' Please make sure you have filled in both fields and try again';
  28.     }
  29. //checks if pass1 and pass2 were filled in the same for security reasons.
  30.             else if ($password !== $pass2)
  31.     {
  32.         echo 'Passwords dont match';
  33.     }
  34.             else
  35.     {
  36.     $usertaken = mysql_query ("SELECT * FROM users WHERE `username` = '$username'");
  37.             if (mysql_num_rows ($usertaken) == 1)
  38.     {
  39.             echo 'This name has been taken';
  40.     }
  41.             else if (mysql_num_rows ($ip) == 3)
  42.     {
  43.         echo 'You already have the limit of 3 accounts.';
  44.     }
  45.             else
  46.     {
  47. //sql query if all checks out.
  48.     mysql_query("INSERT INTO `users` (`username`, `password`, `ip`) VALUES ('{$username}','{$password}','{$ip}')");
  49.     }
  50.         }
  51.             }
  52.        
  53. ?>
  54.     <form action="index.php" method="post">
  55.         <center>
  56.             Username: <input type="textbox" name="user">
  57.     <br />
  58.             Password: <input type="password" name="pass">
  59.     <br />
  60.             Repeat Password: <input type="password" name="password">
  61.     <br />
  62.             <input type="submit" value="Register" name="register">
  63.         </center>
  64.     </form>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top