Solved

Controlling number of user searches

Posted on 2008-06-26
5
172 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Thoughout my experience working on eCommerce web applications I have seen applications succumbing to increased user demand and throughput. With increased loads the response times started to spike, which leads to user frustration and lost sales. I ha…
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

726 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