<?php
//post访问网页，1post地址，2post数据,3cookie
function post($str1,$str2,$cookie){
	$ch=curl_init();
	curl_setopt($ch,CURLOPT_URL,$str1);
	curl_setopt($ch,CURLOPT_HEADER,1);
	curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
	curl_setopt($ch,CURLOPT_COOKIEJAR,$cookie);
	curl_setopt($ch,CURLOPT_POST,1);
	curl_setopt($ch,CURLOPT_POSTFIELDS,$str2);
	$data=curl_exec($ch);
	curl_close($ch);
	return $data;
}

//QQ图书精灵，1QQ，2SID，3类型 1=签到 2=浏览任务 3=分享任务 4=评分_评论
function function_do ($qq,$sid,$user,$lx){

$kcjfz[1] = "5"; //扣除积分组
$kcjfz[2] = "30"; //扣除积分组
$kcjfz[3] = "10"; //扣除积分组
$kcjfz[4] = "10"; //扣除积分组
$kcjf = $kcjfz[$lx]; //扣除积分

require "../siteinfo.php";
//连接数据库
$localhost = mysql_connect($sqlhost,$sqluser,$sqlpass)or die("连接数据库失败，请联系网站管理员！");
mysql_select_db ($sqldata,$localhost);

$sql = mysql_fetch_array (mysql_query ("SELECT * FROM `user` WHERE `user`='$user'"));
if ($sql['jf'] < $kcjf){
echo "您的积分不足，无法执行此操作！";
}else{
$jf = ($sql['jf'] - $kcjf);
mysql_query ("UPDATE `user` SET `jf`='$jf' WHERE `user`='$user'");

if ($lx == 1){//扣除5积分
$data = file_get_contents ("http://ebook.3g.qq.com/user/signdaily2?sid=".$sid."&g_ut=2");
if (strpos ($data,"签到成功。")){
echo "正在刷签到任务... 成功 1 次！<br>";
}
}else if ($lx == 2){//扣除30积分
$i = 0;
while($i < 210){
$data = file_get_contents ("http://ebook.3g.qq.com/book/chapter?sid=".$sid."&g_ut=2&b_f=100320&cid=2&bid=".rand (206858,226858)."&v=true");
if (strpos ($data,"分享本书")){
$i++;
echo "正在刷浏览任务... 成功: $i 次！<br>";
}
}

}else if ($lx == 3){//扣除10积分
$i = 0;
while($i < 3){
$data = file_get_contents ("http://ebook.3g.qq.com/book/share?sid=".$sid."&g_ut=2&b_f=40&bid=".rand (206858,226858));
if (strpos ($data,"本书已成功分享给好友！")){
$i++;
echo "正在刷分享任务... 成功: $i 次！<br>";
}
}
}else if ($lx == 4){//扣除10积分
$i = 0;
while($i < 3){
$data = post ("http://ebook.3g.qq.com/book/comment/commentResult?sid=".$sid."&g_ut=2&b_f=40&bid=".rand (206858,226858),"g_ut=2&key=key&from=intro&cid=0&rec=&content=%E7%9C%8B%E4%B8%8B%EF%BC%81%E5%BE%88%E4%B8%8D%E5%A5%BD%E7%9C%8B%EF%BC%8C%E4%B8%8D%E6%8E%A8%E8%8D%90%EF%BC%81&mark=1");
if (strpos ($data,"恭喜,书评发表成功!")){
$i++;
echo "正在刷评分、评论... 成功: $i 次！<br>";
}
}
}
}
}


function_do ("1689818364","AXbUhqHRi5v41Cp8VDPyq7ct","admin",4);
?>