User altered URL bar

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
cbrian
Forum Commoner
Posts: 97
Joined: Sun Feb 27, 2005 12:29 pm

User altered URL bar

Post 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
xudzh
Forum Commoner
Posts: 48
Joined: Sat Feb 19, 2005 6:22 pm

Post 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.
cbrian
Forum Commoner
Posts: 97
Joined: Sun Feb 27, 2005 12:29 pm

Post by cbrian »

Okay, thanks a lot!
xudzh
Forum Commoner
Posts: 48
Joined: Sat Feb 19, 2005 6:22 pm

Post by xudzh »

No problem

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