function m__qqbind() { global $dbm; $params = array(); if (isset($_SESSION['uid']) || isset($_SESSION['uname'])) { act_msg('index.php', "你已经登陆了"); } if (isset($_SESSION['qq']['openid']) && isset($_GET['act']) && $_GET['act'] == 'bind') { $_SESSION['qq']['nickname'] = isset($_SESSION['qq']['nickname']) ? helper::escape($_SESSION['qq']['nickname']) : ''; //判断用户名是否存在 $params['uname'] = checkuser($_SESSION['qq']['nickname'], $_SESSION['qq']['nickname']); $params['upass'] = helper::password_encrypt(substr(uniqid(rand()), -6)); $params['reg_date'] = time(); $params['reg_ip'] = helper::getip(); $params['qqid'] = helper::escape($_SESSION['qq']['openid']); $res = $dbm->single_insert(TB_PREFIX . "user_list", $params); //清除QQ登录记录 unset($_SESSION['qq']); if (empty($res['error']) && $res['autoid'] > 0) { $_SESSION['uid'] = $res['autoid']; $_SESSION['uname'] = $params['uname']; //清除QQ登录记录 act_msg("index.php?tpl=ucenter", "登录成功!"); } else { act_msg("index.php?tpl=index", "登录失败!"); } } //act_msg('index.php?tpl=index', "请登陆QQ再绑定用户"); }
function die_error($str) { //die('<script>alert("' . $str . '");history.back();</script>'); if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER'] != '') { act_msg($_SERVER['HTTP_REFERER'], $str); } else { act_msg(SITE_PATH . "index.php", $str); } die; }