<?php 
require "../Run.php";
if(!is_dir(root_path()."/qiandao/db")){
mkdir(root_path()."/qiandao/db");
}
$todayTime = mktime(0,0,0,date('m'),date('d'),date('Y'));
$yday = $todayTime - 60*60*24;
if($_GET['act']=='qd'){
if(is_file(root_path()."/qiandao/db/".WAPID.'_'.MYID.'_'.$todayTime.'.txt')){
	$tip = '<div class="tip">今天已经签到了，不要重复签到哦</div>';
}else{
if(is_file(root_path()."/qiandao/db/".WAPID.'_'.MYID.'_'.$yday.'.txt')){
	$a = file_get_contents(root_path()."/qiandao/db/".WAPID.'_'.MYID.'_'.$yday.'.txt');
	$b = $a +1;
	file_put_contents(root_path()."/qiandao/db/".WAPID.'_'.MYID.'_'.$todayTime.'.txt',$b);
	}else{
	$b ='1';
	file_put_contents(root_path()."/qiandao/db/".WAPID.'_'.MYID.'_'.$todayTime.'.txt',$b);
		}
		$tip = '<div class="tip">已经成功连续签到'.$b.'天了，加油哦！</div>';
		$value = 20+$b*20;
		cre('+',40,$vlue);
		$tip .= '<div class="content">奖励积分'.$value.'</div>';
	}
	$tip .= '<script>window.location="list.php?cid='.$_GET['cid'].'"</script>';
}
echo head("每日签到");
echo '<div class="title">';
echo $tip;
echo '每日签到 '.date("Y/m/d H:i:s");
echo '</div>';
echo '<form method="post" action="?act=qd">';
echo '<textarea name="content"></textarea>';
echo '<br>';
echo '<input value="马上签到" type="submit">';
echo '</form>';
echo '<div class="mylink">';
echo '<a href="http://'.HTTP_HOST.'/index.php?">网站首页</a>';
echo '</div>';
echo footer(1);
?>