Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 04-06-2007, 01:06 PM   #1
pornmasta
Too lazy to set a custom title
 
pornmasta's Avatar
 
Join Date: Jun 2006
Posts: 19,193
I need a php script to limit download

I want that to rpevent that a user download more that (let's say) 3 files in a day.
And i need a php script to do this.

Does someone has a free solution ?
pornmasta is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-06-2007, 02:27 PM   #2
misfit138
Registered User
 
Join Date: Nov 2006
Posts: 2
you can use php sessions... example;

<?php
session_start();

if (!session_is_registered('count')) {
session_register('count');
$count = 1;
} else {
$count++;
}
?>
<?
if ($_SESSION['count']>="3") {
?>you have reached you download limit...etc...
<? } else { ?>download code here<? } ?>

hope this helps ;)
misfit138 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-06-2007, 04:28 PM   #3
pornmasta
Too lazy to set a custom title
 
pornmasta's Avatar
 
Join Date: Jun 2006
Posts: 19,193
in fact i programmed this:

Code:
<?php

$fifi = @$_GET['file'];
$dlimit = 2;
$tlimit = 86400;

if (!$fifi) {echo "error"; exit;};


$sites[1] = array("somewhere", "somewhere");
$sites[2] = array("somewhere", "somewhere");
$sites[3] = array("somewhere", "somewhere");





function dl_file_resume($fi1,$fi2)
{

//$tailleFichier = remote_file_size($fi1);
header('Content-Type: application/octet-stream');
//header("Content-Length: $tailleFichier");
header("Content-Disposition: attachment; filename=\"$fi2\"");
readfile($fi1,$fi2);
}





if (isset($_COOKIE['TimeCookie'])) {
   foreach ($_COOKIE['TimeCookie'] as $name => $value) {


if ($value<$dlimit) { 
     // echo "$name : $value <br />\n";



setcookie("TimeCookie[1]", $value+1, time()+$tlimit);

dl_file_resume($sites[$fifi][0],$sites[$fifi][1]);



}
else {echo "Download limit reached, try again 24 hours after your last download";
exit;
}
   }
}
else {

$value = '1';

setcookie("TimeCookie[1]", $value, time()+$tlimit);  /* expire dans une heure */

dl_file_resume($sites[$fifi][0],$sites[$fifi][1]);

}


?>
pornmasta is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.