CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Check Cookies

Print topic Send  topic

Author Message
Vince
Posted: 05/28/2002, 6:44 AM

People have to log on to see certain parts of the site. If their browser does not accept cookies, nothing happens.

What I would like to have is a page that loads with a message saying sth like 'you need to accept cookies in order to log on' if their browser does not accept cookies...
How do I do that with PHP?
Brent
Posted: 05/28/2002, 1:04 PM

This function will show you what the user's browser is capable of.
Try this (sorry for the indentation, but that is because of this CC website left truncates everything):

<?PHP
function GetBrowserInfo()
/*------------------------------
Get the user's browser info
------------------------------*/
{
$browser = get_browser();
$prop_set = "";
$browser_type = "";
$browser_version = "";
while (list ($key, $value) = each($browser))
{
switch ($key)
{
case "browser" : if ($value) $browser_type = trim($value); break;
case "version" : if ($value) $browser_version = trim($value); break;
case "frames" : if ($value) $prop_set .= $key . ","; break;
case "tables" : if ($value) $prop_set .= $key . ","; break;
case "cookies" : if ($value) $prop_set .= $key . ","; break;
case "backgroundsounds": if ($value) $prop_set .= $key . ","; break;
case "vbscript" : if ($value) $prop_set .= $key . ","; break;
case "javascript" : if ($value) $prop_set .= $key . ","; break;
case "javaapplets" : if ($value) $prop_set .= $key . ","; break;
case "activexcontrols" : if ($value) $prop_set .= $key . ","; break;
case "win16" : if ($value) $prop_set .= $key . ","; break;
case "beta" : if ($value) $prop_set .= $key . ","; break;
case "ak" : if ($value) $prop_set .= $key . ","; break;
case "sk" : if ($value) $prop_set .= $key . ","; break;
case "aol" : if ($value) $prop_set .= $key . ","; break;
case "crawler" : if ($value) $prop_set .= $key . ","; break;
case "cdf" : if ($value) $prop_set .= $key . ","; break;
}
}
if ($prop_set)
$prop_set = substr($prop_set,0,strlen($prop_set)-1);
return $prop_set;
}

echo "Browser Info:<BR>".GetBrowserInfo();
?>

It returns a string showing all of the browser capabilities.

Browser Info:
frames,tables,cookies,backgroundsounds,vbscript,javascript,javaapplets,activexcontrols,cdf

Brent

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.