php防止刷新,流量攻击的一段代码

<?php

//查询禁止IP

$ip =$_SERVER['REMOTE_ADDR'];

$fileht=".htaccess2";

if(!file_exists($fileht))file_put_contents($fileht,"");

$filehtarr=@file($fileht);

if(in_array($ip."\r\n",$filehtarr))die("Warning:"."<br>"."Your IP address are forbided by some reason, IF you have any question Pls emill to shop@mydalle.com!");

//加入禁止IP

$time=time();

$fileforb;

file_put_contents($file,$str);