Source code
<?php
ob_start();/* header buffer */
session_start();
### to be deleted ########################################
?>
<a href="http://snippets.bluejon.co.uk/index.php"/>MENU</a>
<br><br><br>
<?php
### Make cookies if they don't exist #######################
if(!$_SESSION['exists']){
$_SESSION['exists']= 'off';
setcookie("exits", "data");
}
### Test for $_SESSION cookies being enabled ##############
if($_SESSION['exists']== 'off'){
if($_GET['js']){
if (!$_COOKIE["exits"]){
$err= $err. "Cookie: Error<br>";
}
}
### Process $_GET ##########################################
if($_GET['js']== "on"){/*get sent with js*/
$jsOn= "on";
}elseif($_GET['js']== "off"){/*get sent with meta header*/
$err= $err. "Javascript: Error<br>";
}else{
?>
<script language="JavaScript">
location.href = location.href+'?js='+'on';/*send get with js*/
</script>
<noscript>
<!/* send get with header*/>
<meta http-equiv="refresh" content="0;url=<?php print $PHP_SELF. '?js=off' ?>"/>
</noscript>
<?php
}
}else{
$err= $err. "Session Cookie: Error<br>";/*session cookie error*/
}
if($_SESSION['exists'] && $_COOKIE["exits"] && $jsOn== "on"){
$_SESSION['exists']= "on";
}
### Add program code ########################################
if($_SESSION['exists']== 'on'){
print"<h3>Add Program Script or Includes<br><br>";
print"Session Cookies: Enabled<br>";
print"Javascript: Enabled<br>";
print"Cookies: Enabled<br></h3><br>";
}else{
### Add error code ###########################################
print"<h3>Add Error Script or Includes<br><br>";
print "For the Website to function properly.<br>";
print "Javascript and Cookies should be enabled.<br><br>";
print "$err</h3><br>";
}
###############################################################
while (@ob_end_flush());
?>
<!### to be deleted ###########################################>
<a href="http://snippets.bluejon.co.uk/check4-js-and-cookies/check4-js-and-cookie-enabled-v4-phpcode.php">Display php source code </a>