What is a good alternatives to http_referrer?
I have an edit script on my site where the admin (almost always myself) can edit a page and submit the changes. The content to be edited may be found on one of two pages. After the information is submitted I have a bit of javascript+php that redirects back to the page that the content was being edited on. The redirect will go to the main page of my site or the archives page.
Recently my redirects stopped working. After some debugging I saw that $_SERVER[HTTP_REFERRER] was returning as blank. I thought this was an issue with my php.ini settings, but then I discovered that it was my browser (Opera) that had decided to turn it off at some point. I didn't know my browser could do that. Since it can I have decided to look into alternatives to HTTP_REFERRER.
After enabling it in my browser for the time being I did a small test with:
Code:
<script type="text/javascript">
document.write(location.referrer);
document.write(document.referrer);
</script>
resulting in:
undefinedhttp://www.mysite.com/testa.php
as opposed to when Opera has "send referrer information" unchecked.
The offending code I was using that caused me to look into this in the first place was:
Code:
<script type="text/javascript">
window.location = "<?php print $url; ?>"
</script>
where $url was empty. Is there any error in the small snippet of code above? The above, if echoed, is causing my server to shut down for approximately 5+ minutes, which is silly. I could contact my hosting service, but I figure if I can debug this on my own with an alternative to HTTP_REFERRER I'll forget contacting my hosting service. They are not nearly as useful in customer service as they have been.
Bookmarks