Time limit between searches?
mdb Offline
Junior Member
**
Posts: 27
Joined: May 2012
Post: #5
RE: Time limit between searches?
Thanks Zinga,

I tried this:

PHP Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
	
$limit = 10;
session_start();
if (isset($_SESSION['ip']) && $_SESSION['last_search'] + $limit < time()) {
	$nosearch = "Please wait {$limit} seconds between searches";
}
else {
	$_SESSION['last_search'] = time();
	$_SESSION['ip'] = $_SERVER['REMOTE_ADDR'];
	while($banres = mysql_fetch_array( $data )) 
	{
		// fetching sql data
	}
}

However I can't figure out what is wrong with this code. It is basically ignoring my first if statement and always returning $nosearch as well going through my while loop, Can you spot what i'm doing wrong?

(This post was last modified: 08-02-2012 04:42 PM by mdb.)
08-02-2012 04:38 PM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
Time limit between searches? - mdb - 08-01-2012, 03:43 PM
RE: Time limit between searches? - Sama34 - 08-01-2012, 05:47 PM
RE: Time limit between searches? - mdb - 08-02-2012, 05:13 AM
RE: Time limit between searches? - mdb - 08-02-2012 04:38 PM
RE: Time limit between searches? - mdb - 08-03-2012, 04:02 AM
RE: Time limit between searches? - mdb - 08-03-2012, 09:48 AM

 Standard Tools
Forum Jump: