Topic: How to Limit the download every month. (Read 458 times)
Google dot what?
Posts: 2
16 credits Members referred : 0
« on: Jul 08, 2008, 12:19:55 PM »
I need to find a script that will let me set the download limit for each separate file per day, which will reset every 24 hours.
e.g Members can only download 3 video clips per day.
Thanks! Help will highly appreciated!
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 8272
42619 credits Members referred : 3
« Reply #1 on: Jul 08, 2008, 12:25:03 PM »
I guess it wont be too hard to write such a script yourself. Just keep in a field in your db how many files a user downloaded, and then reset it everyday.
Google dot what?
Posts: 2
16 credits Members referred : 0
« Reply #2 on: Jul 11, 2008, 07:13:18 AM »
how about this error i was encountering.. i try to upload the script on my webhost but the thumbnails doesn't appear because it is corrupt also the downloaded clips were also corrupt.. i was wondering if there is an error on the script that i've maid.. and how can i mask the download url of that files...
these are the script i made..
index.php
<?php include ("../includes/connect.inc"); $vid_id = $_REQUEST['fileid']; $dl_vid = mysql_query("SELECT * FROM tbl_videos WHERE vid_id = '$vid_id'") or die(mysql_error()); $file = mysql_fetch_array($dl_vid); $loc = $file['vid_url']; header ("Location: ../$loc"); ?>
connect.inc
<?php $db = mysql_connect("localhost","username","password") or die("Could not connect to the database!"); mysql_select_db("username_dbvideos",$db); ?>
//validation 1: if more that 10 dls $ret_history = mysql_query("SELECT * FROM tbl_user WHERE usr_ip = '$usr_ip'") or die(mysql_error()); $count = mysql_num_rows($ret_history);
//validation 2: verify repeated downloads - di pede $dl_file = mysql_query("SELECT * FROM tbl_user WHERE usr_ip = '$usr_ip' AND vid_id = '$vid_id'") or die(mysql_error()); $dl_count = mysql_num_rows($dl_file);
//validation 1 if ($count >= 10) { ?> <span class="style7">You have reached your maximum downloads for this month!</span> <?php //validation 2 } else if ($dl_count > 0) { ?> <span class="style7">You have already downloaded this file!</span> <?php } else {
//get video url $dl_vid = mysql_query("SELECT * FROM tbl_videos WHERE vid_id = '$vid_id'") or die(mysql_error()); $file = mysql_fetch_array($dl_vid); ?> <div align="center"<a href="file/?fileid=<?php echo $file['vid_id']; ?>" class="style1 style2"><br /><br /><br /><br /><br />Download Now</a><br /><br /> <span class="style4">Warning !!! </span><br /> <span class="style3">Don't refresh this page or click back button while downloading.. The validation will expire after the download finish.</span> <?php //note this valid download to database
mysql_query("INSERT INTO tbl_user VALUES ('$usr_ip','$vid_id','$date')") or die(mysql_error());