Public feed #599024

Unnamed

public text v1 · immutable
Raw Edit
·published 2007-07-01 19:20 UTC
rendered paste body
if(isset($_POST["submit"])){
	$error_msg='';
	if(trim($_POST["userName"])=='' || strlen(trim($_POST["userName"])) < 3 || strlen(trim($_POST["userName"])) > 20) {
		$error_msg.="Please enter a username between 3 to 20 characters long<br>";
	}
	if(trim($_POST["password"])=='' || strlen(trim($_POST["password"])) < 4) {
		$error_msg.="Please enter a password at least 4 characters long<br>";
	}
	if(trim($_POST["agreement"])=='') {
		$error_msg.="Please tick the box<br>";
	}
	if(trim($_POST["emailAddress"])=='') {
		$error_msg.="Please enter an email<br>";
	} else {
		// check if email is a valid address in this format username@domain.com
		if(!ereg("[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]", $_POST["emailAddress"])) $error_msg.="Please enter a valid email address<br>";
	}

	// display error message if any, if not, proceed to other processing
	if($error_msg=='')
	{

// more processing

}