Advertisement
Guest User

Untitled

a guest
Aug 9th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.85 KB | None | 0 0
  1.  
  2. <?php
  3.  
  4. include('../private/config.php/');
  5. include('../register/');
  6.  
  7. //test to see if username is alphannumberic
  8. $user=$_POST['useregister'];
  9. $pass=$_POST['passwordregister'];
  10. $conf=$_POST['pass2'];
  11.  
  12. if ($pass != $conf) {
  13.     //pass and confirm don't equal each other
  14. }
  15. if(!preg_match('/[^A-Za-z0-9]/ i' , $test)){
  16.    
  17.         //test for duplicate names
  18.         $query="SELECT * FROM usernames WHERE username ='$user'";
  19.         $result=mysql_query($query);
  20.         $num=mysql_num_rows($result);
  21.        
  22.         if ($num == 0){
  23.            
  24.             //insert users into table
  25.             $sql="INSERT INTO users SET username = '$user', password = '$passwordregister'";
  26.             $result=mysql_query($sql);
  27.            
  28.             //Shows "Thanks for registering" page
  29.             header("Location:../thanksreg/");
  30.            
  31.            
  32.             }else{
  33.             header("Location:../nameinuse/");  
  34.             }
  35.    
  36.     }else{
  37.     header("Location:../invalidname/");
  38.     }
  39. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement