$zeit= date("H:i");
$chat_file_ok = "chat.txt";
$chat_lenght = 7;
$lines = file($chat_file_ok);
$a = count($lines);
$u = $a - $chat_lenght;
for($i = $a; $i >= $u ;$i--){
$msg_old = $lines[$i] . $msg_old;
}
$deleted = unlink($chat_file_ok);
$fp = fopen($chat_file_ok, "a+");
$fw = fwrite($fp, $msg_old);
fclose($fp);
($name AND $pw != ""){
$array = file("access.dat");
for($i=0;$i<count($array);$i++){
$daten = explode("#",$array[$i]);
if($name==$daten[0] && $pw==$daten[1] && $daten[2]==3){
$eingeloggt = true;
session_start();
session_register("eingeloggt");
header("Location: admin.php");
}
$array = file("access.dat");
for($i=0;$i<count($array);$i++){
$daten = explode("#",$array[$i]);
if($name==$daten[0] && $pw==$daten[1] && $daten[2]==2){
$eingeloggt = true;
session_start();
$autor = $daten[0];
session_register("autor");
session_register("eingeloggt");
header("Location: user.php");
}}
if($name==$daten[0] && $pw!=$daten[1]){
$eingeloggt = false;
$falsches_passwort = true;
}
}
if($eingeloggt) echo "<center>Erfolgreich eingeloggt";
else{
echo "<center>Konnte nicht einloggen...";
}
}else{