function validateUser($user) { $MIN_USER_LENGTH = 6; $MAX_USER_LENGTH = 24; // MIN LENGTH CHECK if (strlen($user) < $MIN_USER_LENGTH) { echo "<font color=\"red\"><b>ERROR: Usernames must be at least {$MIN_USER_LENGTH}.</b></font><br>"; echo "(Main page will reload shortly...)\n"; echo "<script type=\"text/javascript\">\nreload_page=function() {\n\tlocation.replace(\"{$url}\");\n}\n"; echo "var intervalID = window.setInterval(reload_page, 5000);\n</script>\n"; return ""; } // MAX LENGTH CHECK if (strlen($user) > $MAX_USER_LENGTH) { echo "<font color=\"red\"><b>ERROR: Usernames must be at most {$MAX_USER_LENGTH}.</b></font><br>"; echo "(Main page will reload shortly...)\n"; echo "<script type=\"text/javascript\">\nreload_page=function() {\n\tlocation.replace(\"{$url}\");\n}\n"; echo "var intervalID = window.setInterval(reload_page, 5000);\n</script>\n"; return ""; } //CHECK FOR NON ALPHANUMERIC CHARACTERS if (checkForAlphanumericCharacters($user)) { echo "<font color=\"red\"><b>ERROR: Your username contains non-alphanumeric characters.</b></font><br>"; echo "(Main page will reload shortly...)\n"; echo "<script type=\"text/javascript\">\nreload_page=function() {\n\tlocation.replace(\"{$url}\");\n}\n"; echo "var intervalID = window.setInterval(reload_page, 5000);\n</script>\n"; return ""; } //RETURN user return $user; }
function validateUser($user) { $MIN_USER_LENGTH = 6; $MAX_USER_LENGTH = 24; // MIN LENGTH CHECK if (strlen($user) < $MIN_USER_LENGTH) { echo "<font color=\"red\"><b>ERROR: Your user name is too short, minimum is {$MIN_USER_LENGTH}.</b></font><br>"; echo "(Main page will reload shortly...)\n"; echo "<script type=\"text/javascript\">\nreload_page=function() {\n\tlocation.replace(\"user.register.php\");\n}\n"; echo "var intervalID = window.setInterval(reload_page, 1000);\n"; echo "</script>\n"; return ""; } // MAX LENGTH CHECK if (strlen($user) > $MAX_USER_LENGTH) { echo "<font color=\"red\"><b>ERROR: Your user name is too long, maximum is {$MAX_USER_LENGTH}.</b></font><br>"; echo "(Main page will reload shortly...)\n"; echo "<script type=\"text/javascript\">\nreload_page=function() {\n\tlocation.replace(\"user.register.php\");\n}\n"; echo "var intervalID = window.setInterval(reload_page, 1000);\n"; echo "</script>\n"; return ""; } //CHECK FOR NON ALPHANUMERIC CHARACTERS if (checkForAlphanumericCharacters($user)) { echo "<font color=\"red\"><b>ERROR: You have a non-alphanumeric character in your username.</b></font><br>"; echo "(Main page will reload shortly...)\n"; echo "<script type=\"text/javascript\">\nreload_page=function() {\n\tlocation.replace(\"user.register.php\");\n}\n"; echo "var intervalID = window.setInterval(reload_page, 1000);\n"; echo "</script>\n"; return ""; } //RETURN user return $user; }