<?php
error_reporting(0);
error_reporting(E_ALL & ~E_NOTICE);
@date_default_timezone_set('PRC');
@header('Content-Type: text/html; charset=UTF-8');
@ignore_user_abort(true);
require_once "../libs/360_safe3.php";

function duo_curl($urls) { 
	$ua='Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.93 Safari/537.36';
	$queue = curl_multi_init(); 
	$map = array();
	foreach ($urls as $url) { 
		$ch = curl_init(); 
		curl_setopt($ch, CURLOPT_URL, $url); 
		curl_setopt($ch, CURLOPT_TIMEOUT,30); 
		curl_setopt($ch, CURLOPT_USERAGENT,$ua);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
		curl_setopt($ch, CURLOPT_HEADER, 0); 
		curl_setopt($ch, CURLOPT_NOSIGNAL, true); 
		curl_multi_add_handle($queue, $ch); 
		$map[(string) $ch] = $url; 
	}
	$responses = array(); 
	do { 
		while (($code = curl_multi_exec($queue, $active)) == CURLM_CALL_MULTI_PERFORM) ; 
		if ($code != CURLM_OK) { break; } 
		while ($done = curl_multi_info_read($queue)) { 
			$info = curl_getinfo($done['handle']); 
			$error = curl_error($done['handle']); 
			$results = curl_multi_getcontent($done['handle']);//返回内容
			$responses[$map[(string) $done['handle']]] = compact('info', 'error', 'results'); 
			curl_multi_remove_handle($queue, $done['handle']); 
			curl_close($done['handle']); 
		}
		if ($active > 0) { 
			curl_multi_select($queue, 0.5); 
		} 
	} while ($active);
	curl_multi_close($queue); 
	return $responses; 
}
function get_curl($url,$post=0){
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL,$url);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
	if($post){
		curl_setopt($ch, CURLOPT_POST, 1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
	}
	curl_setopt($ch, CURLOPT_REFERER, "http://m.qzone.com/infocenter?g_f=");
	curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Linux; U; Android 4.0.4; es-mx; HTC_One_X Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0');
	curl_setopt($ch, CURLOPT_ENCODING, "gzip");
	curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
	$ret = curl_exec($ch);
	curl_close($ch);
	return $ret;
}
function get_con(){
	$row=file('../data/content.txt');
	shuffle($row);
	if($con){
		$arr=explode('|',$con);
		shuffle($arr);
		$con=$arr[0];
		return str_replace(array('[时间]','[随机]','[表情]'),array(date("Y-m-d H:i:s"),$row[1],'[em]e'.rand(100,204).'[/em]'),$con);
	}elseif($con='[爱情]'){
	$row=file('../data/aiqing.txt');
	shuffle($row);
	$arr=explode('|',$con);
		shuffle($arr);
		$con=$arr[0];
		return $row[1];
	}elseif($con='[伤感]'){
	$row=file('../data/shanggan.txt');
	shuffle($row);
	$arr=explode('|',$con);
		shuffle($arr);
		$con=$arr[0];
		return $row[1];
	}elseif($con='[经典]'){
	$row=file('../data/jingdian.txt');
	shuffle($row);
	$arr=explode('|',$con);
		shuffle($arr);
		$con=$arr[0];
		return $row[1];
	}elseif($con='[人生格言]'){
	$row=file('../data/rensheng.txt');
	shuffle($row);
	$arr=explode('|',$con);
		shuffle($arr);
		$con=$arr[0];
		return $row[1];
	}elseif($con='[笑话]'){
	$row=file('../data/xiaohua.txt');
	shuffle($row);
	$arr=explode('|',$con);
		shuffle($arr);
		$con=$arr[0];
		return $row[1];
	}else{
		return $row[0];
	}
}
function get_nurl(){
	$nurl='http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
	preg_match('/(.*?\/)([a-zA-Z0-9]+\.)+php/i',$nurl,$arr);
	return $arr[1];
}

$mysql=require("../fuckyoumdyiscyab/db.php");
$dbhost=$mysql['DB_HOST'].':'.$mysql['DB_PORT'];
$dbuser=$mysql['DB_USER'];
$dbpassword=$mysql['DB_PWD'];
$dbmysql=$mysql['DB_NAME'];
if($con = mysql_connect($dbhost,$dbuser,$dbpassword)){
	mysql_select_db($dbmysql, $con);
}else{
	exit('数据库链接失败！');
}
mysql_query("set names utf8"); 
$tableqz=$mysql['DB_PREFIX'];
$result=mysql_query("select * from {$tableqz}webconfigs");
while($row = mysql_fetch_array($result)){ 
	$config[$row['vkey']]=$row['value'];
}
if($_GET['cron']!=$config['cronrand']){
	exit('监控识别码不正确！');
}
$nurl=get_nurl();
$look=$_GET['get']?'&get=1':'';
$now=date("Y-m-d-H:i:s");
