Re: a download limitation script that defies logic!

From: Date: Thu, 26 Jun 2008 14:23:05 +0000
Subject: Re: a download limitation script that defies logic!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-275980@lists.php.net to get a copy of this message
On Thu, Jun 26, 2008 at 8:38 AM, szalinski <barneytramble@gmail.com> wrote: > > I thought I'd take the time to make a download limitation script, but even > though the idea of this script is 'simple', it 'simply' refuses to work > entirely properly. [snip!] You do realize that the code in this block below is only accessed if $downloads is greater than or equal to $dl_limit_perday, correct? > if($has_hit_dl_limit) > { > if($has_hit_timeout_limit) > { > $dl = false; > print('<h1>Too many downloads today!<br />'); > print "Time limit: {$time_limit}<br />Last time > accessed: {$last_access}<br />"; > print "Time to wait = $time_to_wait seconds</h1>"; > exit; > } > else > { > mysql_query("UPDATE ip_limit SET downloads = 0 WHERE > userip = '$userip'"); > //$dl = true; > } > } > else > { > $dl = true; > } As a result, only when it meets that condition does it set $dl to TRUE for the next block. > if ($dl) > { > mysql_query("REPLACE INTO ip_limit (userip,last_access,downloads) > VALUES ('$userip', NOW(), '$downloads'+1)"); > download_the_file(); > } > else > { > exit, etc > } -- </Daniel P. Brown> Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo.

« previous php.general (#275980) next »