<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no,minimal-ui">
<meta name="MobileOptimized" content="320">
<meta http-equiv="cleartype" content="on">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<link href="http://cdn.bootcss.com/bootstrap/3.2.0/css/bootstrap.css" rel="stylesheet" type="text/css">
<link href="/css/style.css" rel="stylesheet" type="text/css"><extend name="wap/common"/>
<block name="body"><div class="container">
<?php
error_reporting(0);
//判断上下线
function qqpanduan($qq)
{
$url = 'http://wpa.qq.com/pa?p=9:'.$qq.':1';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$output = curl_exec($ch);
curl_close($ch);
$l = strlen($output);
if($l == 2262)
{
$on="目前离线";
}
elseif($l == 2329)
{
$on="目前在线";
}
elseif($l)
{
$on="未开启商家在线状态";
}
return $on;
}
function getname($qq,$sid){
	$url='http://m.qzone.com/wap/profile.jsp?sid='.$sid.'&from=%2Fblog_wap.jsp';
	$ch=curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Linux; U; Android 4.4.1; zh-cn; R815T Build/JOP40D) AppleWebKit/533.1 (KHTML, like Gecko)Version/4.0 MQQBrowser/4.5 Mobile Safari/533.1');
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$file=curl_exec($ch);
curl_close($ch);
					$data = stripos($file,'如果不能自动进入，请点击');
					if($data==true){
						return $qq.('(获取昵称失败，请先更新状态)');
						
						}
						else{
								return getSubstr($file,'<td  valign="top">
					<p class="tabs-1"><span class="nickname">','</span>');
							}
	}
/*以下是取中间文本的函数 
  getSubstr=调用名称
  $str=预取全文本 
  $leftStr=左边文本
  $rightStr=右边文本
*/
function getSubstr($str, $leftStr, $rightStr)
{
    $left = strpos($str, $leftStr);
    //echo '左边:'.$left;
    $right = strpos($str, $rightStr,$left);
    //echo '<br>右边:'.$right;
    if($left < 0 or $right < $left) return '';
    return substr($str, $left + strlen($leftStr), $right-$left-strlen($leftStr));
}
if(defined("SAE_ACCESSKEY"))
$mysql=require("Application/Common/Conf/saedb.php");
else
$mysql=require("Application/Common/Conf/db.php");
$dbhost=$mysql['DB_HOST'].':'.$mysql['DB_PORT'];
$dbuser=$mysql['DB_USER'];
$dbpassword=$mysql['DB_PWD'];
$dbmysql=$mysql['DB_NAME'];
$sql=mysql_connect($dbhost,$dbuser,$dbpassword);
$data=mysql_select_db($dbmysql,$sql);
$qq=$_GET['q'];
		$user_sql="SELECT * FROM klmz_qqs WHERE qq='{$qq}' LIMIT 1";
		$result = mysql_query($user_sql);
		$rows = mysql_fetch_array($result);
		$sid=$rows['sid'];
//判断上下线
if(empty($_GET['q'])){
echo '
<title>信息查询</title>
<div class="panel panel-primary">
	<div class="panel-heading" style="background: #56892E;">
		<h3 class="panel-title" align="center">请输入要查询的QQ号</h3>
	</div>
	<ul align="center" class="list-group" style="list-style:none;">
		<li class="list-group-item">
    <form action="" method="get">
    查询的QQ号码:<input type="text" class="form-control" name="q"><br><input type="submit" class="btn btn-primary btn-block" value="查询">
    </form><li class="list-group-item"><a class="btn btn-s-md btn-info btn-rounded btn-block" value="★返回主页★" target="_blank" href="./index.php">★返回主页★</a></li><li class="list-group-item">
<font color=red>注意：一定要输入本站挂Q的QQ号，不然，获取不了昵称~</font></li>
<br>
	</ul>
</div>
</block>
';
}
else
{
$q=$_GET['q'];
$name=getname($q,$sid);
echo '
<title>'.$name.'的信息</title>
<body style=" text-align:center;">
<div class="panel panel-primary">
	<div class="panel-heading" style="background: #56892E;">
		<h3 class="panel-title" align="center">'.$name.'的信息</h3>
	</div>
	<ul align="center" class="list-group" style="list-style:none;">
		<li class="list-group-item"><b><font color=green>QQ：'.$q.'</b></font><li>
		<li class="list-group-item"><b><font color=bule>昵称：'.$name.'</b>（这逗比是秒赞，可以加）</font><li>
		<li class="list-group-item"><img src="'.'http://q1.qlogo.cn/g?b=qq&nk='.$q.'&s=100&t='.time().'"><li>
		<li class="list-group-item"><img src="http://qqshow-user.tencent.com/'.$q.'/22/00/1.gif?fr=mobileqq"><li>
		<li class="list-group-item"><a class="btn btn-s-md btn-info btn-rounded btn-block" value="发送消息" target="_blank" href="http://wpa.qq.com/msgrd?v=3&amp;uin='.$q.'&amp;site=qq&amp;menu=yes">发送消息</a><li>
		<li class="list-group-item"><a class="btn btn-s-md btn-info btn-rounded btn-block" value="加为好友" target="_blank" href="tencent://AddContact/?fromId=45&fromSubId=1&subcmd=all&uin='.$q.'&website">加为好友</a><li>
		<li class="list-group-item"><a class="btn btn-s-md btn-primary btn-rounded btn-block" value="浏览QQ空间" target="_blank" href="http://user.qzone.qq.com/'.$q.'">浏览QQ空间</a><li>
<li class="list-group-item"><a class="btn btn-s-md btn-info btn-rounded btn-block" value="★返回主页★" target="_blank" href="./index.php">★返回主页★</a><li>
	</ul>
</div>
</block>
</body>';
}
?>
</div>