Hi all,

Im editting a whois script so when it returns the details of the whois search it returns one positive answer if the "loggedin" cookie is found, and another positive answer if it is not, and a negative one if the domain is taken. The whois script works fine but checking for the cookie does not.

It goes like this:

1) home page
www.example.com/index.php ---> (submit whois form (form action is step 2))

2) home page whois form action
www.example.com/whois/whois.php
require_once("AjaxWhois.php");
$whois = new AjaxWhois();
$domainName = (isset($_POST)) ? $_POST : '';
$whois->processAjaxWhois();

3) required file within whois form action
www.example.com/whois/ajaxwhois.php

//whois processing has already been done. 
//if domain is available....
if ($this->checkDomain($domain,$server,$findText))
{
//check for cookie
	if (isset($_COOKIE['loggedin']))
		{
//and echo 'logged in message'
   	   echo "domain available. You are logged in.";
		}
else 
		{
//else echo 'not logged in message'
			echo "domain available. You are not logged in.";
		}
}
//unless domain is not available, echo 'not available message'
   else {echo "Domain not available.";}
}

The script always returns the 'you are not logged in' message even through the cookie is definately written. any ideas why?

try this:

//whois processing has already been done. 
//if domain is available....
if ($this->checkDomain($domain,$server,$findText))
{
//check for cookie
	if (isset($_COOKIE['loggedin']))
		{
//and echo 'logged in message'
   	   echo "domain available. You are logged in.";
		}
if (!isset($_COOKIE['loggedin']))
		{
//else echo 'not logged in message'
			echo "domain available. You are not logged in.";
		}
}
//unless domain is not available, echo 'not available message'
   else {echo "Domain not available.";}
}

notice your else part,which i have changed...

Still not working. comes up with the same result - go on the link below to see screenshot.

http://economizerz.com/other/daniweb/images/ecocookies.bmp

"not logged in" under the add to basket button is put there because of an isset statement checking for the cookie

"already logged in" is put there because of the same isset statement checking for the same cookie

hello...
1.once check your setCookie() function,whether it is properly or not..
2. echo your cookie like: echo $_COOKIE["something"];
check it will print or not...
3. i heard that some browsers does not support cookies..
4.try sessions instead of cookies...

I have tried all of those.

my cookie prints out because in the screen shot of the page it shows the username saved as the value of the cookie so it prints out and has been set properly.

im using firefox and cookies normally work

sessions dont work either although i only tried breifly :/