Question : writing lines to htaccess file

Hello,

i have been working on adding some security to my websites, one solution i came up with is if any sql errors occur, i redirect the user to an error page where their IP address is recorded and written to an htaccess file to block their IP.

the problem is that i cant figure how to add new lines to the middle of the existing file, i can just keep overwriting the previous IP

this is my code...
(Also, if you know a better way to  add security, please point me in right direction)
 
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
function blockSQLinjection($theip)
{
$body = "order allow,deny \n" ;
$body .= "deny from".$theip "\n";
$body .= "allow from all";

	$path=".htaccess"; 
	$filenum=fopen($path,"w"); 
	fwrite($filenum,$body); 
	fclose($filenum); 
}

$ip = $_SERVER['REMOTE_ADDR']; 
blockSQLinjection($ip);

Answer : writing lines to htaccess file

IPSEC can add up to 52 bytes per packet of overhead, but in my opinion, it's a waste of brain cells to try to calculate your exact bandwidth requirements based on this. Whatever bandwidth you can get, the VPN overhead will be least of your worries. I would figure 6-8% overhead for encryption.
Random Solutions  
 
programming4us programming4us