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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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  :-\

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.