Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include("include.php");
- include("opendb.php");
- $password = $_POST['password'];
- $check = "select id from $table where username = '".$_POST['username']."';";
- $qry = mysql_query($check) or die ("Could not match data because ".mysql_error());
- $num_rows = mysql_num_rows($qry);
- if ($num_rows != 0) {
- echo "Sorry, the username ".$_POST['username']." is already taken. Please hit the back button and try again.<br>";
- exit;
- } else {
- if(
- (ctype_alnum($password))// numbers & digits only
- && (strlen($password)>6) // at least 7 chars
- && (strlen($password)<21) // at most 20 chars
- && (preg_match('`[A-Z]`',$password)) // at least one upper case
- && (preg_match('`[a-z]`',$password)) // at least one lower case
- && (preg_match('`[0-9]`',$password)) // at least one digit
- ){
- $insert = mysql_query("insert into $table values ('NULL', '".$_POST['username']."',
- '".$_POST['password']."','".$_POST['firstName']."','".$_POST['lastName']."','".$_POST['emailAddr']."','".$_POST['telephone']."','".$_POST['postCode']."')")
- or die("Could not insert data because ".mysql_error());
- echo "Your user account has been created!<br>";
- echo "You may now <a href='index.php?tab=2'>log in</a> with your username and password.";
- }else{
- echo "Password does not meet requirements. Blah blah.";
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement