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?

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)

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.