Jump to content

If x==x then ... redirect question


xcali

Recommended Posts

hi again guys

once again I'm stuck and i seek some help if possible

 

My problem is this:

after the user logs in, cookie is created regis_as and it can have one of 4 values inside: either C, M, I or P

now if the user wants to view a certain page, he is redirected to usercheck.php (code below) and there should be a check if the value from the cookie is equal to a certain value

 

so i have this cheap little script

<?

// check if the info inside cookies is = to a certain value
if ($_COOKIE['regis_as'] = 'C')) 
{   //go to some section
   Header ("Location: browse.php");
} 
else 
{ 
   // redirect to some other section
   Header ("Location: uc.php");
} 
?>  

 

but for some reason it does not redirect the users - i just get a blank page

is my whole  "($_COOKIE['regis_as'] = 'C'))" suppose to look different or is this just a little mistake i did somewhere?

 

please advise

thank you

Link to comment
https://forums.phpfreaks.com/topic/102767-if-xx-then-redirect-question/
Share on other sites

thank you for the reply

 

i did try it as well as putting single quotes ' instead of " but still same thing :/

heres a screenshot of the cookie and its value

vg22hx.jpg

 

as mentioned before id like to have the content of that cookie ( 'I' ) compared to a certain value (in my script 'C')

 

any other ideas what could be wrong? :/

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.