SHARE
TWEET

Untitled

a guest Jun 14th, 2017 503 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. $host="localhost"; // Host name
  4. $db_username="cameron_cameron"; // Mysql username
  5. $db_password="**********"; // Mysql password
  6. $db_name="cameron_portfolio"; // Database name
  7. $tbl_name="members"; // Table name
  8.  
  9. // Connect to server and select database.
  10. mysql_connect("$host", "$db_username", "$db_password")or die("cannot connect");
  11. mysql_select_db("$db_name")or die("cannot select DB");
  12.  
  13. if(isset($_POST['submit'])){
  14.  
  15.  
  16. $username = $_POST['username'];
  17. $password = $_POST['password'];
  18. $email = $_POST['email'];
  19. $repeatpass = $_POST['repeatpassword'];
  20. $about = $_POST['about'];
  21.  
  22.  
  23. if($password != $repeatpass){
  24. die("Your passwords don't match!");
  25. }
  26. else
  27. {
  28.     if(strlen($username) >= 50){
  29.     die("Username is too long! Maximum length is 50 characters.");
  30.     }
  31.     else
  32.     {
  33.         if(strlen($username) <= 2){
  34.             die("Username is too short! Minimum length is 3 characters.");
  35.             }
  36.         else
  37.         {
  38.             if(strlen($password) <=5){
  39.                 die("Password is too short! Minimum length is 6 characters");          
  40.                 }
  41.         else
  42.         {
  43.        
  44.         if(strlen($email) >=50 || strlen($email) == 0){
  45.         die("Email length must be between 1 and 50 characters!");
  46.         }
  47.         else
  48.         {
  49.             $password = md5($password);
  50.    
  51.             $insert = "INSERT INTO `cameron_portfolio`.`members` (`id`, `username`, `password`, `email`, `about`, `admin`, `approved`, `date`) VALUES (NULL, '$username', '$password', '$email', '$about', '0', '0', CURRENT_TIMESTAMP);";
  52.             //add a  ;  ?
  53.             $query = mysql_query($insert);
  54.            
  55.             $mail = "
  56.             Hey there $username!
  57.             Thanks for applying at my site.
  58.            
  59.             I've recieved your request and will most likely approve it within a day or two.
  60.            
  61.             Thanks!
  62.             ";
  63.             mail($email, "Registration at Cameron's Portfolio", $mail, "From: me@scamron.co.cc");
  64.            
  65.             mail("me@scamron.co.cc", "New Member: $username", "Check signup requests, $username has joined!", "From: me@scamron.co.cc");
  66.            
  67.             header("location: index.php?r=s");
  68.        
  69.         }
  70.         }
  71.        
  72.         }
  73.     }
  74. }
  75.  
  76. //}
  77. else
  78. {
  79. echo "Nothing submitted!";
  80. }
  81.  
  82.  
  83. ?>
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