Solved

Controlling number of user searches

Posted on 2008-06-26
5
171 Views
Last Modified: 2013-12-12
hi,

we are adding a php lookup/search feature on our website (lamp).  This feature searches against a single table in a mysql database.

What methods can I use to limit the number of searches performed by users over a period of time e.g. 10mins?  

thanks!
0
Comment
Question by:jrmajor
  • 3
  • 2
5 Comments
 
LVL 2

Expert Comment

by:JurgenvH
ID: 21878677
Do you have registered users who can search or can everybody search who visits the website?
In the last case you'd best track the seaches bij IP-address. Register the searches in a database.
0
 

Author Comment

by:jrmajor
ID: 21878703
my apologies for not adding this information!

no the feature will be available to all users i.e. there are no registered users.
0
 
LVL 2

Expert Comment

by:JurgenvH
ID: 21878771
Then probably the check on IP-address will be sufficient. It probably doesn't matter how many people download from the same computer, they can't work on it at the same time.
$_SERVER['REMOTE_ADDR'] gives you the IP-address, save this in the database with a download counter
0
 

Author Comment

by:jrmajor
ID: 21878820
ok so I would write the ip address to a table and have an autoincrement field to keep track of the number of searches.

what do you think would be best approach for checking the number of searches over a fixed period of time?
0
 
LVL 2

Accepted Solution

by:
JurgenvH earned 250 total points
ID: 21878975
Say you wish max of 5 downloads in 10 minutes.
Every time a download starts you check if the ip is already present in the table. If not:
- write the ipaddress to a table with 1 as no. of downloads and a timestamp.

If the ip address is found, check timestamp to current time. If the difference is less than 10 minutes:
- increment no. of downloads (no change of timestamp)

If the difference is greater than 10 minutes:
- update no. of downloads to 1 and timestamp to current time
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question