<?php
include_once "conn.php";

$qid=is_numeric($_GET['qid'])?$_GET['qid']:exit('No Qid!');
$result = mysql_query("SELECT * FROM {$tableqz}qqs where qid='{$qid}' and isqd>0 and sidzt=0 limit 1");
if($row=mysql_fetch_array($result)){
	$uin=$row['qq'];
	$sid=$row['sid'];
	$skey=$row['skey'];
	$p_skey=$row['p_skey'];
	$p_skey2=$row['p_skey2'];
	$do=$row['isqd'];
	$now=date("Y-m-d-H:i:s");
	$con=urlencode(get_con($row['qdcon']));
	$lid=10319;
	$next=date("Y-m-d H:i:s",time()+60*60*8-10);
	include_once "qzone.class.php";
	$qzone=new qzone($uin,$sid,$skey,$p_skey,$p_skey2);
	if($do==2){
		$sql.="lastqd='$now',";
		$qzone->qiandao('pc',$con,$lid);
	}else{
		$sql.="lastqd='$now',";
		$qzone->qiandao(0,$con,$lid);
	}
	if($row['iscwqd']) {
		$sql.="lastcwqd='$now',";
		$qzone->gcw();
	}
	if($row['isqqllqqd']) {
		$sql.="lastqqllqqd='$now',";
		$qzone->qqllqqd();
	}
	if($row['isjfqd']) {
		$sql.="lastjfqd='$now',";
		$qzone->jfqd();
	}
	if($row['isqlqd']) {
		$sql.="lastqlqd='$now',";
		$qzone->qlqd();
	}
	if($row['isdtqd']) {
		$sql.="lastdtqd='$now',";
		$qzone->dtqd();
	}
	if($row['isyyqd']) {
		$sql.="lastyyqd='$now',";
		$qzone->yyqd();
	}
	if($row['isqlqd']) {
		$sql.="lastqlqd='$now',";
		$qzone->qqqlqd();
	}
	if($row['isgameqd']==2) {
		$sql.="lastgameqd='$now',";
		$qzone->pcgamevipqd();
		}else{
		$qzone->gamevipqd();
	}
	if($row['ismqqd']) {
		$sql.="lastmqqd='$now',";
		$qzone->cqqd();
	}
	if($row['ismc']) {
		$sql.="lastmc='$now',";
		$qzone->mcqd();
	}
	if($row['isnc']) {
		$sql.="lastnc='$now',";
		get_curl('http://mcapp.z.qq.com/nc/cgi-bin/wap_farm_index?sid='.$sid.'&g_ut=1');
        get_curl('http://mcapp.z.qq.com/nc/cgi-bin/wap_farm_index?sid='.$sid.'&g_ut=1&signin=1');
        get_curl('http://mcapp.z.qq.com/nc/cgi-bin/wap_farm_freegift_recv?sid='.$sid.'&g_ut=1&fg_recv=1');
	}
	if($row['iswtqd']) {
		$sql.="lastwtqd='$now',";
		get_curl('http://www.24hmz.cn/tgyd/wtqd.php?uin='.$uin.'&sid='.$sid.'&skey='.$skey);
	}
	if($row['islqd']) {
		$sql.="lastlq='$now',";
		$qzone->lzqd();
	}
	if($row['iswyqd']) {
		$sql.="lastwyqd='$now',";
		$qzone->wyqd();
	}
	if($row['isslqd']) {
		$sql.="laslqqd='$now',";
		$qzone->slqd();
	}
	if($row['isblqd']) {
		$sql.="lastblqd='$now',";
		$qzone->pcblqd();
	}
	if($row['isgjqd']) {
		$sql.="lastgjqd='$now',";
		$qzone->gjqd();
	}
	if($row['isdldqd']) {
		$sql.="lastdldqd='$now',";
		$qzone->dldqd();
	}
	if($row['ishlwqd']) {
		$sql.="lasthlwqd='$now',";
		$qzone->hlwqd();
	}
	if($row['ists']==2) {
		$sql.="lastts='$now',";
		$qzone->scqd();
		}else{
		$qzone->cpscqd();
	}
	include_once "mail.php";
	@mysql_query("update {$tableqz}qqs set {$sql}nextqd='$next' where qid='$qid'");
	exit('Ok!');
}else{
	exit('Qid Error!');
}
