Jump to content

Recommended Posts

Remember, == is case sensitive. If case doesn't matter, use strcasecmp or convert both to the same case before comparing them.

 

good point, that would be a good precautionary measure to take here..

so the code would look something like this OP

 

$exURL=$_SERVER['HTTP_REFERER']; 

$goodURL = 'http://www.SomeSite/login/';

if(strcasecmp($exURL, $goodURL) == 0){
      // URL's match
}else{
      // they don't
}

Thanks for the replies.

 

 

These are rights methods.

But I've noticed that  $_SERVER['HTTP_REFERER']; is not "recognized" properly.

 

 

I've made the following tests:

 

case1:

$exURL = 'http://www.SomeSite/login/';

 

$goodURL = 'http://www.SomeSite/login/';

 

your methods works fine

 

 

 

 

 

case2:

$exURL = $exURL=$_SERVER['HTTP_REFERER'];

 

$goodURL = 'http://www.SomeSite/login/';

 

not working

 

 

 

 

I've checked $exURL with echo();  :

echo($exURL);      // output:      http://www.SomeSite/login/

 

 

 

Where is the problem?

 

 

In short, you can't rely on that variable to be correct, or even present all the time.

 

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.

 

Maybe if you explain what you're trying to do, someone can help you come up with a better way to do it.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.