Page 1 of 1

User altered URL bar

Posted: Thu Apr 21, 2005 5:39 pm
by cbrian
Is there a way in PHP to sense if the user typed something into the URL bar instead of clicking a link? A friend of mine who uses ASP gave me this code that he uses, but I know nothing about ASP.

Code: Select all

If Left(Request.ServerVariables(&quote;HTTP_REFERER&quote;), Len(GameRootURL)) <> GameRootURL And Left(Request.ServerVariables(&quote;HTTP_REFERER&quote;), Len(GameRootURL2)) <> GameRootURL2 Then

Posted: Thu Apr 21, 2005 6:17 pm
by xudzh
if ($SERVER[HTTP_REFERER]=="") { //THE user typed the url


However:
'HTTP_REFERER'
The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.

Posted: Thu Apr 21, 2005 6:19 pm
by cbrian
Okay, thanks a lot!

Posted: Thu Apr 21, 2005 6:34 pm
by xudzh
No problem

This is actually the first time i help someone...I was always the one getting helped :wink: