voip03 Posted August 4, 2011 Share Posted August 4, 2011 echo "<td><a href='download/".$dlrow['link']."'> [ Download ] </a> </td>"; when user click the download link , I want to process 1. Capture the user id 2. Start download file Can anyone advice me TIA Quote Link to comment https://forums.phpfreaks.com/topic/243784-download-and-get-user-ip-address/ Share on other sites More sharing options...
trq Posted August 4, 2011 Share Posted August 4, 2011 You would write a download script that logs the user id (from where I don't know as you haven't given us enough details) forces a download (there is an example in Faq/Code Snippet board) Quote Link to comment https://forums.phpfreaks.com/topic/243784-download-and-get-user-ip-address/#findComment-1251726 Share on other sites More sharing options...
voip03 Posted August 4, 2011 Author Share Posted August 4, 2011 <a href='download/downlaod.zip"'> [ Download ] </a> When use click the download link download box will appear. Before the download box I want to get the user id. Quote Link to comment https://forums.phpfreaks.com/topic/243784-download-and-get-user-ip-address/#findComment-1251754 Share on other sites More sharing options...
voip03 Posted August 4, 2011 Author Share Posted August 4, 2011 I am trying using ‘js’ but can tell me any better way. <script type="text/javascript" > function downloadPdf(el) { var iframe = document.createElement("iframe"); iframe.src = "download.php"; iframe.onload = function() { // iframe has finished loading, download has started el.innerHTML = "Download"; } iframe.style.display = "none"; document.body.appendChild(iframe); } </script> <? function call() { //get ip address... echo "Downloading..."; } ?> <a href="download.php" onclick="this.innerHTML='<? call(); ?>'; downloadPdf(this);">Download</a> Quote Link to comment https://forums.phpfreaks.com/topic/243784-download-and-get-user-ip-address/#findComment-1251756 Share on other sites More sharing options...
trq Posted August 4, 2011 Share Posted August 4, 2011 Did you bother to look at the example script I told you about? Quote Link to comment https://forums.phpfreaks.com/topic/243784-download-and-get-user-ip-address/#findComment-1251828 Share on other sites More sharing options...
voip03 Posted August 4, 2011 Author Share Posted August 4, 2011 Faq/Code Snippet board ? can u post the link pl. Quote Link to comment https://forums.phpfreaks.com/topic/243784-download-and-get-user-ip-address/#findComment-1251855 Share on other sites More sharing options...
trq Posted August 4, 2011 Share Posted August 4, 2011 Are you kidding? Quote Link to comment https://forums.phpfreaks.com/topic/243784-download-and-get-user-ip-address/#findComment-1251861 Share on other sites More sharing options...
trq Posted August 4, 2011 Share Posted August 4, 2011 http://www.phpfreaks.com/forums/index.php?board=41.0 Quote Link to comment https://forums.phpfreaks.com/topic/243784-download-and-get-user-ip-address/#findComment-1251863 Share on other sites More sharing options...
voip03 Posted August 4, 2011 Author Share Posted August 4, 2011 thanks Quote Link to comment https://forums.phpfreaks.com/topic/243784-download-and-get-user-ip-address/#findComment-1251891 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.