No $HTTP_REFERER at first time visit
Posted: Sat Aug 24, 2002 4:25 am
I have again a question on the printer friendly version script, earlier discussed in this forum at Sat Jul 13, 2002 10:27 pm
http://www.devnetwork.net/forums/viewto ... highlight=
The script needs the $HTTP_REFERER to function properly
This works only when there is a referrer. Anyone coming first time to a page has no referer and in that case the script gives an error.
< fopen("", "r") - Inappropriate ioctl for device > and < not a valid File-Handle resource >
I have been looking for a workaround but either it is impossible or my knowledge is too limited (the latter is definitely sure).
Any help welcome. If there is no workaround the possibility to lead the visitor to a friendly errorpage with explanation would do as well.
I tried to accomplish the latter by
but still get an error, I quess because I don't put this right.
Thanks for your attention
http://www.devnetwork.net/forums/viewto ... highlight=
The script needs the $HTTP_REFERER to function properly
Code: Select all
$file = substr($HTTP_REFERER, strrpos($HTTP_REFERER,"/")+1);
$fd= fread(fopen($file, "r"), 100000);< fopen("", "r") - Inappropriate ioctl for device > and < not a valid File-Handle resource >
I have been looking for a workaround but either it is impossible or my knowledge is too limited (the latter is definitely sure).
Any help welcome. If there is no workaround the possibility to lead the visitor to a friendly errorpage with explanation would do as well.
I tried to accomplish the latter by
Code: Select all
if(!$HTTP_REFERER){
Header("Location: http://www.domain.com/error.htm");}Thanks for your attention