Jump to content


Photo

Tracking Downloading With Php


  • Please log in to reply
3 replies to this topic

#1 bigun

bigun
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 27 June 2006 - 09:27 PM

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.


#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 27 June 2006 - 10:07 PM

[!--quoteo(post=388650:date=Jun 27 2006, 09:27 PM:name=bigun)--][div class=\'quotetop\']QUOTE(bigun @ Jun 27 2006, 09:27 PM) View Post[/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_id
time
date
users_ip
downloaded

dowload


<?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 and
user_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";

}

I tried ok.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 Travis Estill

Travis Estill
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 27 June 2006 - 10:24 PM

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.
Freelance Web Developer with a focus on PHP/MySQL

Angel-Stones.com
ClanQ3.com

#4 bigun

bigun
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 27 June 2006 - 10:28 PM

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?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users