Exemplo n.º 1
0
function uc_api_synlogout($get, $post)
{
    header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
    ZLogin::NoRemember();
    if (isset($_SESSION['user_id'])) {
        unset($_SESSION['user_id']);
    }
    return API_RETURN_SUCCEED;
}
Exemplo n.º 2
0
    }
    if ($_POST['password2'] == $_POST['password'] && $_POST['password']) {
        if ($INI['system']['emailverify']) {
            $u['enable'] = 'N';
        }
        $usergroup = Table::Fetch('user_group', 'customer', 'name');
        if (!empty($usergroup)) {
            $u['user_group_id'] = $usergroup['id'];
        }
        if ($user_id = ZUser::Create($u)) {
            if ($INI['system']['emailverify']) {
                mail_sign_id($user_id);
                Session::Set('unemail', $_POST['email']);
                Utility::Redirect(WEB_ROOT . '/account/verify.php');
            } else {
                ZLogin::Login($user_id);
                Utility::Redirect(WEB_ROOT . '/index.php');
            }
        } else {
            $au = Table::Fetch('user', $_POST['email'], 'email');
            if ($au) {
                Session::Set('error', 'Failed, Email has registerred ');
            } else {
                Session::Set('error', 'Failed, username has  been taken');
            }
        }
    } else {
        Session::Set('error', 'Register failed, check your password please');
    }
}
include template('account_signup');
Exemplo n.º 3
0
$_POST = magic_gpc($_POST);
$_COOKIE = magic_gpc($_COOKIE);
/* process currefer*/
$currefer = uencode(strval($_SERVER['REQUEST_URI']));
/* session,cache,configure,webroot register */
Session::Init();
$INI = ZSystem::GetINI();
/* end */
/* date_zone */
if (function_exists('date_default_timezone_set')) {
    date_default_timezone_set($INI['system']['timezone']);
}
/* end date_zone */
/* biz logic */
$currency = $INI['system']['currency'];
$login_user_id = ZLogin::GetLoginId();
$login_user = Table::Fetch('user', $login_user_id);
$hotcities = option_hotcategory('city', false, true);
$allcities = option_category('city', false, true);
$city = cookie_city(null);
if (!isset($_COOKIE['referer'])) {
    setcookie('referer', $_SERVER['HTTP_REFERER']);
}
/* not allow access app.php */
if ($_SERVER['SCRIPT_FILENAME'] == __FILE__) {
    redirect(WEB_ROOT . '/index.php');
}
/* end */
$AJAX = 'XMLHttpRequest' == @$_SERVER['HTTP_X_REQUESTED_WITH'];
if (false == $AJAX) {
    header('Content-Type: text/html; charset=UTF-8');
Exemplo n.º 4
0
    $wwwlink = mail_zd($email);
    die(include template('account_verify'));
} else {
    if (strpos($secret, '@')) {
        Session::Set('unemail', $secret);
        mail_sign_email($secret);
        redirect(WEB_ROOT . '/account/verify.php');
    }
}
$user = Table::Fetch('user', $secret, 'secret');
if ($user['enable'] == 'Y') {
    Session::Set('error', '你的账户已经验通过,请直接登录!');
    if (isset($_SESSION['user_id'])) {
        unset($_SESSION['user_id']);
        ZLogin::NoRemember();
        ZUser::SynLogout();
    }
    redirect(WEB_ROOT . '/account/login.php');
}
if ($user) {
    if (option_yes('mobilecode')) {
        Table::UpdateCache('user', $user['id'], array('emailable' => 'Y'));
        die(include template('account_signmobile'));
    } else {
        Table::UpdateCache('user', $user['id'], array('emailable' => 'Y', 'enable' => 'Y'));
        Session::Set('notice', '恭喜!你的帐户已经通过Email验证');
        ZLogin::Login($user['id']);
        redirect(get_loginpage(WEB_ROOT . '/index.php'));
    }
}
redirect(WEB_ROOT . '/index.php');
Exemplo n.º 5
0
<?php

require_once dirname(dirname(__FILE__)) . '/app.php';
if (isset($_SESSION['user_id'])) {
    unset($_SESSION['user_id']);
    ZLogin::NoRemember();
}
redirect('index.php');
Exemplo n.º 6
0
    $login_user = ZUser::GetLogin($_POST['email'], $_POST['password']);
    if (!$login_user) {
        Session::Set('error', '登录失败');
        redirect(WEB_ROOT . '/account/login.php');
    } else {
        if (option_yes('mobilecode') && $login_user['emailable'] == 'Y' && $login_user['enable'] == 'N') {
            $user['id'] = $login_user['id'];
            Session::Set('error', '请验证手机号');
            die(include template('account_signmobile'));
        } else {
            if (option_yes('emailverify') && $login_user['emailable'] == 'N' && $login_user['enable'] == 'N' && $login_user['secret']) {
                Session::Set('unemail', $_POST['email']);
                redirect(WEB_ROOT . '/account/verify.php');
            } else {
                Session::Set('user_id', $login_user['id']);
                if (abs(intval($_POST['auto_login']))) {
                    ZLogin::Remember($login_user);
                }
                ZUser::SynLogin($login_user['username'], $_POST['password']);
                ZCredit::Login($login_user['id']);
                redirect(get_loginpage(WEB_ROOT . '/index.php'));
            }
        }
    }
}
$currefer = strval($_GET['r']);
if ($currefer) {
    Session::Set('loginpage', udecode($currefer));
}
$pagetitle = '登录';
include template('account_login');
Exemplo n.º 7
0
<?php

require_once dirname(__FILE__) . '/app.php';
if (isset($_SESSION['user_id'])) {
    unset($_SESSION['user_id']);
    ZLogin::NoRemember($login_user_id);
}
redirect(WEB_ROOT . '/index.php');
Exemplo n.º 8
0
<?php

require_once dirname(dirname(__FILE__)) . '/app.php';
if (isset($_SESSION['partner_id'])) {
    $login_partner = Table::Fetch('partner', $_SESSION['partner_id']);
    ZLogin::NoRemeberBiz($login_partner);
    unset($_SESSION['partner_id']);
}
redirect(WEB_ROOT . '/biz/login.php');
Exemplo n.º 9
0
<?php

require_once dirname(dirname(__FILE__)) . '/app.php';
$cookie_username = ZLogin::GetRemeberBizName();
if ($_POST) {
    $login_partner = ZPartner::GetLogin($_POST['username'], $_POST['password']);
    if (!$login_partner) {
        Session::Set('error', '用户名密码不匹配!请重新输入。如果忘记账号或密码,请联系青年优品工作人员为您重置密码');
        redirect(WEB_ROOT . '/biz/login.php');
    } else {
        Session::Set('partner_id', $login_partner['id']);
        ZLogin::RememberBiz($login_partner);
        redirect(WEB_ROOT . '/biz/coupon/');
    }
}
include template('biz_login');
Exemplo n.º 10
0
            }
            $v = join('<br/>', $v);
            $d = array('html' => $v, 'id' => 'coupon-dialog-display-id');
            json($d, 'updater');
        } else {
            if ($action == 'sms') {
                $coupon = Table::Fetch('coupon', $sid);
                if ($coupon['sms'] >= 5 && !is_manager()) {
                    json('短信发送' . $INI['system']['couponname'] . '最多5次, 如有任何疑问请联系客服!', 'alert');
                }
                $interval = abs(intval($INI['sms']['interval']));
                $lefttime = $interval + $coupon['sms_time'] - time();
                if (!is_manager() && $lefttime > 0) {
                    json("你好,请在{$lefttime}秒后,再次尝试短信发送优惠券" . $INI['system']['couponname'], 'alert');
                }
                if (!$coupon || !is_login() || $coupon['user_id'] != ZLogin::GetLoginId() && !is_manager()) {
                    json($cid, 'alert');
                }
                $flag = sms_coupon($coupon);
                if ($flag === true) {
                    json('手机短信发送成功,请及时查收', 'alert');
                } else {
                    if (is_string($flag)) {
                        json($flag, 'alert');
                    }
                }
                json("手机短信发送失败,错误码:{$code}", 'alert');
            }
        }
    }
}
Exemplo n.º 11
0
                     json($flag, 'alert');
                 }
             }
             json("手机短信发送失败,错误码:{$code}", 'alert');
         } else {
             if ($action == 'vouchersms') {
                 $voucher = Table::Fetch('voucher', $cid);
                 if ($voucher['sms'] >= 5 && !is_manager()) {
                     json('短信发送商户券最多5次', 'alert');
                 }
                 $interval = abs(intval($INI['sms']['interval']));
                 $lefttime = $interval + $voucher['sms_time'] - time();
                 if (!is_manager() && $lefttime > 0) {
                     json("你好,请在{$lefttime}秒后,再次尝试短信发送商户券", 'alert');
                 }
                 if (!$voucher || !is_login() || $voucher['user_id'] != ZLogin::GetLoginId() && !is_manager()) {
                     json('非法下载', 'alert');
                 }
                 $flag = sms_voucher($voucher);
                 if ($flag === true) {
                     json('手机短信发送成功,请及时查收', 'alert');
                 } else {
                     if (is_string($flag)) {
                         json($flag, 'alert');
                     }
                 }
                 json("手机短信发送失败,错误码:{$code}", 'alert');
             }
         }
     }
 }
Exemplo n.º 12
0
Arquivo: sms.php Projeto: noikiy/mdwp
 } else {
     if ('bindcodeyes' == $action) {
         $mobile = trim(strval($_GET['mobile']));
         $user_id = abs(intval($_GET['user_id']));
         $secretcode = trim(strval($_GET['secretcode']));
         $condition = array('tools' => $mobile, 'enable' => 'N', 'user_id' => $user_id);
         //json($user_id, 'alert');
         $sms = DB::GetTableRow('toolsbind', $condition);
         if (!$sms) {
             json(array(array('data' => '非法访问!', 'type' => 'alert'), array('data' => 'X.boxClose();', 'type' => 'eval')), 'mix');
         }
         if ($sms['secret'] != $secretcode) {
             json('短信认证码不正确,请重新输入!', 'alert');
         } else {
             ZToolsbind::Enable($mobile, true);
             ZLogin::Login($sms['user_id']);
             json(array(array('data' => '绑定成功', 'type' => 'alert'), array('data' => 'X.boxClose();', 'type' => 'eval'), array('data' => 'window.location=  "/index.php";', 'type' => 'eval')), 'mix');
             redirect(WEB_ROOT . '/index.php');
         }
     } else {
         if ('loginbindmobile' == $action) {
             $userid = strval($_GET['userid']);
             $html = render('ajax_dialog_smsloginbind');
             json($html, 'dialog');
         } else {
             if ('loginmobilebindcheck' == $action) {
                 $mobile = trim(strval($_GET['mobile']));
                 $verifycode = trim(strval($_GET['verifycode']));
                 $user_id = abs(intval($_GET['user_id']));
                 $secret = Utility::VerifyCode();
                 if (Utility::CaptchaCheck($verifycode)) {
Exemplo n.º 13
0
 /**
  * Performs user sign-in.
  *
  * @access	public
  * @since	3.0
  *
  */
 function login_action()
 {
     global $_POST, $SANITIZER, $SecureSession, $CONFIG;
     $str_error = '';
     // init
     if (isset($_POST["un"])) {
         $un = trim($_POST["un"]);
         $un = $SANITIZER->sanitize($un);
     } else {
         $un = "";
     }
     if (isset($_POST["pw"])) {
         $pw_hash = md5($SANITIZER->sanitize($_POST["pw"]));
     } else {
         $pw_hash = "";
     }
     $_POST["remember_me"] = 1;
     $remember_me = true;
     /** Get user data from DB **/
     $PL_PW = $CONFIG->secure_login_password;
     if (isset($_POST["cmd_login"])) {
         if ($un == "") {
             $str_error .= JText::_("Required field cannot be left blank.") . '<br />';
         }
         /** Log in user **/
         if (empty($str_error)) {
             $str_error .= ZLogin::login($un, $pw_hash);
         } else {
             @session_destroy();
             $str_error .= JText::_('We cannot log you into your account at this time. Please try again later.') . '<br />';
         }
         if (!empty($str_error)) {
             return $str_error;
         } else {
             //header("Location: {$CONFIG->basedir_rewrite}");
         }
     }
 }
Exemplo n.º 14
0
 /**
  * Performs a new user registration.
  *
  * @access	public
  * @since	3.0
  *
  */
 function register_action()
 {
     global $_POST, $CONFIG, $SANITIZER, $SecureSession;
     $str_error = '';
     // init
     if (isset($_POST["fullname"])) {
         $fullname = trim($SANITIZER->sanitize($_POST["fullname"]));
     } else {
         $fullname = "";
     }
     if (isset($_POST["un"])) {
         $un = trim($SANITIZER->sanitize($_POST["un"]));
     } else {
         $un = "";
     }
     /*
     if (isset($_POST["pw"])) {
     	$pw = trim($SANITIZER->sanitize($_POST["pw"]));
     } else {
     	$pw = "";
     }
     */
     if (isset($_POST["pw"])) {
         //$pw_hash = trim($SANITIZER->sanitize($_POST["pw_hash"]));
         $pw_hash = md5(trim($SANITIZER->sanitize($_POST["pw"])));
     } else {
         $pw_hash = "";
     }
     if (isset($_POST["email"])) {
         $email = trim($SANITIZER->sanitize($_POST["email"]));
     } else {
         $email = "";
     }
     $email_validation_required = true;
     /**
     Save new user's data
     */
     if (isset($_POST["cmd_register"])) {
         /** Check inputs**/
         //echo $pw_hash;
         if ($fullname == "" || $pw_hash == md5("")) {
             $str_error .= JText::_("Required field cannot be left blank.") . '<br />';
             //return $str_error;
         }
         /** Test integrity username **/
         $str_error .= ZRegister::test_integrity_username($un);
         /** Test integrity email **/
         $str_error .= ZRegister::test_integrity_email($email);
         /** Extract firstname, lastname from full name **/
         $fullname_array = ZRegister::extract_fullname_parts($fullname);
         $firstname = $fullname_array[0];
         $lastname = $fullname_array[1];
         if (empty($str_error)) {
             $sql = "\n\t\t\t\t\t\t\t\tINSERT INTO users (\n\t\t\t\t\t\t\t\t\tproj_fid\n\t\t\t\t\t\t\t\t\t, proj_item_id\n\t\t\t\t\t\t\t\t\t, un\n\t\t\t\t\t\t\t\t\t, pw\n\t\t\t\t\t\t\t\t\t, firstname\n\t\t\t\t\t\t\t\t\t, lastname\n\t\t\t\t\t\t\t\t\t, gender\n\t\t\t\t\t\t\t\t\t, email\n\t\t\t\t\t\t\t\t\t, birth_date\n\t\t\t\t\t\t\t\t\t, age_rule\n\t\t\t\t\t\t\t\t\t, country\n\t\t\t\t\t\t\t\t\t, language\n\t\t\t\t\t\t\t\t\t, timezone\n\t\t\t\t\t\t\t\t\t, newsletter\n\t\t\t\t\t\t\t\t\t, isconfirmed\n\t\t\t\t\t\t\t\t\t, created)\n\t\t\t\t\t\t\t\tVALUES (\n\t\t\t\t\t\t\t\t\t7\n\t\t\t\t\t\t\t\t\t, 1\n\t\t\t\t\t\t\t\t\t, '{$un}'\n\t\t\t\t\t\t\t\t\t, '{$pw_hash}'\n\t\t\t\t\t\t\t\t\t, '{$firstname}'\n\t\t\t\t\t\t\t\t\t, '{$lastname}'\n\t\t\t\t\t\t\t\t\t, 2\n\t\t\t\t\t\t\t\t\t, '{$email}'\n\t\t\t\t\t\t\t\t\t, '2100-01-01'\n\t\t\t\t\t\t\t\t\t, 0\n\t\t\t\t\t\t\t\t\t, ''\n\t\t\t\t\t\t\t\t\t, ''\n\t\t\t\t\t\t\t\t\t, 0\n\t\t\t\t\t\t\t\t\t, 0\n\t\t\t\t\t\t\t\t\t, 0\n\t\t\t\t\t\t\t\t\t, now()\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t ";
             //
             if ($_SERVER["REMOTE_ADDR"] == @$CONFIG->debug_ip) {
                 //echo $sql;
             }
             $result = mysql_query($sql);
             $new_user_id = mysql_insert_id();
             /* */
             if ($new_user_id && mysql_affected_rows() > 0) {
                 @setcookie("registered", 1, time() + 60 * 60 * 24 * 365, "/");
                 /* expire in 1 year */
                 /** Add default Josta (News-Josta) **/
                 //$str_error = ZCollection::add_josta($new_user_id, JText::_("Friends"), "", $str_error);
                 $str_error = ZCollection::add_josta($new_user_id, "Default Josta", "", $str_error);
                 //ZUser::add_user_to_josta($new_user_id);
             } else {
                 @session_destroy();
                 $str_error .= JText::_('Registration was not successful. Please try again.');
             }
         }
         /** Send email validation request **/
         if ($email_validation_required && empty($str_error)) {
             // Encrypt email address
             $strongCipher = new Cipher_blowfish();
             $strongCipher->setKey(@$CONFIG->secret);
             $activation = $strongCipher->zf_encrypt(date("Y-m-d H:i:s") . "_" . $new_user_id);
             // Send email with password reset instructions
             $name = JText::_('ZIME Service');
             //senders name
             $sender = "*****@*****.**";
             //senders e-mail adress
             $recipient = $email;
             //recipient
             $subject = ZString::replaceVars(JText::_('Welcome to ZIME'), $un);
             //subject
             $mail_body = JText::__('email_registration.txt');
             $mail_body = str_replace("[USER]", $fullname . " ({$un})", $mail_body);
             $mail_body = str_replace("[URL]", "{$CONFIG->basedir_rewrite}validate.php?option=register&activation={$activation}", $mail_body);
             $header = "From: " . $name . " <" . $sender . ">\r\n";
             //optional headerfields
             //echo $mail_body
             ini_set('sendmail_from', $sender);
             //Suggested by "Some Guy"
             if (!@mail($recipient, $subject, $mail_body, $header)) {
                 //mail command :)
                 $str_error .= JText::_('Could not send the notification.');
             }
         }
         /** Set default notices **/
         $_POST["notice_new_follower"] = "1";
         ZSettings::notices_action($new_user_id);
         // catch $str_error ??
         /** Log in user **/
         if (empty($str_error)) {
             $str_error .= ZLogin::login($un, $pw_hash);
         } else {
             //@session_destroy();
             //$str_error .= JText::_('We cannot log you into your account at this time. Please try again later.') . '<br />';
         }
         if (!empty($str_error)) {
             return $str_error;
         } else {
             @header("Location: {$CONFIG->basedir_rewrite}");
         }
     }
 }
Exemplo n.º 15
0
 * redirect index.php where autologin is true
 * @author abei
 * @version 20131028
 */


$cookie_wap_bizer = ZLogin::GetRemeberPwdForWapBiz();

if ( $_POST ) {
	$login_partner = ZPartner::GetLogin($_POST['username'], $_POST['password']);
	if ( !$login_partner ) {
		Session::Set('error', '用户名密码不匹配!');
		redirect( WEB_ROOT . '/y/login.php');
	} else {
		Session::Set('partner_mobile_id', $login_partner['id']);
		
		//	记住密码
		if($_POST['rememeber']){
			ZLogin::RemeberPwdForWapBiz($login_partner['id'],$_POST['password']);
		}

		/**
		 * AutoLogin
		 */
		
		
		redirect( WEB_ROOT . '/y/index.php'); 
	}
}

include template('biz_mobile_login');
Exemplo n.º 16
0
Arquivo: app.php Projeto: noikiy/mdwp
$INI = ZSystem::GetINI();
/* end */
/* date_zone */
if (function_exists('date_default_timezone_set')) {
    date_default_timezone_set($INI['system']['timezone']);
}
/* end date_zone */
/* biz logic */
$currency = $INI['system']['currency'];
$login_user_id = ZLogin::GetLoginId();
$login_user = Table::Fetch('user', $login_user_id);
$hotcities = option_hotcategory('city', false, true);
$allcities = option_category('city', false, true);
$city = cookie_city(null);
/**
 * Get Bizer information
 * @author abei
 * @version 20131028
 */
$wap_bizer_id = ZLogin::GetBizLoginId();
if (!isset($_COOKIE['referer'])) {
    setcookie('referer', $_SERVER['HTTP_REFERER']);
}
/* not allow access app.php */
if ($_SERVER['SCRIPT_FILENAME'] == __FILE__) {
    redirect(WEB_ROOT . '/index.php');
}
/* end */
$AJAX = 'XMLHttpRequest' == @$_SERVER['HTTP_X_REQUESTED_WITH'];
if (false == $AJAX) {
    header('Content-Type: text/html; charset=UTF-8');