Recent Changes - Search:

Hauptmenue (edit)

Php /

JavaScriptCheck

<< GaesteBuchSchlicht | PhpSchnipsel | MagicQuotes >>

onepixel.php:

<?php
session_start();
$var = 'JavaScript';
if (isset($_GET[$var]))
{
  if ("on"  == $_GET[$var]) $_SESSION[$var] = TRUE ;
  if ("off" == $_GET[$var]) $_SESSION[$var] = FALSE;
}
$image = imagecreate(1,1);
$pixelfarbe=imagecolorallocate($image,222,222,222);
imagecolortransparent($image,$pixelfarbe);
imagesetpixel($image, 0, 0,$pixelfarbe );
header("Content-Type: image/png");
imagepng($image);
?>

auswertung.php:

<?php
session_start();
error_reporting(E_ALL);
ini_set('display_errors', TRUE);

$var = 'JavaScript';

function testcode($var)
{
  if (!isset($_SESSION[$var]))
  {
     return 
'   <script type="text/javascript">
      document.write(\'<img src="onepixel.php?'
.$var.'=on" alt="JStest">\');
    </script>
    <noscript>       
      <img src="onepixel.php?'
.$var.'=off" alt="JStest">
    </noscript> '
;
  }
}

switch(TRUE)
{
  case (!isset($_SESSION[$var]))   : $Zustand = 'Unbekannt'; break ;
  case (TRUE  === $_SESSION[$var]) : $Zustand = 'ON' ; break ;
  case (FALSE === $_SESSION[$var]) : $Zustand = 'OFF'; break ;
  default : $Zustand = 'Huch, FatalFault';
} 
$meldung = $var.' Status: '.$Zustand.' <br />';


echo $meldung;
echo testcode($var);
?>

<< GaesteBuchSchlicht | PhpSchnipsel | MagicQuotes >>

Edit - History - Print - Recent Changes - Search
Page last modified on September 19, 2006, at 11:39 AM