if ($act == 'logout') { unset($_SESSION['uid']); unset($_SESSION['username']); unset($_SESSION['utype']); setcookie("QS[uid]", "", time() - 3600, $QS_cookiepath, $QS_cookiedomain); setcookie("QS[username]", "", time() - 3600, $QS_cookiepath, $QS_cookiedomain); setcookie("QS[password]", "", time() - 3600, $QS_cookiepath, $QS_cookiedomain); setcookie("QS[utype]", "", time() - 3600, $QS_cookiepath, $QS_cookiedomain); unset($_SESSION['activate_username']); unset($_SESSION['activate_email']); header("location:index.php"); } elseif ($act == 'weixin_login') { $openid = trim($_GET['openid']); $uid = intval($_GET['uid']); $event_key = intval($_GET['event_key']); weixin_login($openid, $uid, $event_key); $smarty->display('wap/scan/scan_success.html'); } elseif (!$_SESSION['uid'] && !$_SESSION['username'] && !$_SESSION['utype'] && $_COOKIE['QS']['username'] && $_COOKIE['QS']['password']) { if (check_cookie($_COOKIE['QS']['username'], $_COOKIE['QS']['password'])) { update_user_info($_COOKIE['QS']['username'], false, false); if ($_SESSION['utype'] == 2) { header("location:personal/wap_user.php"); } if ($_SESSION['utype'] == 1) { header("location:company/wap_user.php"); } } else { setcookie("QS[uid]", "", time() - 3600, $QS_cookiepath, $QS_cookiedomain); setcookie('QS[username]', "", time() - 3600, $QS_cookiepath, $QS_cookiedomain); setcookie('QS[password]', "", time() - 3600, $QS_cookiepath, $QS_cookiedomain); setcookie("QS[utype]", "", time() - 3600, $QS_cookiepath, $QS_cookiedomain);
// 微信扫码注册用户名类型 前缀+随机字符 $username = $_CFG['third_reg_prefix'] . randusername(); // 微信扫码注册用户密码类型 1->与用户名相同 2->随机密码 3->指定密码 if ($_CFG['reg_weixin_password_tpye'] == "1") { $password = $username; } elseif ($_CFG['reg_weixin_password_tpye'] == "2") { $password = randusername(); } else { $password = $_CFG['reg_weixin_password']; } $insert_id = user_register(3, $password, $utype, "", "", false, $username, $weixin_openid, $w_userinfo['nickname']); if ($insert_id > 0) { $smarty->assign('utype_cn', $utype == 1 ? '企业会员' : '个人会员'); $smarty->assign('username', $username); $smarty->assign('password', $password); weixin_login($weixin_openid, $insert_id, $event_key); $smarty->display('m/scan/scan_reg_success.html'); } else { exit('err'); } } else { exit('err'); } } function weixin_login($openid, $uid, $event_key) { global $QS_cookiepath, $QS_cookiedomain, $_CFG; $u = get_user_by_weixinopenid($openid, $uid); if (!empty($u)) { if (file_exists(QISHI_ROOT_PATH . "data/weixin/" . $event_key % 10 . '/' . $event_key . ".txt")) { ini_set('session.save_handler', 'files');