localhost Posted August 19, 2006 Share Posted August 19, 2006 [code]$error = array();if (isset($_POST['submit']) && !empty($_POST['user_name']) && !empty($_POST['pass1'])&& !empty($_POST['pass2']) && !empty($_POST['email'])) {// Define POST variables $user_name = stripinput(trim($_POST['user_name'])); $pass1 = stripinput(trim($_POST['pass1'])); $pass2 = stripinput(trim($_POST['pass2'])); $email = stripinput(trim($_POST['email'])); $hide_email = stripinput(trim($_POST['hide_email'])); // Check if username is already in use $sql_check_user = query("SELECT user_name FROM `" . $config['table_prefix'] . "members` WHERE user_name = '$user_name'"); $sql_num_user = num_rows($sql_check_user); if ($sql_num_user >= 1) { $error[] = 'Username ' . $user_name . ' already in use.'; } if (strlen($user_name) < 4 || strlen($user_name) > 16) { $error[] = 'Username must be more than 4 characters, but less than 16. Your username is currently ' . strlen($user_name) . ' characters long.'; } // Check if Email address is already in use $sql_check_email = query("SELECT email FROM `" . $config['table_prefix'] . "members` WHERE email = '$email'"); $sql_num_email = num_rows($sql_check_email); if ($sql_num_email >= 1) { $error[] = 'Email Address ' . $email . ' already in use.'; } if (strlen($email) < 12 || strlen($email) > 35) { $error[] = 'Email Address must be within 12 and 35 characters, your email is currently ' . strlen($email) . ' characters.'; }// Make sure both passwords entered are identical if ($pass1 != $pass2) { $error[] = 'The passwords entered do not match.'; } // Make sure Email address is in valid format if (!eregi("[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}",$email)) { $error[] = 'Email address format is not valid.'; } // Encrypt password using sha1(); $password = sha1($pass1); // Generate random activation key $act = rand(1, 99999); $act_key = md5($act); // Create login key$stepkey = randomkeys(32); $step2 = base64_encode($stepkey); $loginkey = md5(sha1($step2)); // Insert details into database tableif(count($error) > 0) { foreach($error as $key => $value) { $alert .= $value; } $sql_insert_user = query("INSERT INTO `" . $config['table_prefix'] . "members` (`user_name`, `password`, `email`, `regip`, `hide_email`, `join_date`, `act_key`, `usergroupID`, `loginkey`) VALUES ('$user_name', '$password', '$email', '$ip_address', '$hide_email', '$time', '$act_key', '0', '$loginkey')"); $to=$email;$subject="Thank you for signing up to site name !";$header="From: Administration <$SITE_URL>";$message="Your Activation link \r\n";$message.="Click on this link to activate your account \r\n";$message.="http://$SITE_URL/activate.php?key=$act_key";$sentmail = mail($to,$subject,$message,$header); if ($sentmail) { $alert = "An email has been dispatched to $email in order to activate your user account."; } }}[/code] Quote Link to comment https://forums.phpfreaks.com/topic/18042-registrationerror-reporting-in-array-not-working/ Share on other sites More sharing options...
wildteen88 Posted August 19, 2006 Share Posted August 19, 2006 Um dont just post the code. What do you want? Please explain whats wrong with your script and what you are trying to do. Also post what the script is supposed to do. Edit the post above to add this in.When you post coder please use the code tags. ([ code][ /code] (without the spaces before [)) Quote Link to comment https://forums.phpfreaks.com/topic/18042-registrationerror-reporting-in-array-not-working/#findComment-77307 Share on other sites More sharing options...
localhost Posted August 19, 2006 Author Share Posted August 19, 2006 well basically, the strlen stuff, and the $error array isnt working! i have no idea why....sorry about not posting inside the code thing, i did but then i editted it to show updated code. Quote Link to comment https://forums.phpfreaks.com/topic/18042-registrationerror-reporting-in-array-not-working/#findComment-77308 Share on other sites More sharing options...
localhost Posted August 19, 2006 Author Share Posted August 19, 2006 anyone? Quote Link to comment https://forums.phpfreaks.com/topic/18042-registrationerror-reporting-in-array-not-working/#findComment-77354 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.