Advertisement
Guest User

new reg

a guest
Sep 20th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.65 KB | None | 0 0
  1. <?
  2.  
  3. // Variables
  4. include("config.php");
  5.  
  6. $register = $_POST["Submit"];
  7. $user = $_POST["Username"];
  8. $pass = $_POST["Password"];
  9. $repass = $_POST["RepeatPassword"];
  10. $email = $_POST["Email"];
  11. $key = rand(0, 99999999) . "oi";
  12. $unix = time();
  13.  
  14. # If "CREATE PENGUIN" was pressed:
  15. if(isset($register)) {
  16.    
  17.     $res = mysql_query('SELECT Username FROM users WHERE Username="' . $user . '"');
  18.     mysql_connect($server, $username, $password);
  19.    
  20.     # If the connection fails:
  21.     if(!$conn) {
  22.         die("Failed to connect to the MySQL Database: " . mysql_error());
  23.     }
  24.    
  25.     mysql_select_db("wizguin");
  26.    
  27.     # If the username exists:
  28.     if(mysql_num_rows($res) != 0) {
  29.         mysql_close();
  30.         die("The username " . $user . " already exists.");
  31.     }
  32.    
  33.     # If the passwords match:
  34.     if($pass == $repass) {
  35.         # If the passwords are 4-12:
  36.         if(strlen($pass) >= 4 && strlen($pass) <= 12) {
  37.             # If the username is 4-30:
  38.             if(strlen($user) >= 4 && strlen($user) <= 30) {
  39.                 mysql_db_query("wizguin", 'INSERT INTO users (Username, Password, LoginKey, RegisteredTime, Buddies, Ignores, Inventory) VALUES ("' . $user . '", "' . $pass . '", "' . $key . '", "' . $unix . '", "[[]]", "[]", "["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","413"]")');
  40.                 mysql_close();
  41.                 echo '<meta http-equiv="refresh" content="0; url=http://wizguin.byethost3.com/register.html?acc=1" />';
  42.             }
  43.             else die("The username " . $user . " is too long/short.");
  44.         }
  45.         else die("Passwords are too long/short.");
  46.     }
  47.     else die("Passwords do not match.");
  48. }
  49.  
  50. mysql_close();
  51. else echo '<meta http-equiv="refresh" content="0; url=http://wizguin.byethost3.com/register.html?acc=0" />';
  52.  
  53. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement