Topic: Help with php, mysql or htaccess download limit restriction. (Read 735 times)
Google dot what?
Posts: 2
20 credits Members referred : 0
« on: Dec 15, 2012, 03:11:11 am »
hi, i read a couple of topics here and this is a nice site, just than i thought this site have not to many people inside but i hope here be someone who can help me with my issue...
well i have a forum and i integrate the Autoindex PHP Script and works fine... but i could not configure a Download Number Limit... i want than each user just can download 5 files per day... i found this script:
<?php
$path = addslashes($_SERVER['REQUEST_URI']); $ip = addslashes($_SERVER['REMOTE_ADDR']); $dl = false; $sql = sprintf("SELECT UNIX_TIMESTAMP(last_access) last_time FROM downloaded WHERE filepath = '%s' AND ipadres = '%s' ORDER BY last_access DESC", $path, $ip); $res = mysql_query($sql); if (mysql_num_rows($res) > 0) { $last_xs = mysql_result($res, 0, 'last_time')+3600; if ($last_xs < time()) { mysql_query(sprintf("REPLACE downloaded SET filepath = '%s', ipadres = '%s', last_access = NOW()", $path, $ip)); $dl = true; } } else { $sql = sprintf("REPLACE downloaded SET filepath = '%s', ipadres = '%s', last_access = NOW()", $path, $ip); mysql_query($sql); $dl = true; }
?> and really works but just limit the time for download the same file but if you keep downloading all other files are not any restiction, so i need to make a restiction for IP (restriction for User must be better) so there is my question, so i hope somebody check it out and want help me.
thanks in advance.
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=16410