Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include('configuration.php');
- $user = strip_tags($_POST['username']);
- $pw = strip_tags($_POST['pw']);
- $pw2 = strip_tags($_POST['pw2']);
- $email = strip_tags($_POST['email']);
- if($user && $pw && $pw2 && $email) {
- if(strlen($user) > 20) {
- echo '<script>alert("Username is too long.")</script>';
- }elseif(strlen($user) < 4) {
- echo '<script>alert("Username is too short.")</script>';
- }elseif(strlen($pw) > 40) {
- echo '<script>alert("Password is too long.")</script>';
- }elseif(strlen($email) < 3) {
- echo '<script>alert("Email is too short.")</script>';
- }elseif($pw !== $pw2) {
- echo '<script>alert("Passwords do not match.")</script>';
- }else{
- $getusernames = "SELECT * FROM `account` WHERE `username`='$user'";
- $num_rows = mysql_num_rows($getusernames);
- if ($num_rows = 0) {
- mysql_select_db("$realmdb", $connect);
- $pw_hash = sha1(strtoupper($user).':'.strtoupper($pw));
- $register_sql = mysql_query ("INSERT INTO account (username, sha_pass_hash, email, expansion) values ('$user', '$pw_hash', '$email', '1')");
- echo '<script>alert("Account is successfully created!")</script>';
- }else{
- echo '<script>alert("User already exists. Please try again!")</script>';
- }
- }
- }else
- ?>
Add Comment
Please, Sign In to add comment