Location: PHPKode > projects > NewsP > admin/login.php
<?php
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
      session_start();

$username = $_POST['username'];
if ($username =='admin'){$username = 'Admin';}
$passwort = $_POST['passwort'];
$passwort = md5($passwort);

if ($username == "Admin" && $passwort == "e3afed0047b08059d0fada10f400c1e5"){
$_SESSION['renew'] = 'ja';
}
$hostname = $_SERVER['HTTP_HOST'];
$path = dirname($_SERVER['PHP_SELF']);

	$userdatei = fopen ("user.txt","r");
		while (!feof($userdatei))
		{
		$zeile = fgets($userdatei,500);
		$userdata = explode("|", $zeile);
			if ($userdata[0]==$username && $passwort==trim($userdata[1]))
			{
			$_SESSION['username'] = $username;
			$_SESSION['angemeldet'] = true;
			$_SESSION['ur1'] = $userdata[2];
			$_SESSION['ur2'] = $userdata[3];
			$_SESSION['ur3'] = $userdata[4];
			$_SESSION['ur4'] = $userdata[5];
			}
		}

if (isset($_SESSION['username'])){
       if ($_SERVER['SERVER_PROTOCOL'] == 'HTTP/1.1') {
		        if (php_sapi_name() == 'cgi') 
		{
		         header('Status: 303 See Other');
		}else {
		         header('HTTP/1.1 303 See Other');
		}
        }

       header('Location: http://'.$hostname.($path == '/' ? '' : $path).'/index.php');
echo "$username";
       exit;
       }
      }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
 <head>
  <title>Gesch├╝tzter Bereich</title>
 </head>
 <body>

<CENTER><TABLE>
<TR>
	<TD valign="bottom"> 
  <form action="login.php" method="post">
   Username: </TD><TD><input type="text" name="username" /><br /></TD></TR>
   <TR><TD>Password: </TD><TD><input type="password" name="passwort" /><br /></TD></TR>
<TR><TD colspan="2"><CENTER> <input type="submit"/></CENTER></TD></TR>
  </form>
<TR><TD colspan="2"><CENTER><FONT SIZE=-1><A HREF="pass_lost.php">Forgotten password</A></FONT></CENTER></TD></TR>

</TABLE>
  
</CENTER>

 </body>
</html>
Return current item: NewsP