Boerboel649 Posted April 15, 2007 Share Posted April 15, 2007 This ought to be a simple question... I have a page which has the following PHP code: <?php if ($_SERVER['HTTP_REFERER'] != 'URLremoved') header("Location:/rostercpanel/login.php "); ?> Now, what I want to do, is add some other URL's, that are authorized URL's to come from. I've tried the 'or' and the '||' operators, but I have a feeling I'm doing it wrongly. Could someone please give me the code for this? If I didn't make myself clear enought let me know and I'll go into more detail. Thanks! Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted April 15, 2007 Share Posted April 15, 2007 use && or AND, I believe that your logic is incorrect here, the statement must use be in false condition for all in order to process. Ted Quote Link to comment Share on other sites More sharing options...
Psycho Posted April 15, 2007 Share Posted April 15, 2007 I think your problem is that you are using a does not equal operator. If you have two or more negative conditions using OR then one of them will always fail (when testing the same property) Ex: if ($url != "url1" OR $url != "url2") That will ALWAYS fail because even if the value does equal one of the tests it won't equal the 2nd. You need to use the AND condition <?php if ($_SERVER['HTTP_REFERER'] != 'URL1' AND $_SERVER['HTTP_REFERER'] != 'URL2') header("Location:/rostercpanel/login.php "); ?> Quote Link to comment Share on other sites More sharing options...
Boerboel649 Posted April 15, 2007 Author Share Posted April 15, 2007 Ahhh... ok! Thanks so much!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.