alessiaass Posted March 13, 2015 Share Posted March 13, 2015 Is it possible to keep track of users that have clicked on the link? <?php echo "<a href=\"http://site.com/downloads/$_GET[f]\" target=\"_blank\">Click Here to start downloading</a>"; echo "Please do NOT close this page until your file starts downloading!"; echo "\n"; $url = "refresh:5; url=http://youarelazytoclick.com"; header($url) ?> I want to heve logs of user IP, date and $_GET, For example like this one: 03.13.2015 9:57am 41.36.xxx.xxx awp.rar 03.13.2015 10:00am 223.207.xxx.xxx file.rar 03.13.2015 11:44am 202.142.xxx.xxx example.rar 03.13.2015 12:05pm 82.122.xxx.xxx winter_v1.rar 03.13.2015 12:07pm 176.26.xxx.xxx ausscatter.rar 03.13.2015 12:12pm 109.95.xxx.xxx nailgun.rar 03.13.2015 12:33pm 46.63.xxx.xxx lol.rar 03.13.2015 12:51pm 71.104.xxx.xxx kingdom.zip 03.13.2015 1:10pm 92.16.xxx.xxx thunderstorm.rar Setup: Users will click on site1.com/download/download.zip will be redirected to site2.com/waitfile.php?f=site1.com/download/download.zip (.htaccess) where information will be displayed (I want logs of this page) In waitfile.php will be a CLICK HERE button and users will be redirected to site3.com/download/download.zip where download will start. Link to comment https://forums.phpfreaks.com/topic/295209-logs-of-users-that-clicked-on-link/ Share on other sites More sharing options...
requinix Posted March 13, 2015 Share Posted March 13, 2015 How about your server access logs? Link to comment https://forums.phpfreaks.com/topic/295209-logs-of-users-that-clicked-on-link/#findComment-1508004 Share on other sites More sharing options...
alessiaass Posted March 13, 2015 Author Share Posted March 13, 2015 How about your server access logs? I want logs in a file, waitfile.log for example Link to comment https://forums.phpfreaks.com/topic/295209-logs-of-users-that-clicked-on-link/#findComment-1508009 Share on other sites More sharing options...
requinix Posted March 13, 2015 Share Posted March 13, 2015 Server access logs generally are in a file. But whatever. Make waitfile.php write to a log itself. Build a string with the information you want, like $line = date("m.d.Y h:ia ") . $_SERVER["REMOTE_ADDR"] . $filename;then write to the file with file_put_contents with the append flag. Make sure you don't take the $filename blindly from $_GET - you should make sure it looks valid (like http://site1.com/download/) before writing it to a file. Link to comment https://forums.phpfreaks.com/topic/295209-logs-of-users-that-clicked-on-link/#findComment-1508022 Share on other sites More sharing options...
alessiaass Posted March 14, 2015 Author Share Posted March 14, 2015 Here is the code I found define('LOG_FILE','wait.log'); define('LOG_DOWNLOADS',true); $fname = basename($_GET['f']); if (!LOG_DOWNLOADS) die(); $f = @fopen(LOG_FILE, 'a+'); if ($f) { @fputs($f, date("m.d.Y g:ia")." ".$_SERVER['REMOTE_ADDR']." ".$fname."\n"); @fclose($f); } and the output 03.13.2015 8:28pm 79.106.xxx.xxx download.zip Is it possible to log downloads after link has been clicked, or add another colum if CLICK HERE has been clicked, for ex: 03.13.2015 8:28pm 79.106.xxx.xxx download.zip clicked or 03.13.2015 8:28pm 79.106.xxx.xxx download.zip skipped Link to comment https://forums.phpfreaks.com/topic/295209-logs-of-users-that-clicked-on-link/#findComment-1508029 Share on other sites More sharing options...
requinix Posted March 14, 2015 Share Posted March 14, 2015 Make that link go through a PHP script as well. waitfile.php can handle it too. I figure you can have the same URL as before but with an added value in the query string indicating it's the "click here" link, and you log those requests a little differently. Link to comment https://forums.phpfreaks.com/topic/295209-logs-of-users-that-clicked-on-link/#findComment-1508030 Share on other sites More sharing options...
alessiaass Posted March 14, 2015 Author Share Posted March 14, 2015 Make that link go through a PHP script as well. waitfile.php can handle it too. I figure you can have the same URL as before but with an added value in the query string indicating it's the "click here" link, and you log those requests a little differently. And, how do i do that? Link to comment https://forums.phpfreaks.com/topic/295209-logs-of-users-that-clicked-on-link/#findComment-1508031 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.