Jump to content

If...do nothing... else... do something


Boerboel649

Recommended Posts

This a super quick and easy question (I hope...)

 

Basically I'm righting a little script that will check the HTTP Referer, and if it equals such and such then to do nothing (ie let the user remain on that page.) If it doesn't equal that then it's gonna redirect them to another page. Basically what I need is how to say "do nothing" in PHP... :P Would it go something like this?

 

if(blahblahblah){

}

 

 

??

 

Thanks!

Link to comment
Share on other sites

Good idea kenrbnsn, however having trouble getting it to work... here's the code:

 

<?php
$condition = "www.myurl.com/referer.php";
if ($HTTP_REFERER != $condition)
     header("www.myurl.com/redirectpage.php ");

?>

 

It isn't redirecting me at all...

Link to comment
Share on other sites

try printing the value of $HTTP_REFERER to make sure it's the value you're looking for:

<?php
$condition = "www.steamfootball.com/authorize.php";
echo "condition: {$condition}<br />\n";
echo "http referer: {$_SERVER['HTTP_REFERER']}<br />\n";
if ($_SERVER['HTTP_REFERER'] != $condition){
     echo "'if' condition passed requirements";
     header("www.steamfootball.com/login.php ");
}	 
?>

Link to comment
Share on other sites

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.