On Thu, Jun 26, 2008 at 8:38 AM, szalinski <[EMAIL PROTECTED]> 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.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to