Click to See Complete Forum and Search --> : Why not working?


Tasmanian Devil
07-14-2003, 02:56 PM
the following code, is to check to see if javascript is enabled, and if not, it goes to a page without frames. And if the javascript is enabled, it goes to a a page with frames. As well I would like the script to check for cookies enabled. So what I am really looking for is, a php to first search for cookies enabled and then javascript enabled, if only one or none of them are enabled, I want the user to be sent to one page, if both are enabled, then the the user is sent to a page that is set up for both and has frames.

The code that follows does not do the javascript part of the check:

<?PHP
$js = $_GET["js"];
if($js==0){
setcookie("js", 0, time()+60*60*24*30, '/', '.foxvalleynews.com');
echo ('<html>
<title>Fox Valley Newspapers</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<frameset cols="134,*" frameborder="NO" border="0" framespacing="0" rows="*">
<frame name="leftFrame" scrolling="NO" noresize src="index-2.html">
<frame name="mainFrame" src="index-1.html">
</frameset>
<noframes>
<body bgcolor="#FFFFFF" text="#000000">
</body>
</noframes>
</html>');
} else if($js==1) {
setcookie("js", 1, time()+60*60*24*30, '/', '.foxvalleynews.com');
echo ('<html>
<title>Fox Valley Newspapers</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<frameset cols="134,*" frameborder="NO" border="0" framespacing="0" rows="*">
<frame name="leftFrame" scrolling="NO" noresize src="index-2.html">
<frame name="mainFrame" src="index-withJavaScript.html">
</frameset>
<noframes>
<body bgcolor="#FFFFFF" text="#000000">
</body>
</noframes>
</html>');
} else {
echo ("<h1>Please click <a href=\"jsEnabled.php\">here</a></h1>");
}
echo $_COOKIE["js"]; // print cookie value
?>

Thanks

brendandonhue
07-14-2003, 04:09 PM
Are you sure the variable js is being set by the get method from a link/previous page?

Tasmanian Devil
07-14-2003, 04:14 PM
what you see is, what is on my index.html page so I do not know

brendandonhue
07-14-2003, 04:16 PM
Where is the check for javascript being done?
From the code you gave in the other thread, the javascript detection has already been done and whether javascript exists is stored in a variable called js.

Tasmanian Devil
07-14-2003, 04:24 PM
I do not think it has been called out, that is what the other code was to do. So now I am even more lost.

Tasmanian Devil
07-15-2003, 07:54 AM
Can someone please help me?