Location: PHPKode > projects > Exero CMS > upload/modules/community/register.php
<?
// Register Script
if(!$ecms->permissions("community","register")) {
	include("themes/$ecms->theme/nopermission.php");
	exit;
}

if(empty($_POST['action'])) {
	include("themes/$ecms->theme/register.php");
} else if(isset($_POST['username']) && isset($_POST['password'])) {
	$allowreg = 1;
	$error = "";
	$checkname = $db->num_rows($db->query("SELECT username FROM users WHERE username='".$db->real_escape_string($_POST['username'])."' LIMIT 1"));
	if($checkname == 1) {
		$error .= "Username already in use.<br />";
		$allowreg = 0;
	}
	if(empty($_POST['username'])) {
		$error .= "You must enter a username.<br />";
		$allowreg = 0;
	}
	if(empty($_POST['password'])) {
		$error .= "You must enter a password.<br />";
		$allowreg = 0;
	}
	if(!($_POST['password'] == $_POST['passwordcon'])) {
		$error .= "Passwords do not match.<br />";
		$allowreg = 0;
	} 
	if(empty($_POST['email'])) {
		$error .= "You must enter an email.<br />";
		$allowreg = 0;
	}
	if($allowreg) {
		$register = $user->register($_POST['username'],$_POST['password'],$_POST['email']);
		if($register) {
			($hook = $ecms->fetch_hook("register_success")) ? eval($hook) : false;
			$message = "Registration Complete.";
			$module = "community";
			$array = array("login");
		include("themes/$ecms->theme/redirect.php");
		}
	} else {
		include("themes/$ecms->theme/register.php");
	}
}
?>
Return current item: Exero CMS