Current location: Hot Scripts Forums » Programming Languages » PHP » How to make max connection limit per ip using php?


How to make max connection limit per ip using php?

Reply
  #1 (permalink)  
Old 08-25-05, 05:44 PM
Osjur Osjur is offline
New Member
 
Join Date: Aug 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
How to make max connection limit per ip using php?

so is it possible to make max connections per ip script using php... like so that users cant dl more than 2 files at a same time.

and if it is: how to do it?
Reply With Quote
  #2 (permalink)  
Old 08-26-05, 05:43 AM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
you could do that by storing the IP of the user in the DB.. and add 1 for each new download of that IP.
once you reach the limit, disable downloading!
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
Reply With Quote
  #3 (permalink)  
Old 08-26-05, 06:09 AM
<?Wille?> <?Wille?> is offline
Junior Code Guru
 
Join Date: Jan 2004
Location: Helsinki, Finland
Posts: 666
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by NeverMind
you could do that by storing the IP of the user in the DB.. and add 1 for each new download of that IP.
once you reach the limit, disable downloading!
I was thinking about the same tihing. My main problem about getting a answer to this is he wants to limit max number of simultainius downloads. Storing ip in DB, yea, but how to define when the download is compleate to reopen the download possibility?
Reply With Quote
  #4 (permalink)  
Old 08-26-05, 04:49 PM
Keith's Avatar
Keith Keith is offline
Community Liaison
 
Join Date: Feb 2004
Posts: 1,232
Thanks: 1
Thanked 11 Times in 11 Posts
Maybe only store the IPs for a minute or so, then have it expire.
Reply With Quote
  #5 (permalink)  
Old 08-26-05, 07:16 PM
shadi's Avatar
shadi shadi is offline
Wannabe Coder
 
Join Date: Aug 2004
Location: EGY
Posts: 145
Thanks: 0
Thanked 0 Times in 0 Posts
PHP Code:

 
// lets log the IP.
 
mysql_query("insert into log_ip values('$ip') ");
 
while(
$output .=fread("myfile.exe"))
{
  echo 
$output;
}
 
// the download is complete now lets remove the ip
 
mysql_query("delete from log_ip where ip_field = '$ip' "); 
I hope this example help

Regards,
__________________
Email : write2shadi at gmail dot com
MSN : write2shadi at gmail dot com
Aim : shadiaim7
Skype: shadi_skype
Reply With Quote
  #6 (permalink)  
Old 03-20-06, 04:17 PM
convinceme convinceme is offline
New Member
 
Join Date: Mar 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
ahmm can someone tell me how to use this
Code:
while ($output .= fread("c:\hello.zip")) { echo $output; }
thingy coz i cant really figure out as it doesnt work for me when forcing user to download a file using headers because when i use it no output is displayed it just forces the download seems as if this part of code aint working
help in this regard would be highly appretiated
Reply With Quote
  #7 (permalink)  
Old 03-20-06, 05:32 PM
KeYBLeR KeYBLeR is offline
Newbie Coder
 
Join Date: Jan 2006
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
That sounds like how you would give someone a virus!
Forcing a download.

Last edited by KeYBLeR; 03-20-06 at 05:33 PM. Reason: MORE
Reply With Quote
  #8 (permalink)  
Old 04-01-06, 12:32 AM
convinceme convinceme is offline
New Member
 
Join Date: Mar 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
yeh i wanna give someone virus and i am gonna appoint u as ma beta tester
doh! thts for hosting songs forcing a download on popup using header!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP multi-dimensional array sorting issue aqw PHP 2 06-24-05 11:09 PM
Do PHP can make a user base update web site whitout Database? explorer1979 PHP 5 04-23-05 05:08 AM
How to Make my Php output write static Html files cebuy PHP 1 02-04-05 05:52 AM
ASP syntax error stuckonaproject ASP 8 12-14-04 10:30 AM


All times are GMT -5. The time now is 07:04 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.