Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <? require('connect.php'); ?>
- <?
- $user=$_POST['username'];
- $pass=$_POST['password'];
- $email=$_POST['mail'];
- $check="SELECT id FROM user WHERE email = '" . $email . "' OR username = '" . $user . "'";
- $resultcheck=mysql_query($check) or die (mysql_error());
- $matches=mysql_num_rows($resultcheck);
- if($matches != 0)
- {
- $errors[] = "Nick and/or email is already in use.";
- }
- else
- {
- //Not yet used
- //Is password 4 chars long at least ?
- if(strlen($pass) > 4)
- {
- //Is the username also 4 chars long at least
- if(strlen($user) > 4)
- {
- $pass=sha1($pass);
- $reg="INSERT INTO user (username, password, email) VALUES ('" . $user . "','" . $pass . "','" . $email . "')";
- mysql_query($reg) or die (mysql_error());
- }
- else
- {
- $errors[] = "Username must be 4 chars long";
- }
- }
- else
- {
- $errors[] = "Password must be more than 4 chars long.";
- }
- }
- mysql_close();
- for($i = 0; $i < count($errors); $i++)
- {
- echo $errors[$i]."\n";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement