$curr_page = "Registration";
include("header.php");
/*
Copyright Notice
Web Site URL: http://www.ezonelink.co.uk
Script Owner eMail: webmaster@ezonelink.co.uk
Date: Oct, 2006
Script Name: eZonelink Photo Stock site Php Script
Copyright Details: This script is not free. Do not Remove this Copy Right notice.
*/
include_once ("class/packages.class.php");
$packages = new Packages();
include_once ("class/members.class.php");
$member = new Members();
if (isset($_GET["c"]))
{
if ($member->Active($_GET["c"]))
{
$confirm = "Thank you! Your membership has been confirmed. You can click here to login now";
$err = "ACTIVATION PROCESS FINISH";
}else
{
$confirm = "Invalid active code.";
$err = "ACTIVATION PROCESS ERROR";
}
$template->set_filenames(array("body" => "confirm.html"));
$template->assign_vars(array(
'CONFIRM' => $err,
'CONFIRMMESS'=> "
".$confirm."
"
));
$template->pparse("body");
}else
{
$ok = 0;
if(isset($_POST['register']))
{
//Check valid registration
$ok = 1;
if (!isset($_POST["username"])|| strlen($_POST["username"])<4 || strlen($_POST["username"])>16)
{
$username_alert = " Username must be between 4 and 16 characters long";
$ok = 0;
}else
$username_alert = "";
if (!isset($_POST["pass"])|| strlen($_POST["pass"])<=0)
{
$password_alert = " Missing password";
$ok = 0;
}else
if ($_POST["repass"] != $_POST["pass"])
{
$repassword_alert = " Retype password doesn't match with password";
$ok = 0;
}else
{
$repassword_alert = $password_alert = "";
}
if (!isset($_POST["email"])|| $_POST["email"] == "" || !CheckEmail($_POST["email"]))
{
$email_alert = " Please enter a valid email address to continue";
$ok = 0;
}else
$email_alert = "";
if (!isset($_POST["firstname"])|| strlen($_POST["firstname"])<=0)
{
$firstname_alert = " Missing first name";
$ok = 0;
}else
$firstname_alert = "";
if (!isset($_POST["lastname"])|| strlen($_POST["lastname"])<=0)
{
$lastname_alert = " Missing last name";
$ok = 0;
}else
$lastname_alert = "";
if (!isset($_POST["addy1"])|| strlen($_POST["addy1"])<=0)
{
$addy1_alert = " Missing Address 1";
$ok = 0;
}else
$addy1_alert = "";
if (!isset($_POST["pemail"]) || $_POST["pemail"] == "" || !CheckEmail($_POST["pemail"]))
{
$pemail_alert = " Invalid paypal email address";
$ok = 0;
}else
$pemail_alert = "";
if (!isset($_POST["city"])|| strlen($_POST["city"])<=0)
{
$city_alert = " Missing city";
$ok = 0;
}else
$city_alert = "";
if (!isset($_POST["state"]) || $_POST["state"] == "")
{
$state_alert = " Missing state";
$ok = 0;
}else
$state_alert = "";
if (!isset($_POST["zip"])|| strlen($_POST["zip"])<=0)
{
$zip_alert = " Missing zip code";
$ok = 0;
}else
$zip_alert = "";
if (!isset($_POST["country"])|| strlen($_POST["country"])<=0)
{
$country_alert = " Please select one in list";
$ok = 0;
}else
$country_alert = "";
if (!isset($_POST["phone"])|| strlen($_POST["phone"])<=0)
{
$phone_alert = " Missing Phone number";
$ok = 0;
}else
$phone_alert = "";
}
// Addnew affiliater
//------------------------------------------------------
if ($ok == 1)
{
if ($member->CheckExistsUserName($_POST["username"]))
{
$username_alert = " Username is already in use";
$ok = 0;
}
if ($member->CheckExistsEmail($_POST["email"]))
{
$email_alert = " Email is already in use.";
$ok = 0;
}
if ($p_method != 2 && $member->CheckExistsPEmail($_POST["pemail"]))
{
$pemail_alert = " Paypal email is already in use.";
$ok = 0;
}
if ($ok == 1)
{ //Save data
$members_creationdate = date("m/d/Y", time());
$members_status = 0;
$member_activationcode = md5(time());
//AddNew($username, $password, $email, $firstname, $lastname, $addy1, $addy2, $phone, $city, $state, $zip_code, $country, $paypalemail, $checkID, $creationdate, $ipAdd, $status, $balance, $package)
$u_sid = $member->AddNew($_POST['username'],$_POST['pass'] ,$_POST['email'] , $_POST['firstname'],$_POST['lastname'],$_POST["addy1"], $_POST["addy2"], $_POST["phone"], $_POST['city'] ,$_POST['state'] ,$_POST['zip'], $_POST['country'], $_POST['pemail'], $_POST['cemail'], $members_creationdate, $REMOTE_ADDR, $members_status, $member_activationcode, 0, "");
//$REMOTE_ADDR: get affiliater's ip address
//Gui mail thong bao
$a_lnk = "".$webroot."register.php?c=". $member_activationcode." ";
$sign_time = date("m/d/Y", time());
$to = $_POST['email'];
$subject = str_replace("{ACTIVE_LINK}", $a_lnk, $clsSite_config->activation_subj);
$subject = str_replace("{SITE_NAME}", $clsSite_config->site_title, $subject);
$subject = str_replace("{SIGNUP_TIME}", $sign_time, $subject);
$subject = str_replace("{USER_NAME}", $_POST['username'], $subject);
$subject = str_replace("{REAL_NAME}", $_POST['firstname'], $subject);
$subject = str_replace("{EMAIL}", $_POST['email'], $subject);
$body = str_replace("{ACTIVE_LINK}", $a_lnk, $clsSite_config->activation_email);
$body = str_replace("{SITE_NAME}", $clsSite_config->site_title, $body);
$body = str_replace("{SIGNUP_TIME}", $sign_time, $body);
$body = str_replace("{USER_NAME}", $_POST['username'], $body);
$body = str_replace("{REAL_NAME}", $_POST['firstname'], $body);
$body = str_replace("{EMAIL}", $_POST['email'], $body);
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
/* additional headers */
$headers .= "From: ".$clsSite_config->site_title." <".$clsSite_config->admin_email.">\r\n";
$headers .= "Reply-To: ".$clsSite_config->site_title." <".$clsSite_config->admin_email.">\r\n";
@mail($to, $subject, $body, $headers);
//Gui mail to admin
$subject = str_replace("{ACTIVE_LINK}", $a_lnk, $clsSite_config->a_activation_subj);
$subject = str_replace("{SITE_NAME}", $clsSite_config->site_title, $subject);
$subject = str_replace("{SIGNUP_TIME}", $sign_time, $subject);
$subject = str_replace("{USER_NAME}", $_POST['username'], $subject);
$subject = str_replace("{REAL_NAME}", $_POST['firstname'], $subject);
$subject = str_replace("{EMAIL}", $_POST['email'], $subject);
$body = str_replace("{ACTIVE_LINK}", $a_lnk, $clsSite_config->a_activation_email);
$body = str_replace("{SITE_NAME}", $clsSite_config->site_title, $body);
$body = str_replace("{SIGNUP_TIME}", $sign_time, $body);
$body = str_replace("{USER_NAME}", $_POST['username'], $body);
$body = str_replace("{REAL_NAME}", $_POST['firstname'], $body);
$body = str_replace("{EMAIL}", $_POST['email'], $body);
@mail($clsSite_config->admin_email, $subject, $body, $headers);
$extra = "";
if ($_POST["package"] != "" && $row = mysql_fetch_array($packages->GetBySId($_POST["package"])))
{
//Call payment
$webroot = YOURDOMAIN==""?substr($_SERVER["HTTP_REFERER"],0,strrpos($_SERVER["HTTP_REFERER"], "/")+1):YOURDOMAIN;
$webroot = str_replace("\\","/",$webroot);
if (strrpos($webroot, "/") != strlen($webroot))
$webroot .= "/";
$tax = $clsSite_config->tax1+$clsSite_config->tax2;
$total_payment = $row["p_price"]+$tax;
$extra = "Continue payment process...
";
if ($clsSite_config->use_check2>0 && $clsSite_config->admin_2CheckoutID != "")
{
$extra .= "or
";
}
}
$template->set_filenames(array("body" => "confirm.html"));
$template->assign_vars(array(
'CONFIRM' => "THANK YOU!",
'CONFIRMMESS' => "
Thank you for registering.
Please check mail to active your account
".$extra
));
$template->pparse("body");
}
}
if ($ok == 0)
{
$template->set_filenames(array("body" => "register.html"));
$country = ($_POST["country"] == "")?"Please Select One ":
"".$_POST["country"]." ";
$template->assign_vars(array(
'ERROR' => $error,
'USERNAME_ALERT' => $username_alert,
'PASSWORD_ALERT' => $password_alert,
'REPASSWORD_ALERT' => $repassword_alert,
'EMAIL_ALERT' => $email_alert,
'PEMAIL_ALERT' => $pemail_alert,
'FIRSTNAME_ALERT' => $firstname_alert,
'LASTNAME_ALERT' => $lastname_alert,
'ADDY1_ALERT' => $addy1_alert,
'CITY_ALERT' => $city_alert,
'STATE_ALERT' => $state_alert,
'ZIP_ALERT' => $zip_alert,
'COUNTRY_ALERT' => $country_alert,
'PHONE_ALERT' => $phone_alert,
'PEMAIL_ALERT' => $pemail_alert,
'CEMAIL_ALERT' => $cemail_alert,
'USERNAME' => $_POST["username"],
'PASSWORD' => $_POST["pass"],
'REPASSWORD' => $_POST["repass"],
'EMAIL' => $_POST["email"],
'FIRSTNAME' => $_POST["firstname"],
'LASTNAME' => $_POST["lastname"],
'ADDY1' => $_POST["addy1"],
'ADDY2' => $_POST["addy2"],
'CITY' => $_POST["city"],
'STATE' => $_POST["state"],
'ZIP' => $_POST["zip"],
'COUNTRY' => $country,
'PHONE' => $_POST["phone"],
'PEMAIL' => $_POST["pemail"],
'CEMAIL' => $_POST["cemail"],
'PACKAGE_SID' => $_POST["package"]
));
$template->pparse("body");
}
}
include("footer.php");
?>