31, August 2014

Help with php, mysql or htaccess download limit restriction. - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: Help with php, mysql or htaccess download limit restriction.
« previous next »
Pages: [1] Print
Instabuck - The easy way to sell digital products online

Author Topic: Help with php, mysql or htaccess download limit restriction.  (Read 2237 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) &gt; 0) {
   $last_xs = mysql_result($res, 0, 'last_time')+3600;
   if ($last_xs &lt; 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
Bookmark this thread : Digg Del.icio.us Dzone more....

Instabuck - The easy way to sell digital products online
Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: Help with php, mysql or htaccess download limit restriction.
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Aug 31, 2014, 12:13:45 pm





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!






Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2014 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.