if($sid->assigned('user')) { //Http::localRedirectSSL($pg, 'my'); function adddays($Date,$days) { $Date = strtotime($Date); $Date += 24 * 60 * 60 * $days; $Date = date("Y-m-d",$Date); return $Date; } function subdays($Date,$days) { $Date = strtotime($Date); $Date -= 24 * 60 * 60 * $days; $Date = date("Y-m-d",$Date); return $Date; } function dateDiff($endDate, $beginDate) { list($y1,$m1,$d1) = explode("-", $beginDate); list($y2,$m2,$d2) = explode("-", $endDate); $start_date=gregoriantojd($m1,$d1,$y1); $end_date=gregoriantojd($m2,$d2,$y2); return $end_date - $start_date; } $Date = date("Y-m-d"); $member_id = $sid->fetch_property('user', 'Member_ID'); $orders = $db->selectRows( "select O.*,T.TourCode,U.FirstName,U.LastName,sum(PR.Price) as PrePostPrice,P.Approved as Payment,P.Source_ID as PaymentType ". "from {$tblPref}Order O inner join {$tblPref}Tours T using (Tour_ID) inner join {$tblPref}Member M using (Member_ID) inner join {$tblPref}User U using (User_ID)". "left outer join {$tblPref}OrderPrepost PR using(Order_ID) ". "left outer join {$tblPref}Payment P using(Payment_ID) ". " where O.Member_ID =".$member_id." group by Order_ID order by O.Now DESC, Order_ID DESC" ,"Order_ID"); $pending_orders = 0; $approved = 0; $days = 0; foreach($orders as $order) { if (( dateDiff($Date, subdays($order['Date'],31)) < 1 )) { $days = 1; } else if(!empty($order["Approved"])) { if ($order["Approved"] == 1) { $approved = 1; } else { $pending_orders = 1; } } else { $pending_orders = 1; } if(!empty($order["Approved"])) { if ($order["Approved"] == 1) { $approved = 1; } else { $pending_orders = 1; } } else { $pending_orders = 1; } } /*if(!empty($Order)) Http::localRedirect('order', 'step_5'); if ($pending_orders == 1) { Http::localRedirectSSL($pg, 'orders'); } if (($days == 1) && ($approved == 1)) { Http::localRedirectSSL($pg, 'docs'); }*/ Http::localRedirectSSL($pg, 'my'); } if(!empty($terms)) $tpl->assign("terms", $terms); if($sid->assigned("order")) { $order = $sid->fetch("order"); $tpl->assign("order", $order); } if($sid->assigned("login_notice")) { $login_notice = $sid->fetch("login_notice"); $tpl->assign("login_notice", $login_notice); $sid->unassign("login_notice"); } if(!empty($success)) $tpl->assign("success", $success); if(!empty($error)) $tpl->assign("error", $error); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(!empty($confirm_member)) { $member['FirstName']=$FirstName; $member['LastName']=$LastName; $member['Prefix']=$Prefix; $member['Login']=$Login; $member['Psw']=$Psw; $member['PswConf']=$PswConf; $member['MobilePhone']=$MobilePhone; $member['Phone']=$Phone; $member['Skype']=$Skype; $member['Msn']=$Msn; $member['Address']=$Address; $member['Address2']=$Address2; $member['Zip']=$Zip; $member['Country_ID']=$Country_ID; $member['State_ID']=$State_ID; $member['City_ID']=$City_ID; $member['OtherCity']=$OtherCity; $member['accepted']=$accepted; $member['accepted_news']=$accepted_news; $error = 0; if(empty($FirstName)) { $member['FirstName']="error1"; $error++; } if(empty($LastName)) { $member['LastName']="error1"; $error++; } if(empty($Login)) { $member['Login']="error1"; $error++; } //if(empty($MobilePhone)) { $member['MobilePhone']="error1"; $error++; } if(empty($Psw)) { $member['Psw']="error1"; $error++; } if(empty($Address)) { $member['Address']="error1"; $error++; } if(empty($Country_ID)) { $member['Country_ID']="error7"; $error++; } if(empty($Zip)) { $member['Zip']="error1"; $error++; } if(empty($Psw)) { $member['Psw']="error1"; $error++; } if(empty($PswConf)) { $member['PswConf']="error1"; $error++; } if(!empty($PswConf) && !empty($Psw)) if($member["Psw"] != $member["PswConf"]) { $member['PswConf']="error2"; $error++; } if(!empty($Msn)) if(!check_email_format($member["Msn"])) { $member['Msn']="error3"; $error++; } if(!empty($FirstName)) { if(preg_match("`@|<|>|w\s*w\s*w|\.\s*l\s*t[^a-z]+|\.\s*c\s*o\s*m[^a-z]+|\.\s*n\s*e\s*t[^a-z]+|3\s*7\s*0\s*6|8\s*6|[^a-z]+M\s*S\s*N[^a-z]+|[^a-z]+I\s*C\s*Q[^a-z]+|[^a-z]+A\s*O\s*L[^a-z]+|[^a-z]+A\s*I\s*M[^a-z]+`ui", $member["FirstName"])) { $member['FirstName']="error4"; $error++; } $spaces_count = 0; for ($i=0; $i|w\s*w\s*w|\.\s*l\s*t[^a-z]+|\.\s*c\s*o\s*m[^a-z]+|\.\s*n\s*e\s*t[^a-z]+|3\s*7\s*0\s*6|8\s*6|[^a-z]+M\s*S\s*N[^a-z]+|[^a-z]+I\s*C\s*Q[^a-z]+|[^a-z]+A\s*O\s*L[^a-z]+|[^a-z]+A\s*I\s*M[^a-z]+`ui", $member["LastName"])) { $member['LastName']="error4"; $error++; } $spaces_count = 0; for ($i=0; $iselectValue( "select count(*) ". "from {$tblPref}User ". "where Email = '".$member["Login"]."'" ) + $db->selectValue( "select count(*) ". "from {$tblPref}Member ". "where PendingEmail = '".$member["Login"]."'" ) ) { $member['Login']="error5"; $error++; } if((!empty($MobilePhone))) $member["MobilePhone"] = preg_replace("`[^\d]+`", '', $member["MobilePhone"]); if(!empty($Phone)) $member["Phone"] = preg_replace("`[^\d]+`", '', $member["Phone"]); if((!empty($MobilePhone))) if(!preg_match("`^\d{11,}$`", $member["MobilePhone"])) { $member['MobilePhone']="error6"; $error++; } if(!empty($Phone)) if(!preg_match("`^\d{7,}$`", $member["Phone"])) { $member['Phone']="error6"; $error++; } /*if(!empty($Country_ID)) if($member["Country_ID"] == 122) $member["OtherCity"] = "";*/ $countries_with_states = $db->selectValues("select distinct Country_ID from {$tblPref}State"); /*if(empty($member["State_ID"]) && in_array($member["Country_ID"], $countries_with_states)) { $member['State_ID']="error7"; $error++; }*/ if(empty($member["City_ID"]) && empty($member["OtherCity"])) { $member['OtherCity']="error1"; $error++; } if($member["accepted"] != "on" ) { $error++; $tpl->assign("acceptederr", 'error8'); } $sid->assign("member",$member); if(!empty($error)) { $register=1; $tpl->assign("error", $error); } else { // create new member profile info in the database $member["User_ID"] = $db->execute( "insert into {$tblPref}User set ". "Login = '".$member["Login"]."', ". "Email = '".$member["Login"]."', ". "Psw = '".md5($member["Psw"])."', ". "PswLastChange = now(), ". "FirstName = '".$member["FirstName"]."', ". "LastName = '".$member["LastName"]."', ". "UserType_ID = '4', ". "PrefEncoding_ID = ".$encoding_id.", ". "Activated = '1'" ); $acpt_news = 0; if ($member['accepted_news'] == "on") $acpt_news = 1; $member["Member_ID"] = $db->execute( "insert into {$tblPref}Member set ". "StatusGivenBy = 'admin ".$sid->fetch_property('user', 'User_ID')."', ". "User_ID = '".$member["User_ID"]."', ". "MobilePhone = '".$member["MobilePhone"]."', ". "Prefix = '".$member["Prefix"]."', ". "Country_ID = ".$member["Country_ID"].", ". "City_ID = ".$member["City_ID"].", ". "OtherCity = '".$member["OtherCity"]."', ". "State_ID = '".$member["State_ID"]."', ". "Address = '".$member["Address"]."', ". "Address2 = '".$member["Address2"]."', ". "Zip = '".$member["Zip"]."', ". "Phone = '".$member["Phone"]."', ". "Msn = '".$member["Msn"]."', ". "Skype = '".$member["Skype"]."', ". "SignupDateTime = now(), ". "LastAccess = now(), ". "accept_news = ".$acpt_news ); $request = "SELECT u.*, t.AccessLevel, ". "m.".implode(', m.', $__member_session_vars)." ". "FROM {$tblPref}User u inner join {$tblPref}Member m using (User_ID), ". "{$tblPref}UserType t, {$tblPref}DefaultPage p ". "WHERE u.UserType_ID = t.UserType_ID ". "and u.UserType_ID = p.UserType_ID ". "and p.Area_ID = ".$area_data->Area_ID." ". "and u.Login = '".$member["Login"]."' ". "and u.Psw = '".md5($member["Psw"])."'"; $user = $db->selectObject($request); $sid->assign("user", $user); // send new account info on member's email $tpl_params = array( "username" => $member["Login"], "password" => $member["Psw"], "first_name" => $member["FirstName"] ); $mailer = new TemplateMailer("__TPL_MEMBER_ACCOUNT_CREATED1", $db); if(!$mailer->send($member["Login"], $tpl_params, $encoding_id, __CFG_IMPORTANT_MAILER_ID)) Object::raiseError("Unable to send member account info that was just created", __FILE__, __LINE__, E_USER_WARNING); $tpl_params2 = array( "username" => $member["Login"], "first_name" => $member["FirstName"], "last_name" => $member["LastName"], "member_id" => $member["User_ID"], "now_time" => date('Y-m-d H:i:s') ); $mailer = new TemplateMailer("__TPL_MEMBER_ACCOUNT_CREATED_INFO", $db); $mailer->send(__CFG_INFO_EMAIL, $tpl_params2, $encoding_id, __CFG_IMPORTANT_MAILER_ID); $sid->unassign("member"); print ""; } } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(!empty($register)) { if($sid->assigned("order")) { $order = $sid->fetch("order"); $tpl->assign("order", $order); } $tpl->assign("register", $register); if($sid->assigned("member")) { $member = $sid->fetch("member"); //$sid->unassign("member"); } else { $member = array( "UserType_ID"=>4, "Login"=>"", "Psw"=>"", "PswConf"=>"", "Email"=>"", "FirstName"=>"", "LastName"=>"", "Activated"=>1, "MobilePhone"=>"", "Phone"=>"", "Skype"=>"", "Msn"=>"", "Address"=>"", "Address2"=>"", "Zip"=>"", "Address"=>"", "Address2"=>"", "Country_ID"=>0, "City_ID"=>0, "OtherCity"=>"", "State_ID"=>0, "Prefix"=>0, "accepted"=>0, "accepted_news"=>"", "country"=>0, "PrefEncoding_ID"=>$encoding_id ); } $tpl->assign("member", $member); $countries = $db->selectObjects( "select t.Translation as Country, c.Country_ID ". "from {$tblPref}Country c, ". "{$tblPref}StrConst s, {$tblPref}StrConstTranslation t ". "where s.Index_ID = c.Country_ID ". "and s.VarName = 'Country' ". "and s.Constant_ID = t.Constant_ID ". "and t.Encoding_ID = ".$encoding_id." ". "order by t.Translation", "Country_ID", __CFG_SITE_STRUCTURE_DB_CACHE_LIFETIME ); $cities = $db->selectValues( "select c.Country_ID, c.City_ID ". "from {$tblPref}City c, ". "{$tblPref}StrConst s, {$tblPref}StrConstTranslation t ". "where s.Index_ID = c.City_ID ". "and s.VarName = 'CityTitle' ". "and s.Constant_ID = t.Constant_ID ". "and t.Encoding_ID = ".$encoding_id." ". "order by t.Translation", "City_ID" ); foreach($cities as $ct_id => $cr_id) $countries[$cr_id]->Cities[] = $ct_id; $states = $db->selectValues( "select st.Country_ID, st.State_ID ". "from {$tblPref}State st, ". "{$tblPref}StrConst s, {$tblPref}StrConstTranslation t ". "where s.Index_ID = st.State_ID ". "and s.VarName = 'StateTitle' ". "and s.Constant_ID = t.Constant_ID ". "and t.Encoding_ID = ".$encoding_id." ". "order by t.Translation", "State_ID", __CFG_SITE_STRUCTURE_DB_CACHE_LIFETIME ); foreach($states as $st_id => $cr_id) $countries[$cr_id]->States[] = $st_id; $tpl->assign("countries", $countries); $tpl->assign( "encs", $db->selectObjects( "select e.*, l.Lang_ID ". "from {$tblPref}LangEncoding e, {$tblPref}Language l ". "where e.LangCode = l.LangCode", "Encoding_ID" ) ); } ?> AmeTours.com My Account

EN |  RU   

LOGIN OR CREATE YOUR ACCOUNT

Email

Password

Forgot Password
Login

Thank You for Your interest in our products. Before we can process You orders we have to set up a new customer account on our system.

REGISTER