LeeS Posted March 22, 2012 Share Posted March 22, 2012 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? Quote Link to comment https://forums.phpfreaks.com/topic/259528-add-to-database-when-user-downloads-a-file/ Share on other sites More sharing options...
samshel Posted March 22, 2012 Share Posted March 22, 2012 Create a PHP file which accepts the download path as parameter. Link the download to this PHP file. the PHP file will increment the counter or do whatever action you want and then redirect to the download path. Quote Link to comment https://forums.phpfreaks.com/topic/259528-add-to-database-when-user-downloads-a-file/#findComment-1330356 Share on other sites More sharing options...
LeeS Posted March 22, 2012 Author Share Posted March 22, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/259528-add-to-database-when-user-downloads-a-file/#findComment-1330359 Share on other sites More sharing options...
litebearer Posted March 22, 2012 Share Posted March 22, 2012 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) Quote Link to comment https://forums.phpfreaks.com/topic/259528-add-to-database-when-user-downloads-a-file/#findComment-1330362 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.