function action_oath_login() { // 获取全局变量 $user = $GLOBALS['user']; $_CFG = $GLOBALS['_CFG']; $_LANG = $GLOBALS['_LANG']; $smarty = $GLOBALS['smarty']; $db = $GLOBALS['db']; $ecs = $GLOBALS['ecs']; $user_id = $_SESSION['user_id']; $type = empty($_REQUEST['type']) ? '' : $_REQUEST['type']; include_once ROOT_PATH . 'includes/website/jntoo.php'; $c =& website($type); if ($c) { $access = $c->getAccessToken(); if (!$access) { show_message($c->get_error(), '首页', $ecs->url(), 'error'); } $c->setAccessToken($access); $info = $c->getMessage(); if (!$info) { show_message($c->get_error(), '首页', $ecs->url(), 'error', false); } if (!$info['user_id']) { show_message($c->get_error(), '首页', $ecs->url(), 'error', false); } $info_user_id = $type . '_' . $info['user_id']; // 加个标识!!!防止 其他的标识 一样 // // 以后的ID 标识 将以这种形式 辨认 $info['name'] = str_replace("'", "", $info['name']); // 过滤掉 逗号 不然出错 很难处理 if (!$info['user_id']) { show_message($c->get_error(), '首页', $ecs->url(), 'error', false); } $sql = 'SELECT user_name,password,aite_id FROM ' . $ecs->table('users') . ' WHERE aite_id = \'' . $info_user_id . '\' OR aite_id=\'' . $info['user_id'] . '\''; $count = $db->getRow($sql); if (!$count) { if ($user->check_user($info['name'])) { $info['name'] = $info['name'] . '_' . $type . rand(10000, 99999); } $user_pass = $user->compile_password(array('password' => $info['user_id'])); $sql = 'INSERT INTO ' . $ecs->table('users') . '(user_name , password, aite_id , sex , reg_time , user_rank , is_validated) VALUES ' . "('{$info['name']}' , '{$user_pass}' , '{$info_user_id}' , '{$info['sex']}' , '" . gmtime() . "' , '{$info['rank_id']}' , '1')"; $db->query($sql); } else { $sql = ''; if ($count['aite_id'] == $info['user_id']) { $sql = 'UPDATE ' . $ecs->table('users') . " SET aite_id = '{$info_user_id}' WHERE aite_id = '{$count['aite_id']}'"; $db->query($sql); } if ($info['name'] != $count['user_name']) { if ($user->check_user($info['name'])) { $info['name'] = $info['name'] . '_' . $type . rand() * 1000; } $sql = 'UPDATE ' . $ecs->table('users') . " SET user_name = '{$info['name']}' WHERE aite_id = '{$info_user_id}'"; $db->query($sql); } } $user->set_session($info['name']); $user->set_cookie($info['name']); update_user_info(); recalculate_price(); if (!empty($_REQUEST['open'])) { die('<script>window.opener.window.location.reload(); window.close();</script>'); } else { ecs_header('Location: ' . $_REQUEST['callblock']); } } }
if ($back_act[4] != ':') { $back_act = $hhs->url() . $back_act; } $open = empty($_REQUEST['open']) ? 0 : intval($_REQUEST['open']); $url = $c->login($hhs->url() . 'user.php?act=oath_login&type=' . $type . '&callblock=' . urlencode($back_act) . '&open=' . $open); if (!$url) { show_message($c->get_error(), '首页', $hhs->url(), 'error'); } header('Location: ' . $url); } else { show_message('服务器尚未注册该插件!', '首页', $hhs->url(), 'error'); } } elseif ($action == 'oath_login') { $type = empty($_REQUEST['type']) ? '' : $_REQUEST['type']; include_once ROOT_PATH . 'includes/website/jntoo.php'; $c =& website($type); if ($c) { $access = $c->getAccessToken(); if (!$access) { show_message($c->get_error(), '首页', $hhs->url(), 'error'); } $c->setAccessToken($access); $info = $c->getMessage(); if (!$info) { show_message($c->get_error(), '首页', $hhs->url(), 'error', false); } if (!$info['user_id']) { show_message($c->get_error(), '首页', $hhs->url(), 'error', false); } $info_user_id = $type . '_' . $info['user_id']; // 加个标识!!!防止 其他的标识 一样 // 以后的ID 标识 将以这种形式 辨认