0

I am trying to match two URLs but it seems doesn't work. I have tried works fine if I put manually.

Here is the code:

$referby = $_SERVER['HTTP_REFERER'];
$link1="http://domain.com/admin/ajax/passcodev.php?order_id=".$orderid;
$link2="http://www.domain.com/admin/ajax/passcodev.php?order_id=".$orderid;

if($referby<>$link1 || $referby<>$link2)
 {
    header('Location:passcodev.php?order_id='.$orderid);
 }

I have no idea where I am doing mistake.

3
  • <> i think it's for different... use != instead Commented Nov 18, 2014 at 15:36
  • @MarcoMura <> is exactly the same as != Commented Nov 18, 2014 at 15:38
  • @Magicprog.fr i didn't know that comparison operator o.o thanks for your input Commented Nov 18, 2014 at 15:42

1 Answer 1

5

if($referby<>$link1 || $referby<>$link2) means if $referby does not match $link1 or $link2, proceed. Since it can't match both it always evaluates to true.

You need to use && (and):

if($referby != $link1 && $referby != $link2)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.