Jump to content

add to database when user downloads a file


LeeS

Recommended Posts

I would like to be able to add a yes/no to a field in a 'user' database when a logged in user clicks on a link to download a file.

The site I have built stores docs and applications. and my client would like to know which user has downloaded a certain application (clicked on a button to 'download' and installer file.

Is this possible?

Link to comment
Share on other sites

Thanks for the reply, but don't quite understand.

 

I need to be able to show in a 'user profile' that this user has downloaded 'application1' but not downloaded 'application2'

 

I am a newbie, so sorry for not understanding.

 

Lee

Link to comment
Share on other sites

Psuedo code...

page 1
<a href="log_down_load.php?what_file_id<?PHP echo $file1_id; ?>">File 1</a>
<a href="log_down_load.php?what_file_id<?PHP echo $file2_id; ?>">File 2</a>
<a href="log_down_load.php?what_file_id<?PHP echo $file3_id; ?>">File 3</a>
<a href="log_down_load.php?what_file_id<?PHP echo $file4_id; ?>">File 4</a>

log_down_load.php
$what_file = $_GET['what_file'];
$user_id  = $_SESSION['user_id']
connect to database
insert into what_file table the user_id, the what_file_id
header to activate download of appropriate file (see http://www.ryboe.com/tutorials/php-headers-force-download)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.