Jump to content

Check Username Forum Field


PrinceOfDragons

Recommended Posts

I have a function I came up with to use to check a username input from the forum field, Im just wondering if someone can check it and tell me if there is a better way of doing it. Thank You!!!

 

	function checkUname() {
	global $uname;

	if($this->username == "") {
		echo "Username field is blank"; $this->myErrors++;
}		elseif($uname != $_POST['username'] && $_POST['Log-In'] == "Log-In"){
		echo "Username does not exist"; $this->myErrors++;
}		elseif(strlen($this->username) < "5") {
		echo "Username is to short"; $this->myErrors++;
}		elseif(!eregi("^([0-9a-z])*$", $this->username)) {
		echo "Username is not Alphanumeric"; $this->myErrors++;			
}		elseif($uname == true && $_SESSION['create'] == "Create Account"){
		echo "Username Taken"; $this->myErrors++;

Link to comment
https://forums.phpfreaks.com/topic/169586-check-username-forum-field/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.