bigun Posted June 27, 2006 Share Posted June 27, 2006 I'd like to be able to tell when a download is finished downloading by a user. I've googled until my eyes are dry, and I've had no luck.Or if anyone can tell me how to make a link that will allow someone to download a file, then after it is finished the link will go dead. Quote Link to comment https://forums.phpfreaks.com/topic/13055-tracking-downloading-with-php/ Share on other sites More sharing options...
redarrow Posted June 27, 2006 Share Posted June 27, 2006 [!--quoteo(post=388650:date=Jun 27 2006, 09:27 PM:name=bigun)--][div class=\'quotetop\']QUOTE(bigun @ Jun 27 2006, 09:27 PM) [snapback]388650[/snapback][/div][div class=\'quotemain\'][!--quotec--]Or if anyone can tell me how to make a link that will allow someone to download a file, then after it is finished the link will go dead.[/quote]In the database have.users_idtimedateusers_ipdownloadeddowload[code]<?session_start(); //if user session is present and is set as $user_id//select database$db=mysql_connect("localhost","name","password" );mysql_select_db($db);// query the database if the user is in the database where user_id=$user_id.$query="select * from downloads where time=$time and date=$date anduser_ip=$user_ip and user_id=$user_id";$result=mysql_query($query);// if the user is not in the database then let them see the link and down load.if(mysql_num_rows($result)==0)) {$time=date("his");$date=date("dmy");$user_ip=$_SERVER['REMOTE_ADDR']:?><a href="download_result?&user_id=$user_id&time=$time&date=$date&user_ip=$user_ip">download file</a><?//else if the user is in the database echo sorry message.}else{echo "sorry you have downloaded already";}[/code]I tried ok. Quote Link to comment https://forums.phpfreaks.com/topic/13055-tracking-downloading-with-php/#findComment-50240 Share on other sites More sharing options...
Travis Estill Posted June 27, 2006 Share Posted June 27, 2006 You can't really accomplish that with PHP. You need something like a Java applet or Flash that has interaction on the user end. PHP isn't designed to do that. Quote Link to comment https://forums.phpfreaks.com/topic/13055-tracking-downloading-with-php/#findComment-50243 Share on other sites More sharing options...
bigun Posted June 27, 2006 Author Share Posted June 27, 2006 Ehh... not quite as clean as I hoped it would be...Is there some way to maybe have a timer that only allows the link to be good for 30 minutes or so? Quote Link to comment https://forums.phpfreaks.com/topic/13055-tracking-downloading-with-php/#findComment-50245 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.