php提交参数过滤重复内容

<?php
//获取网址参数
$post = $_REQUEST['post'];
//指定文件
$filename= $_REQUEST['chi'];
$filename= "$filename.txt";
//判断文件是否存在
if(file_exists("$filename"))
{
//如果存在 获取文件内容
$content = file_get_contents($filename);
//对比是否重复 
if(strstr($content,$post))
{
//如果重复输出重复
echo "no";
}
else
{
//如果不重复 指向文件末尾
$handle=fopen($filename,"a+");
//追加写入不重复的参数内容
$str=fwrite($handle,"$post\r\n");
//关闭
fclose($handle);
//输出可用
echo "ok";
}
}
else
{
//如果文件不存在 直接写入参数内容
$handle=fopen($filename,"a+");
$str=fwrite($handle,"$post\r\n");
//关闭
fclose($handle);
//输出可用
echo "ok";
}
?>

定时任务设置:

#定时删除

#centos 每天0点
crontab -e
0 0 * * * rm -rf /文件目录/*.txt

:: windows 定时用计划任务调用
@echo off
del *.txt
exit