Exemple #1
0
 public static function GetLoginCookie($cname = 'ru')
 {
     $cv = cookieget($cname);
     if ($cv) {
         $zone = base64_decode($cv);
         $p = explode('@', $zone, 2);
         return DB::GetTableRow('user', array('id' => $p[0], 'password' => $p[1]));
     }
     return array();
 }
Exemple #2
0
	static public function GetLoginCookie(){
		$cv = cookieget('rb');
		if ($cv) {
			$zone = base64_decode($cv);
			$p = explode('@', $zone, 2);
			if($p[0] > 0 AND !empty($p[1])){
				return DB::GetTableRow('partner', array(
					'id' => $p[0],
					'password' => $p[1],
				));
			}			
		}
		return Array();
	}
 public static function CreateFromBuy($other_user_id)
 {
     $rid = abs(intval(cookieget('_rid')));
     return self::CreateFromId($rid, $other_user_id);
 }
Exemple #4
0
<?php

require_once dirname(dirname(__FILE__)) . '/app.php';
$action = strval($_GET['action']);
$id = strval($_GET['id']);
$sec = strval($_GET['secret']);
if ($action == 'needlogin') {
    $html = render('ajax_dialog_needlogin');
    json($html, 'dialog');
} else {
    if ($action == 'authorization') {
        need_auth('super');
        $user = Table::Fetch('user', $id);
        $html = render('manage_ajax_dialog_authorization');
        json($html, 'dialog');
    } else {
        if ('locale' == $action) {
            $v = cookieget('locale', 'zh_cn');
            cookieset('locale', $v == 'zh_cn' ? 'zh_tw' : 'zh_cn');
            json(null, 'refresh');
        }
    }
}
Exemple #5
0
function cookie_city($city)
{
    global $INI;
    if ($city) {
        cookieset('city', $city['id']);
        return $city;
    }
    $city_id = cookieget('city');
    if (!$city_id) {
        $city = get_city();
        if (!$city) {
            $city = Table::Fetch('category', $INI['hotcity'][0]);
        }
        if ($city) {
            cookie_city($city);
        }
        return $city;
    } else {
        if (in_array($city_id, $INI['hotcity'])) {
            return Table::Fetch('category', $city_id);
        }
        $INI['hotcity'] = array_diff($INI['hotcity'], array(0, NULL));
        $city = Table::Fetch('category', $INI['hotcity'][0]);
    }
    return $city;
}
Exemple #6
0
function cookie_city($city)
{
    global $hotcities;
    if ($city) {
        cookieset('city', $city['id']);
        return $city;
    }
    $city_id = cookieget('city');
    $city = Table::Fetch('category', $city_id);
    if (!$city) {
        $city = get_city();
    }
    if (!$city) {
        $city = array_shift($hotcities);
    }
    if ($city) {
        return cookie_city($city);
    }
    return $city;
}
Exemple #7
0
function cookie_city($city)
{
    if ($city) {
        $city_v = uencode("{$city['id']}|{$city['ename']}|{$city['name']}");
        $expire = time() + 365 * 86400;
        cookieset('city', $city_v);
    } else {
        if (!cookieget('city')) {
            $city = get_city();
            if (!$city) {
                return array();
            }
            return cookie_city($city);
        } else {
            $v = explode('|', udecode(cookieget('city')));
            return array('id' => $v[0], 'ename' => $v[1], 'name' => $v[2]);
        }
    }
    return $city;
}
Exemple #8
0
<?php

/**
 * 动态登录
 * @author abei <*****@*****.**>
 */
require_once dirname(dirname(__FILE__)) . '/app.php';
if ($_POST) {
    $mobile = $_POST['mobile'];
    $code = $_POST['code'];
    $check_result = true;
    $check = DB::GetTableRow("user", array('mobile' => $mobile));
    if (empty($check)) {
        $check_result = false;
        Session::Set('error', '很抱歉,该手机号已经存在。');
    }
    if ($code != $_SESSION['mobile_dynamic_code']) {
        $check_result = false;
        Session::Set('error', '验证码不正确。');
    }
    if ($check_result == true) {
        Session::Set('user_id', $check['id']);
        redirect(get_loginpage(WEB_ROOT . '/index.php'));
    }
}
$check_time = cookieget('send_dynamic');
$check_time_mobile = cookieget('send_dynamic_mobile');
$pagetitle = '动态登录';
include template('account_dynamic_login');
Exemple #9
0
function is_newbie()
{
    return cookieget('newbie') != 'N';
}
Exemple #10
0
	static public function GetRemeberBizName(){
		$cv = cookieget('rb');
		if ($cv) {
			$zone = base64_decode($cv);
			$p = explode('@', $zone, 2);
			if($p[0] > 0){
				$p = Table::Fetch('partner',$p[0]);
				return $p['username'];
			}			
		}
		return false;
	}
Exemple #11
0
 * 手机注册
 * @author abei <*****@*****.**>
 */
require_once dirname(dirname(__FILE__)) . '/app.php';
if ($_POST) {
    $mobile = $_POST['mobile'];
    $code = $_POST['code'];
    $check_result = true;
    $check = DB::GetTableRow("user", array('mobile' => $mobile));
    if ($check) {
        $check_result = false;
        Session::Set('error', '很抱歉,该手机号已经存在。');
    }
    if ($code != $_SESSION['mobile_reg_code']) {
        $check_result = false;
        Session::Set('error', '验证码不正确。');
    }
    if ($check_result == ture) {
        //	建立一个新的帐号
        $rand = time();
        $username = "******" . $rand;
        $new_user = array('username' => $username, 'email' => $rand . '@milituan.net', 'mobile' => $mobile, 'password' => $_POST['password'], 'sns' => 'mreg');
        $user_id = ZUser::Create($new_user, true);
        ZLogin::Login($user_id);
        redirect(get_loginpage(WEB_ROOT . '/index.php'));
    }
}
$check_time = cookieget('mobile_reg_code');
$check_time_mobile = cookieget('mobile_reg_code_mobile');
$pagetitle = '手机注册';
include template('account_register');