コード例 #1
0
ファイル: denglu.php プロジェクト: firsteam/falcons
require_once ROOT_PATH . 'includes/lib_code.php';
if (empty($_GET['token']) && empty($_POST)) {
    show_message('您无权使用本功能', $_LANG['profile_lnk'], 'user.php', 'error', false);
}
if (!empty($_GET['token'])) {
    $userinfo = file_get_contents('http://open.denglu.cc/api/v2/user_info?token=' . $_GET['token']);
    !$userinfo && show_message('网络连接失败!请查看php配置allow_url_fopen是否开启');
    strpos($userinfo, 'error') && show_message('网络连接错误!请联系相关技术人员');
}
$userinfo = empty($_POST['userbak']) ? $userinfo : decrypt($_POST['userbak']);
$userbak = encrypt($userinfo);
$userinfo = json_decode($userinfo, 1);
$guestexp = '\\xA1\\xA1|\\xAC\\xA3|^Guest|^\\xD3\\xCE\\xBF\\xCD|\\xB9\\x43\\xAB\\xC8';
$sdf = preg_replace("/\\s+|^c:\\con|[%,\\*\"\\s\\<\\>\\&]|{$guestexp}/is", '', $userinfo['screenName']);
//过滤非法字符
$sdf = dlcutstr($sdf, 15);
$sdf = empty($_POST['username']) ? $sdf : trim($_POST['username']);
$gender = $userinfo['gender'];
$mediaUID = $userinfo['mediaUserID'];
$password = substr(md5($mediaUID), 0, 10);
$loginfield = 'username';
$email = substr(md5(time()), -10) . '@example.com';
$other = array('sex' => $gender, 'mediaUID' => $mediaUID, 'mediaID' => $userinfo['mediaID']);
//判断用户是否已同步,
$result = $db->getRow("select * from  {$ecs->table($user->user_table)} where mediaUID='{$mediaUID}' and  mediaID={$userinfo['mediaID']}");
if ($result) {
    //已同步
    $sdf = $result['user_name'];
    $password = $result['password'];
    //设置成登录状态
    $GLOBALS['user']->set_session($sdf);
コード例 #2
0
ファイル: denglu.php プロジェクト: moonlight-wang/feilun
require_once ROOT_PATH . 'includes/lib_code.php';
if (empty($_GET['token']) && empty($_POST)) {
    show_message('您无权使用本功能', $_LANG['profile_lnk'], 'user.php', 'error', false);
}
if (!empty($_GET['token'])) {
    $userinfo = file_get_contents('http://open.denglu.cc/api/v2/user_info?token=' . $_GET['token']);
    !$userinfo && show_message('网络连接失败!请查看php配置allow_url_fopen是否开启');
    strpos($userinfo, 'error') && show_message('网络连接错误!请联系相关技术人员');
}
$userinfo = empty($_POST['userbak']) ? $userinfo : decrypt($_POST['userbak']);
$userbak = encrypt($userinfo);
$userinfo = json_decode($userinfo, 1);
$guestexp = '\\xA1\\xA1|\\xAC\\xA3|^Guest|^\\xD3\\xCE\\xBF\\xCD|\\xB9\\x43\\xAB\\xC8';
$username = preg_replace("/\\s+|^c:\\con|[%,\\*\"\\s\\<\\>\\&]|{$guestexp}/is", '', $userinfo['screenName']);
//过滤非法字符
$username = dlcutstr($username, 15);
$username = empty($_POST['username']) ? $username : trim($_POST['username']);
$gender = $userinfo['gender'];
$mediaUID = $userinfo['mediaUserID'];
$password = substr(md5($mediaUID), 0, 10);
$loginfield = 'username';
$email = substr(md5(time()), -10) . '@example.com';
$other = array('sex' => $gender, 'mediaUID' => $mediaUID, 'mediaID' => $userinfo['mediaID']);
//判断用户是否已同步,
$result = $db->getRow("select * from  {$ecs->table($user->user_table)} where mediaUID='{$mediaUID}' and  mediaID={$userinfo['mediaID']}");
if ($result) {
    //已同步
    $username = $result['user_name'];
    $password = $result['password'];
    //设置成登录状态
    $GLOBALS['user']->set_session($username);