Размер файла: 3.43Kb
<?
define("PARTNER_AUTHORIZATION",1);
include("../../../includes/common.php");
/* REGISTARTION ACTIONS */
function LocalCheck(){
global $_POST;
global $SETTINGS;
global $CLIENT_TITLES;
global $step;
reset ($_POST);
while (list($key, $value) = each ($_POST)){
$$key = $value;
}
$err_arr = Array();
if(!ValidateEmail($email)){
$err_arr['email'] = "Введите корректный E-mail адрес, пожалуйста.";
}
if($pass!=""&&(strlen($pass) >$SETTINGS['max_password_length']||strlen($pass)<$SETTINGS['min_password_length'])){
$err_arr['password'] = "Длина пароля дожна быть длиной $SETTINGS[min_password_length]-$SETTINGS[max_password_length] симолов.";
}
elseif($pass!=$c_pass){
$err_arr['password'] = "Введенные пароли не совпадают.";
}
}
/*PAGE TITLE*/
$page_title = "Персональная информация и настройки аккаунта";
$header = "Персональная информация и настройки аккаунта";
$smarty->assign('page_title',$page_title);
$smarty->assign('error',$error);
/* table template */
$smarty->assign('top_menu_tpl',"partner_profile_menu.tpl");
$smarty->assign('main_tpl',"partner_profile.tpl");
if(isset($_POST['subm'])){
reset ($_POST);
while (list($key, $value) = each ($_POST)) {
if($key!="id"){
$$key = $value;
}
}
$error = LocalCheck();
if($error==""){
$tmp_res = mysql_query("select * from partners where upper(login)='".strtoupper($login)."' and id<>$PARTNER_ID");
if(mysql_num_rows($tmp_res)>0){
$error .= "Введенный Вами логин уже существует в базе.<br>\n";
}
}
if($error==""){
$trans_notify = $trans_notify == 1?1:0;
$arr = Array(
"id" => $PARTNER_ID,
"email" => addslashes($email),
"login" => addslashes($login),
"trans_notify" => addslashes($trans_notify)
);
if($pass!=""){
$arr['password'] = md5($pass);
}
if(UpdateRecord("partners",$arr,$PARTNER_ID)){
$_SESSION['STATUS_MSG'] = "Информация успешно сохранена!";
header("Location: ./index.php");
exit;
}
else{
$_SESSION['ERROR_MSG'] = "Системная ошибка.";
header("Location: ./index.php");
exit;
}
}
}
else{
$email = $PARTNER_DATA['email'];
$login = $PARTNER_DATA['login'];
$rec_news = $PARTNER_DATA['rec_news'];
$title = $PARTNER_DATA['title'];
$trans_notify = $PARTNER_DATA['trans_notify'];
}
/*
/* country
$country_names = Array();
$country_ids = Array();
$res = mysql_query("select * from countries where status=1 order by name asc");
echo mysql_error();
while($row = mysql_fetch_object($res)){
array_push($country_names,stripslashes($row->name));
array_push($country_ids,stripslashes($row->id));
if(($country_id<=0||!is_numeric($country_id))&&$row->is_default=='t'){
$country_id = $row->id;
}
}
$smarty->assign('country_names',$country_names);
$smarty->assign('country_ids',$country_ids);
$smarty->assign('country_id',$country_id);
*/
$smarty->assign('browser_title',$browser_title);
$smarty->assign('page_title',$page_title);
$smarty->assign('page_meta',$page_meta);
$smarty->assign('errors',$err_arr);
/* registration data */
$smarty->assign('login',stripslashes($login));
$smarty->assign('email',stripslashes($email));
$smarty->assign('rec_news',$rec_news);
$smarty->assign('trans_notify',$trans_notify);
$smarty->assign('PARTNER_ID',$PARTNER_ID);
$smarty->assign('partner_comission',round($PARTNER_DATA['comission_perc']*100,2));
/* display content */
$smarty->display('partner_index.tpl');
?>