georgebates Posted April 16, 2011 Share Posted April 16, 2011 Hey Everyone, I just have a quick question. I have a page that has set a cookie called email_success with the value "yes". I now need some code so that when the user goes to a download page, it checks for the cookie and if there is no cookie it redirects to another page. But if there is the cookie it displays the download page. I tried i few things but didn't work. Can anyone help me please!! Thanks George Link to comment https://forums.phpfreaks.com/topic/233862-cookies-help/ Share on other sites More sharing options...
requinix Posted April 16, 2011 Share Posted April 16, 2011 What did you try? Link to comment https://forums.phpfreaks.com/topic/233862-cookies-help/#findComment-1202208 Share on other sites More sharing options...
georgebates Posted April 16, 2011 Author Share Posted April 16, 2011 <?php $email=$_COOKIE['email_success']; if ($email=="yes"){ } else {header( "Location: http://www.ipgbmusic.co.cc/index.html");}; ?> Probably totally wrong though. I haven't used PHP in ages. Link to comment https://forums.phpfreaks.com/topic/233862-cookies-help/#findComment-1202210 Share on other sites More sharing options...
georgebates Posted April 16, 2011 Author Share Posted April 16, 2011 Can someone please help? Link to comment https://forums.phpfreaks.com/topic/233862-cookies-help/#findComment-1202239 Share on other sites More sharing options...
AtomicRax Posted April 16, 2011 Share Posted April 16, 2011 How did you set the cookie? I've had problems with that because the newer versions of php changed it a little... Also you're else statement doesn't need the ; at the very end.. else { header("Location: http://www.ipgbmusic.co.cc/index.html"); } Link to comment https://forums.phpfreaks.com/topic/233862-cookies-help/#findComment-1202240 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.