Location: PHPKode > projects > Ads Exchange Server > estigi_0.1.1_RC2/register.php
<?php

/***************************************************************************
 *                             register.php
 *                            -------------------
 *   begin                : mier, mayo 2, 2007
 *   copyright            : (C)
 *   email                : hide@address.com
 *   Desc                 : This is to create new users by admins, or by new users.
 *
 *
 ***************************************************************************/

define('IN_ADSERVER', true);

include_once("./inc/common.inc.php");

//Change data
$msg = "";
$error = "";

/* Declare the TPL */
$register_Tpl = new tpl($s_path_Tpl . "/register.tpl");

if(isset($_POST['register']) && $_POST['register'] != ""){

	//Check passwords
	if($_POST['pwd_1'] != $_POST['pwd_0'] || $_POST['pwd_1'] == "" || $_POST['pwd_0'] == ""){
		$error = $_lang['reg_Pssw_Match'];
	}

	if($_POST['email'] == ""){
		$error .= $_lang['reg_No_Email'];
	}

	//Search users with the same name
	$q = "SELECT user_Name
		  FROM ".$db_Pre."users
		  WHERE user_Name = '" . $_POST['user_Name'] . "'
		  ";

		$q_check_User = mysql_query($q) or die("Unable to Get Users with the same name: " . mysql_error());

	if(mysql_num_rows($q_check_User) > 0){
			$error .= $_lang['reg_User_Taken'];
	}

	if($error == ""){ //Proced whit the register
		$q = "INSERT INTO ".$db_Pre."users
			(user_Name, email, pwd, timestamp, active)
			VALUES ('".$_POST['user_Name']."', '".$_POST['email']."', '".md5($_POST['pwd_0'])."', '".time()."', $default_User_State)
		  ";

		 $q_Register = mysql_query($q) or die("Unable to Register New User: " . mysql_error());

		 $s_Warning = $_lang['reg_Congrats'];
		 $s_Warning .= ($default_User_State == 1 ? $_lang['reg_Acc_Active'] : $_lang['reg_Acc_Active_2']);

		refrescar("login.php", 0, 1);
	}
}

/* Main Values Array */
$a_Register = array(
	"{LANG_REG_HELP_TITLE}" => $_lang['reg_Help_Title'],
	"{LANG_REG_USER_NAME}" => $_lang['reg_User_Name'],
	"{LANG_REG_EMAIL_ADD}" => $_lang['reg_Email_Add'],
	"{LANG_REG_PSSW}" => $_lang['reg_Pssw'],
	"{LANG_REG_PSSW_AGAIN}" => $_lang['reg_Pssw_Again'],
	"{LANG_REG_REGISTER}" => $_lang['reg_Register']
);

/* Replace Values */
$register_Tpl->rBlock($a_Register, "");

include_once("./header.inc.php");
/* Print the tpl */
$register_Tpl->print_Tpl();
include_once("./footer.inc.php");

?>
Return current item: Ads Exchange Server