1月12
<?php
ignore_user_abort(); // 即使Client断开(如关掉浏览器),PHP脚本也可以继续执行.
set_time_limit(0); // 执行时间为无限制,php默认的执行时间是30秒,通过set_time_limit(0)可以让程序无限制的执行下去
$interval=20; // 时间间隔 单位 秒
$key_file="key.txt"; // 配置文件
if (isset($_GET['s']))
{
if ($_GET['s']=="0"){ // 停止工作,但不退出
$s="false";
echo "Function is off";
}
elseif ($_GET['s']=="1"){ // 工作
$s="true";
echo "Function is on";
}
elseif ($_GET['s']=="2"){ // 退出
$s="die";
echo "Function exited";
}
else
die("Err 0:stop working 1:working 2:exit");
$string = "<?php\n return \"".$s."\";\n?>";
write_inc($key_file,$string,true);
exit();
}
if(file_exists($key_file)){
do{
$mkey = include $key_file;
if ($mkey=="true"){ // 如果工作
///////////////////// 工作区间 //////////////////////////////////
$showtime=date("Y-m-d H:i:s");
$fp = fopen('func.txt','a');
fwrite($fp,$showtime."\n");
fclose($fp);
///////////////////////////////////////////////////////////////////
}
elseif ($mkey=="die"){ // 如果退出
die("I am dying!");
}
sleep($interval); // 等待$interval分钟
}while(true);
}
else
die($key_file." doesn't exist !");
function write_inc($path,$strings,$type=false)
{
$path=dirname(__FILE__)."/".$path;
if ($type==false)
file_put_contents($path,$strings,FILE_APPEND);
else
file_put_contents($path,$strings);
}
?>
ignore_user_abort(); // 即使Client断开(如关掉浏览器),PHP脚本也可以继续执行.
set_time_limit(0); // 执行时间为无限制,php默认的执行时间是30秒,通过set_time_limit(0)可以让程序无限制的执行下去
$interval=20; // 时间间隔 单位 秒
$key_file="key.txt"; // 配置文件
if (isset($_GET['s']))
{
if ($_GET['s']=="0"){ // 停止工作,但不退出
$s="false";
echo "Function is off";
}
elseif ($_GET['s']=="1"){ // 工作
$s="true";
echo "Function is on";
}
elseif ($_GET['s']=="2"){ // 退出
$s="die";
echo "Function exited";
}
else
die("Err 0:stop working 1:working 2:exit");
$string = "<?php\n return \"".$s."\";\n?>";
write_inc($key_file,$string,true);
exit();
}
if(file_exists($key_file)){
do{
$mkey = include $key_file;
if ($mkey=="true"){ // 如果工作
///////////////////// 工作区间 //////////////////////////////////
$showtime=date("Y-m-d H:i:s");
$fp = fopen('func.txt','a');
fwrite($fp,$showtime."\n");
fclose($fp);
///////////////////////////////////////////////////////////////////
}
elseif ($mkey=="die"){ // 如果退出
die("I am dying!");
}
sleep($interval); // 等待$interval分钟
}while(true);
}
else
die($key_file." doesn't exist !");
function write_inc($path,$strings,$type=false)
{
$path=dirname(__FILE__)."/".$path;
if ($type==false)
file_put_contents($path,$strings,FILE_APPEND);
else
file_put_contents($path,$strings);
}
?>
小米
03/02/2010 12:43
key.txt文件怎么写呢?
Bear 回复于 03/04/2010 10:12
不需要人工配置的,使用的时候用time.php?s=0或1或2来控制。
ukid.openid.35.com
01/18/2010 20:57
openid login test!
Bear 回复于 01/20/2010 03:53
test ok !
分页: 1/1
1
1
飞信API发布
普通手机也来偷农场 可能


19:50


