$txt .= "<br /><br /> - The area code that you submitted is not valid.<br />Area Code: " . $areacode; $pass = false; } } elseif (strlen($phone) != 0) { $txt .= "<br /><br /> - The phone number that you submitted is not valid.<br />Phone Number: "; if (strlen($areacode) > 0) { $txt .= "(" . $areacode . ")-"; } $txt .= $phone; $pass = false; } else { $txt .= "<br /><br /> - To submit an application, you must provide a valid phone number."; $pass = false; } // Make sure that the requested username was not changed when filtered. $filtered_username = remove_chars(remove_chars(remove_chars(remove_chars($username, $U_letters), $L_letters), $numbers), $legal_username_characters); if ($username != $_POST['username'] || strlen($filtered_username) > 0) { $txt .= "<br /><br /> - Your username contains illegal characters."; $pass = false; } else { // Make sure that the requested username is not already taken. if (mysql_select_db("Accounts", $con)) { $visitor = mysql_query("SELECT * FROM Members\n\t\t\tWHERE username='******'"); while ($row = mysql_fetch_array($visitor)) { if ($row['username'] == $username) { $txt .= "<br /><br /> - The username you have selected has already been taken."; $pass = false; break; } } if (!mysql_select_db("Form_IPs", $con)) {
$pass = false; } } // Make sure that the user's password contains at least 2 of the 3: at least 1 letter; at least 1 number; at least one legal symbol. $char_types = 0; // This is the number of character types in the password. // Check for letters... if (strlen(remove_chars(remove_chars($password, $U_letters), $L_letters)) < strlen($password)) { $char_types++; } // Check for numbers... if (strlen(remove_chars($password, $numbers)) < strlen($password)) { $char_types++; } // Check for symbols... if (strlen(remove_chars($password, $legal_password_characters)) < strlen($password)) { $char_types++; } // Now, if $char_types is less than 2, the password doesn't contain enough symbol types. if ($char_types < 2) { $txt .= "<br /><br /> - Passwords must contain characters from at least 2 of the following 3 categories:<br /><br />- Letters (upper or lower case)<br />- Numbers<br />- Legal Symbols "; for ($n = 0, $size = sizeof($legal_password_characters); $n < $size; $n++) { if ($n > 0) { $txt .= ", "; } $txt .= $legal_password_characters[$n]; } $txt .= " "; $pass = false; } // Make sure that the user's password is between 6 and 20 characters.
function get_agent($str) { $str = trim(clean_str($str)); $str = strip_tags($str); $agent = ""; if (substr($str, strlen($str) - 1) != ")") { return ""; } //get start pos of agent $pos = find_pos_of_this_char_by_moving_backwards($str, "("); if ($pos != "") { $agent = trim(substr($str, $pos, strlen($str))); //get end pos of agent $pos = find_pos_of_this_char_by_moving_backwards($agent, ")"); if ($pos != "") { $agent = substr($agent, 0, $pos + 1); } $agent = str_replace("e.g.,", '', $agent); //remove 1st char if ';' or '"' or '(' if (in_array(substr($agent, 0, 1), array(';', '"'))) { $agent = trim(substr($agent, 1, strlen($agent))); } } else { $agent = ""; } $agent = trim(remove_chars($agent)); return $agent; }