Jump to content

[SOLVED] PHP Flood Protection scripts that uses flat file databases?


RickyF

Recommended Posts

Hey,

 

Does anyone know of any php flood protection scripts that use a flat file database rather than mysql, and if so could you provide the link to it or something please?

 

I found a free flood protection class, but it uses mysql, i was wondering, is it possible for flat file database to remove an ip after a period of time, as can be done with mysql?

 

This is the mysql one i found: http://www.phpclasses.org/browse/package/2595.html

 

 

Thanks for any help!

Hi,

 

The code i have is only for a mysql based script, it is a flat file version of the code i have that am in search for.

 

The code can be implemented into scripts easily (http://www.phpclasses.org/browse/package/2595.html) i was wondering if the same thing is available elsewhere but uses flat file.

heres a quick example it may help

 

<?php
session_start();
?>
<form method="post">
<textarea name="msg">test</textarea>
<input name="submit" type="submit" value="ok">
</form>

<?php
$delay = 10; //seconds
if(isset($_POST['submit']))
{
//protection
$wait = ($_SESSION['posttime']+$delay) - time();
if(!isset($_SESSION['posttime']) || $wait <=0 )
{
	$_SESSION['posttime'] = time();
	echo $_POST['msg'];
}else{
	die("flood protections active..<br>wait $wait seconds");
}
}


?>

 

 

 

Edit:

As a side note if you don't use a login system then you can't truely stop flooding, only make it harder.

only practcal method is force any posting to login.

 

When they post store the user id and time of post. Next post search for the last occurence of that user name in the file string and you should be able to grab the whole record - extract the time of post and compare it to the present then allow/deny based on time between...

totally agree with you ToonMariner.. but if its a simple comment box at the bottom of a artical then a captcha would work.... maybe add a timestamp to stop repeats but more people just click the submit button 200times.. thus i put the sesssion code  :-\

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.