Hi, I'm trying to create a splash page effect on a site I'm working on (I know splash pages are bad etc but I have my reasons), and basically I want to call the script that runs the splash image overlay only if the visitor is coming to the index from an external website. That way if a visitor clicks "home" from an internal page the splash won't launch. I've been searching about and it seems like I can do this with php using $_SERVER['HTTP_REFERER'], but I'm brand new to php and after playing with it all afternoon can't seem to make it work.
The following code loads the script but it doesn't seem to care if the referring URL contains "mysite" and an error message appears at the top of the page reading:
"A PHP Error was encountered
Severity: Notice
Message: Undefined index: HTTP_REFERER
Filename:..."
<?php
$referrer=$_SERVER['HTTP_REFERER'];
if(stristr($referrer, "mysite") == FALSE) {
echo '
<script type="text/javascript">
$(document).ready(function() {
$("#wrapper").hide();
$("#imgContainer").npFullBgImg("/imgs/splash_image.jpg", {fadeInSpeed: 2000, center: true});
$("#logoContainer").fullLogoImg("/imgs/splash_logo.png", {fadeInSpeed: 2000, center: true});
$("#logoContainer").click(function(){
$("#wrapper").show("fast");
$("#splash_kill").remove();
$(this).remove();
});
});
</script>';
}
?>
Any help would be much appreciated. Thanks!