helloi need to log referrer for visitors the links like: http://localhost/hello.php?session=aGVsbG8gZGlnaXRhbHBvaW50== i want to log the url and the (decodded) base64 code: aGVsbG8gZGlnaXRhbHBvaW50== to file.txt or something so the file.txt will have: url: http://localhost/hello.php?session=aGVsbG8gZGlnaXRhbHBvaW50== session: aGVsbG8gZGlnaXRhbHBvaW50== decodded_session: hello digitalpoint thanks for help me
Enjoy! Is secure and works, I tested. See live at: http://lamp-developer.com/logdecode.php?session=VGhpcyBpcyBhIHRlc3Qh See the log here: http://lamp-developer.com/log.html Please remember I am for hire! I can code anything and if it is a language I can't, I probably know somebody who can. This will log each entry to log.txt one after the other separated by *****************. You MIGHT need to chmod 666 the log. I don't have to but you might. <?php if (!empty($GET['session'])) { die('Not all data that is required was entered. I Quit!'); } else { if (!function_exists('curPageURL')) { function curPageURL() { $isHTTPS = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on"); $port = (isset($_SERVER["SERVER_PORT"]) && ((!$isHTTPS && $_SERVER["SERVER_PORT"] != "80") || ($isHTTPS && $_SERVER["SERVER_PORT"] != "443"))); $port = ($port) ? ':'.$_SERVER["SERVER_PORT"] : ''; $url = ($isHTTPS ? 'https://' : 'http://').$_SERVER["SERVER_NAME"].$port.$_SERVER["REQUEST_URI"]; return $url; } } $path = htmlspecialchars(strip_tags(trim(curPageURL()))); $session = htmlspecialchars(strip_tags(trim($_GET['session']))); $session_decoded = base64_decode($session); if (!function_exists('doLog')) { function doLog($mess) { $logFUN = fopen('log.html', 'a+'); fwrite($logFUN, $mess); fclose($logFUN); } } $log .= ' <div style="clear:both;margin-top:10px;border-bottom:1px solid #000000;"> <div style="clear:both;line-height:21px;">URL: ' . $path . '</div> <div style="clear:both;line-height:21px;">SESSION: ' . $session . '</div> <div style="clear:both;line-height:21px;">SESSION DECODED: ' . $session_decoded . ' </div> </div> '; doLog($log); } echo $log; ?> Code (markup): Just edit the style value to alter the look.
And please give me a +1 reputation by clicking the thumbs up pic at the bottom left of my post. Thank mate.