Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PHP Create and delete cookies using query strings
- <a href="index.php?showDesktop=true">Show Desktop</a>
- <a href="index.php?showMobile=true">Show Mobile</a>
- if($_GET['showDesktop']) {
- $_COOKIE('showDesktop', 'yes');
- $_COOKIE('showMobile', null);
- }
- else if($_GET['showMobile']) {
- $_COOKIE('showDesktop', null);
- $_COOKIE('showMobile', 'yes');
- }
- setcookie('showDesktop', 'yes', time()+86400*365);
- setcookie('showMobile', false);
- setcookie('displayMode', 'desktop', time()+86400*365);
- if($_GET['showDesktop'] == 'true') {
- setcookie('showDesktop', true);
- setcookie('showMobile', false);
- }
- else if($_GET['showMobile'] == 'true') {
- setcookie('showDesktop', false);
- setcookie('showMobile', true);
- }
- if($_GET['showDesktop']) {
- $_COOKIE('showDesktop', 'yes');
- }
- else if($_GET['showMobile']) {
- $_COOKIE('showDesktop', 'no');
- }
- setcookie ("showDesktop", "", time() - 3600);
Add Comment
Please, Sign In to add comment