I'd like to do something with sessions that should be easy. But I'm new to this, and obviously I'm missing something somewhere... I want to use cookies if the visitor allows, but tack the session info (SID) "get style" on the URL of a linked page *only if* the visitor blocks cookies. I've tried a lot of variations, but nothing really works. I either get the entire SID value in the URL (even if cookies are accepted), or the SID doesn't show up in the URL, which means it works only with visitors who accept cookies. Below is my most recent attempt. simple.php detects whether the visitor accepts cookies by forcing a page reload (my thanks to Chris Shiflett), then attempts a redirection, based on whether cookies are accepted. Doesn't work. Anyone got any ideas? TIA. ------------------------- <? # simple.php ini_set('session.use_trans_sid', 0); ini_set('session.use_cookies', 1); ini_set('register_globals', 0); session_start(); if (! isset($_GET['cac'])) { header('Set-Cookie: accept_cookies=yes'); header('Location: ' . $_SERVER['PHP_SELF'] . '?cac=1'); } $_SESSION['accepts_cookies'] = isset($_COOKIE['accept_cookies']); $_SESSION['session_num'] = session_id(); if ($_SESSION['accepts_cookies']) { header('location: simple2.php'); } else { header('location: simple2.php?'. strip_tags(SID)); } die; ?> -------------------------- <? # simple2.php //ini_set('session.use_trans_sid', 0); //ini_set('session.use_cookies', 1); //ini_set('session.use_only_cookies', 1); //ini_set('register_globals', 0); session_start(); ?> <html> <head> <title>Processing Error</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <? echo "Old Session ID: " . $_SESSION['session_num'] . "<br>"; echo "This Session ID: " . session_id() . "<br>"; echo "SID: " . SID . "<br>"; ?> <blockquote> <? echo ?> </blockquote> </body> </html> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php