Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Restristicting user after 30 hits/searchees......need help.
Old 05-14-2010, 05:36 AM Restristicting user after 30 hits/searchees......need help.
Isabella_Smith's Avatar
Ultra Talker

Posts: 285
Trades: 0
Hi Guys...

I want to create an script which restricts users IP.....as soon as he made 30 searches......

I know how to track ip.....but how can I restrict by counting 30 searches.

Any of your help would be highly appreciated.

Thanks!!
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
buy all indian salwar Kameez, Sarees and clothes
Isabella_Smith is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-14-2010, 07:21 AM Re: Restristicting user after 30 hits/searchees......need help.
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Store the IP in a database, increment a count on each search then redirect when it reaches 31.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-14-2010, 08:40 AM Re: Restristicting user after 30 hits/searchees......need help.
Isabella_Smith's Avatar
Ultra Talker

Posts: 285
Trades: 0
its fine thanks
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
buy all indian salwar Kameez, Sarees and clothes

Last edited by Isabella_Smith; 05-14-2010 at 08:48 AM..
Isabella_Smith is offline
Reply With Quote
View Public Profile
 
Old 05-15-2010, 02:38 PM Re: Restristicting user after 30 hits/searchees......need help.
Novice Talker

Posts: 9
Trades: 0
More explanatory examples would be:

Wherever you choose to put this, is ok as long as it's included in a global way
[php]
function getRealIpAddr()
{
if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet
{
$ip=$_SERVER['HTTP_CLIENT_IP'];
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy
{
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}
else
{
$ip=$_SERVER['REMOTE_ADDR'];
}
return $ip;
}
[
/php]

Then somewhere in your tracking preperations
PHP Code:
$guest_ip getRealIpAddr(); 
From here you can handle this multiple ways, but two examples of storing and tracking the IP address is this.
- A db insert for EACH time an IP has viewed the system.
- A db insert with an a UNIQUE entity, then UPDATE the db with a db call to see how many times that IP's been logged and calling it ip_logged['count']; and do some basic math $ip_logged_new = $ip_logged['count']+1; from there we can ip_logged_times='".$ip_logged_new."' WHERE ip_logged_id='".$guest_ip."'

Either way, when the page loads you can do a basic check of settings to see if

We want to run $ip_logged['count'] against sometime type of settings check, etc.

PHP Code:
   if ($ip_logged['count'] > 30) { // 30 is the amount of views allowed 
     // RUN FUNCTIONS FOR NEEDING TO REGISTER OR WHATEVER YOU WANT
   
// Otherwise continue 
Should be simple enough. If you need help let someone here know!

Last edited by DrewDown; 05-15-2010 at 02:41 PM..
DrewDown is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Restristicting user after 30 hits/searchees......need help.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.48806 seconds with 12 queries