Lol5916 Posted September 8, 2008 Share Posted September 8, 2008 Here's the error: Notice: Undefined index: HTTP_REFERER in /home/*******/public_html/******/referer2.php on line 5 Script is: <?php ini_set('display_errors', 1); error_reporting(E_ALL); $line = ('------------------------------------------'); $ref = $_SERVER['HTTP_REFERER']; $ip = $_SERVER['REMOTE_ADDR']; $d = date('l dS \of F Y h:i:s A'); $mes = '<br>Referer: '.$ref."<br>"; $mes = 'IP: '.$ip."<br>"; $mes = "Date & Time: ".$d."<br>"; $mes = ".$line."; $file = "logger.html"; $fh = fopen($file, "a"); fwrite ($fh, "$mes\n"); fclose($fh); ?> What's the problem? Link to comment https://forums.phpfreaks.com/topic/123328-variable-error/ Share on other sites More sharing options...
shedokan Posted September 8, 2008 Share Posted September 8, 2008 maybe it's because no page has reffered to this one. try to make a page which redirects to that page and see whether it's the problem or not. Link to comment https://forums.phpfreaks.com/topic/123328-variable-error/#findComment-636947 Share on other sites More sharing options...
Lol5916 Posted September 8, 2008 Author Share Posted September 8, 2008 Nope, that's not the problem. Link to comment https://forums.phpfreaks.com/topic/123328-variable-error/#findComment-636950 Share on other sites More sharing options...
toivo Posted September 8, 2008 Share Posted September 8, 2008 This is not an error but a notice only, and there are ways to turn them off if you want. Depends on how tidy you want your code to be, of course. Before you refer to the value in the array, you need to check if it is set. Not all user agents set the value for $_SERVER['HTTP_REFERER']. Link to comment https://forums.phpfreaks.com/topic/123328-variable-error/#findComment-636953 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.