<?php include("dh.php"); 
include("../sql/conn.php");
include("yz.php"); 
$llym = $_SERVER["HTTP_REFERER"];
////$mulu=dirname(__FILE__);////获得当前目录
$mulu = 'jhrw';
?>



<?php
if ($_GET['sc']=="sc")
{
$oldname = "jhrw/".$_GET['id'].".txt";
unlink($oldname);
?>
<script language="javascript">setTimeout(function (){location.href='<?php echo $llym; ?>';},2);</script>
<?}
?>







<?php
if ($_GET['jh']=="jh")
{
////////////////////////////////////////////////////////////////////////
$_POST['y'] = sprintf("%04d", $_POST['y']); 
$_POST['m'] = sprintf("%02d", $_POST['m']); 
$_POST['d'] = sprintf("%02d", $_POST['d']); 
$_POST['h'] = sprintf("%02d", $_POST['h']); 
$_POST['i'] = sprintf("%02d", $_POST['i']); 
$time = $_POST['y'].$_POST['m'].$_POST['d'].$_POST['h'].$_POST['i']."00"; ///////收集时间结构
$time = strtotime($time) ;///////时间转为时间戳
mkdir("jhrw");////创建目录

if($_POST['sj']=='')
{
$_POST['sj'] = ' ';
}

$_POST['sj'] = strip_tags($_POST['sj']); //////过滤超文本标签
$TxtFileName = "jhrw/".$time.".txt"; 
if( ($TxtRes=fopen ($TxtFileName,"w+")) === FALSE){ 
    exit(); 
} 
    $StrConents = $_POST['sj'];//要 写 进文件的 内容 
if(!fwrite ($TxtRes,$StrConents)){ //将信息写入文件 
        fclose($TxtRes); 
        exit();        
}  
fclose ($TxtRes); //关闭指针 
?>
<script language="javascript">setTimeout(function (){location.href='<?php echo $llym; ?>';},2);</script>
<?////////////////////////////////////////////////////////////////////////
}
?>





















<?php

$sz = ListFiles($mulu);
foreach($sz as $v)/////////循环出所有的.txt/////依靠上边的函数支持///
{
$v = str_replace($mulu,"",$v);
$v = str_replace("/jhrw/","",$v);
$v = str_replace("/","",$v);
$v = str_replace(".txt","",$v);
echo "　";
if($noww < $v)
{
echo date("Y年m月d日H:i",$v);
}
elseif($noww > $v)
{
echo "<strong>";
echo date("Y年m月d日H:i",$v);
echo "</strong>";
}
echo "事件：<textarea name=sj rows=1 cols=38>";
include("jhrw/".$v.".txt");
echo "</textarea>";
echo "　<a href=?sc=sc&id=".$v." ";
?>onClick="return confirm('确定删除')"<?php
echo " >删除</a>　";
echo "<br>";
}
?>



<hr>
<form action=?jh=jh method=post>
　新增加计划任务　　｜时间：
<input name="y" type="text" value="<?php echo date("Y"); ?>" size="5" />年
<input name="m" type="text" value="<?php echo date("m"); ?>" size="5" />月
<input name="d" type="text" value="<?php echo date("d"); ?>" size="5" />日
<input name="h" type="text" value="<?php echo date("H"); ?>" size="5" />时
<input name="i" type="text" value="<?php echo date("i"); ?>" size="5" />分
事件：<textarea name=sj rows=1 cols=38></textarea>
<input type=submit value=新增 />
</form>
<hr>

<textarea cols="88" rows="3">此处可以增加计划任务，用于提醒按时处理定时任务，如生日，服务器到期，广告到期等。
一分钟只能建立一个事件
</textarea>

<?php include("../sql/close.php"); ?>