function get_guest($myid) { $myinfo = get_row('gid', 'zx_guest', 'wgid=' . $myid); $ip = GetIP(); $browser = get_userAgent($_SERVER['HTTP_USER_AGENT']); $time = time(); if (empty($myinfo)) { $result = get_insert('zx_guest', 'wgid,logins,last,lastip,browser', "'{$myid}',1,{$time},'{$ip}','{$browser}'"); } else { $result = get_update('zx_guest', "last={$time},lastip='{$ip}',browser='{$browser}',logins=logins+1", 'wgid=' . $myid); } $myinfo = get_row('*', 'zx_guest', 'wgid=' . $myid); return $myinfo; }
} //正式开始 $a = intval($_GET['a']); if ($a !== 321456978) { die('Access denied.'); } //简单地防止直接访问当前文件(并不重要) $fromurl = trim($_GET['url']); $json = new JSON(); //将语言转换成js对象 $smilies = ''; //表情图标 for ($i = 0; $i < 24; $i++) { $smilies .= '<img src="' . SYSDIR . 'public/smilies/' . $i . '.png" onclick="insertSmilie(' . $i . ');">'; } $agent = encodeChar(get_userAgent($_SERVER['HTTP_USER_AGENT'])); $key = PassGen(8); $code = authcode(md5(WEBSITE_KEY . $_CFG['KillRobotCode']), 'ENCODE', $key, 3600); //60分钟过期(60分钟后断线重连将失败) $code = encodeChar($code); //先将&转换成特殊字符串||4|| header_nocache(); //不缓存 header('P3P: CP=CAO PSA OUR'); //解决IE下iframe cookie问题 $headimgurl = $_SESSION['wx_user']['headimgurl'] ? $_SESSION['wx_user']['headimgurl'] : 'images/var_img.png'; echo '<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="stylesheet" href="public/guest.css?r=1212">
$username = $user['userfrontename']; $userinfo = html($user['infoen']); $useradv = html($user['adven']); $history_imgurl = TURL . 'images/history_en.gif'; $message_imgurl = TURL . 'images/message_en.gif'; } //验证成功后写入或核实客人信息 $realtime = time(); //访客自动离线时间 $offline_time = ForceInt($_CFG['cAutoOffline']); $offline_time = Iif($offline_time, $offline_time, 10); if ($gid) { $guest = $DB->getOne("SELECT guestid FROM " . TABLE_PREFIX . "guest WHERE guestid = '{$gid}'"); } if (!$gid or !$guest['guestid']) { $userAgent = get_userAgent($_SERVER['HTTP_USER_AGENT']); $DB->exe("INSERT INTO " . TABLE_PREFIX . "guest (guestip, browser, lang, created, isonline, isbanned, serverid, fromurl) VALUES ('" . GetIP() . "', '{$userAgent}', '" . IS_CHINESE . "', '{$realtime}', 0, 0, '{$uid}', '{$fromurl}')"); $gid = $DB->insert_id(); setcookie('weliveGID' . COOKIE_KEY, $gid, $realtime + 60 * 60 * 24, "/"); } else { $DB->exe("UPDATE " . TABLE_PREFIX . "guest SET fromurl = '{$fromurl}' WHERE guestid = '{$gid}'"); } setcookie('weliveG' . COOKIE_KEY, md5($gid . WEBSITE_KEY . $uid . $_CFG['cKillRobotCode']), 0, "/"); //用于AJAX验证 $ajaxpending = 'uid=' . $uid . '&gid=' . $gid; //用于将客服ID和客人ID附加到AJAX URL $welcome_info = preg_replace('/\\/\\/1/i', '<span class=spec>' . $gid . '</span>', $lang['welcome']); $smilies = ''; //添加表情图标 for ($i = 0; $i < 24; $i++) { $smilies .= '<img src="' . TURL . 'smilies/' . $i . '.gif" onclick="insertSmilies(\'[:' . $i . ':]\');">';