I am trying to use php to link from my mobile site to my default site. I am able to set the cookie on the theme page but when I get redirect back to the default page it just redirects me to the mobile page. I can see the cookie gets created but for some reason it wont read the cookie. Any ideas? On a side note is it right to be using a php cookie to do this?
The Code:
Default Templates Index page
<?php
if(isset($_COOKIE['cookie'])){
exit;
}
else{
// use detectmobilebrowser code to redirect it to m.defaultthemeurl.com
}
?>
Mobile Theme:
<?php
if(isset($_GET['default'])) {
setcookie('cookie', '1', time()+165*10, '/', 'defaultthemeurl.com');
header('Location: http://defaultthemeurl.com');
exit;
}
?>
<a href="?default">logout</a>
because
doesn’t actually add a value to $_GET[‘default’] so the isset() failed.
try
instead