<?php
//damit kompatibel mit PHP5 und register Global on
if( !isset( $HTTP_POST_VARS ) )
$HTTP_POST_VARS =& $_POST;
if( !isset( $HTTP_COOKIE_VARS ) )
$HTTP_COOKIE_VARS =& $_COOKIE;
if( !isset( $HTTP_SERVER_VARS ) )
$HTTP_SERVER_VARS =& $_SERVER;

//echo $_COOKIES['loginadmin'];
$wobinich= ""; for ($c = 0; $c <= 10; $c++) if(file_exists($wobinich."var.php"))break; else  $wobinich="../$wobinich";
@include($wobinich."var.php");

if (!empty($HTTP_POST_VARS['kennwort'])){ 
if ($HTTP_POST_VARS['kennwort'] == $Passwort){

if ($HTTP_COOKIE_VARS["Passwortfalsch"] != 1){

setcookie ("loginadmin", md5($HTTP_POST_VARS['kennwort']), time()+$PWgueltigkeit);
echo "<head>";
echo "<meta http-equiv='refresh' content='0 URL=", $Pfadadmin,"/admin.php'></head>";
echo "setze Cookie!<a href=", $Pfadadmin,"/admin.php>klicken, falls du nicht automatisch weitergeleitet wirst ...</a>";
}
else echo $TEXTPWfalsch;

}
else 
{
setcookie ("Passwortfalsch", 1, time()+$Reloadsperre);
echo $TEXTPWfalsch;
}}
else
if ($HTTP_COOKIE_VARS["loginadmin"] != md5($Passwort)){
$phpself = explode ("/", $HTTP_SERVER_VARS['PHP_SELF']);
if ($phpself[sizeof($phpself)-1]!="login.php") echo "<meta http-equiv='refresh' content='0 URL=", $wobinich,"login.php'></head>";
else
echo "<form name='data' action='login.php' method='post'><p>bitte Passwort eingeben:<br>
<input name='kennwort' type='password' size='12' maxlength='12'>
<input type='submit' name='weiter' class='submit' value='login'>
</form></body></html>";
}
?>
