Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include('config.php');
- include('register.php');
- //test to see if username is alphannumberic
- $test=$_POST[username];
- if(!preg_match('/[^A-Za-z0-9]/ i' , $test)){
- //test for duplicate names
- $query="SELECT * FROM users WHERE username ='$_POST[username]'";
- $result=mysql_query(query);
- $num=mysql_num_rows($result);
- if ($num == 0){
- //insert users into table
- $sql="INSERT INTO users SET username = '$user', password = '$pass'";
- $result=mysql_query($sql);
- //Shows "Thanks for registering" page
- header("Location:thanksreg.html");
- }else{
- header("Location:nameinuse.html");
- }
- }else{
- header("Location:invalidname.html");
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement