Exemplo n.º 1
0
function jieqi_logindo($gourl)
{
    if (strpos($gourl, 'http') === false) {
        if ($_SERVER['HTTP_HOST'] != '') {
            $gourl = 'http://' . $_SERVER['HTTP_HOST'] . $gourl;
        } else {
            $gourl = JIEQI_URL . $gourl;
        }
    }
    if ($_SESSION['jieqiUserGroup'] == JIEQI_GROUP_ADMIN) {
        $isadmin = 1;
    } else {
        $isadmin = 0;
    }
    $member = array('time' => JIEQI_NOW_TIME, 'username' => $_REQUEST['username'], 'password' => md5($_REQUEST['password']), 'email' => $_SESSION['jieqiUserEmail'], 'isadmin' => $isadmin);
    $action = 'login';
    $auth = passport_encrypt(passport_encode($member), DISCUZ_PASSPORT_KEY);
    $verify = md5($action . $auth . $gourl . DISCUZ_PASSPORT_KEY);
    header('Location: ' . DISCUZ_PASSPORT_URL . '?action=' . $action . '&auth=' . rawurlencode($auth) . '&forward=' . rawurlencode($gourl) . '&verify=' . $verify);
    //jieqi_jumppage($gourl, '*登录成功*', jieqi_htmlstr($_REQUEST['username']).',欢迎您到来!');
}
Exemplo n.º 2
0
 function regist($userId, $rurl)
 {
     $oMember = $this->system->loadModel('member/member');
     $charset = $this->system->loadModel('utility/charset');
     $aMember = $oMember->getFieldById($userId);
     $username = $aMember['uname'];
     if (true || $SITE_EODING == "UTF-8") {
         if ($this->_config['encoding'] != 'utf8') {
             $username = $charset->utf2local($username, $this->_config['encoding']);
         }
     }
     $member = array('cookietime' => 31536000, 'time' => time(), 'username' => $username, 'password' => $aMember['password'], 'gender' => $aMember['sex'], 'email' => $aMember['email'], 'credits' => $aMember['point'], 'regip' => $aMember['reg_ip'], 'regdate' => $aMember['regtime'], 'qq' => '');
     $rurl .= "index.php?passport-create.html";
     $rurl .= "&plugUrl=" . $this->_config['URL'];
     $this->setPlugCookie(1);
     $auth = passport_encrypt(passport_encode($member), $this->_config['PrivateKey']);
     $shop_loginapi_url = substr($this->_config['URL'], -1) == "/" ? $this->_config['URL'] . "api/shopex.php" : $this->_config['URL'];
     header('Location: ' . $shop_loginapi_url . '?action=login&auth=' . rawurlencode($auth) . '&forward=' . rawurlencode($rurl) . '&verify=' . md5('login' . $auth . $rurl . $this->_config['PrivateKey']));
     exit;
 }
Exemplo n.º 3
0
<?php

!defined('M_COM') && exit('No Permisson');
if (substr($pptout_url, -1, 1) != '/') {
    $pptout_url .= '/';
}
if ($action == 'login') {
    include_once M_ROOT . "./include/charset.fun.php";
    $memberarr = array('time' => $timestamp, 'username' => convert_encoding($mcharset, $pptout_charset, $username), 'password' => md5(md5($password)), 'email' => !empty($email) ? $email : $cmember['email']);
    $auth = passport_encrypt(passport_encode($memberarr), $pptout_key);
    $verify = md5($action . $auth . $forward . $pptout_key);
    $url = $pptout_url . 'api/passport.php?action=login&auth=' . rawurlencode($auth) . '&forward=' . rawurlencode($forward) . '&verify=' . $verify;
} elseif ($action == 'logout') {
    $auth = passport_encrypt(passport_encode(array()), $pptout_key);
    $verify = md5($action . $auth . $forward . $pptout_key);
    $url = $pptout_url . 'api/passport.php?action=logout&forward=' . rawurlencode($forward) . '&verify=' . $verify;
}
/**
* Passport 加密函数
*
* @param		string		等待加密的原字串
* @param		string		私有密匙(用于解密和加密)
*
* @return	string		原字串经过私有密匙加密后的结果
*/
function passport_encrypt($txt, $key)
{
    // 使用随机数发生器产生 0~32000 的值并 MD5()
    srand((double) microtime() * 1000000);
    $encrypt_key = md5(rand(0, 32000));
    // 变量初始化