Jump to content

$_COOKIE[]


watagal

Recommended Posts

Greetings-As part of my index.php (initial) file, I'm trying to read Cookies for returning members. All this parsing is done before any header (HTML) code is written (sent) to the browser.My question is when can I access those cookies? As of now, my code is not working - just not sure if there is something wrong with my logic.I know the cookies are wriiten correctly, I can see them via Ffox.TiA, Gal

	// Cookie check for returning members	$cookieUserName	= isset($_COOKIE['id1']) ? $_COOKIE['id1'] : USR_GUEST;	queryUser($dblink, $cookieUserName,((strpos($cookieUserName,'@'))?'userEmail':'userName'));	// Defines $_SESSION[]	if ($_SESSION['userName'] != USR_GUEST) {		if (isset($_COOKIE['id2'])) {			if (md5($_COOKIE['id2']) != $_SESSION['password']) {				queryUser($dblink, USR_GUEST,'userName');	// Defines $_SESSION[]			}		}	}

Link to comment
Share on other sites

Try just echoing it. Are you sure its called 'id1'?

Link to comment
Share on other sites

Try just echoing it. Are you sure its called 'id1'?
I think I've tried everything - at least twice.echo '['.$_COOKIE['i1'].']'; // returns ''echo '['.isset($_COOKIE['i1']).']'; // returns ''The name is correct, I can see the cookies in FireFox > Tools > Options > Show CookiesIs this a timing issues? Are cookies available before any HTML header is sent?Thanks for taking a look, Gal
Link to comment
Share on other sites

Archived

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

×
×
  • Create New...