<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
session_start();
$username = $_POST['username'];
$passwort = $_POST['passwort'];
$hostname = $_SERVER['HTTP_HOST'];
$path = dirname($_SERVER['PHP_SELF']);
// Benutzername und Passwort werden überprüft
if ($username == 'xxxx' && $passwort == 'xxxx') {
$_SESSION['angemeldet'] = true;
// Weiterleitung zur geschützten Startseite
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');
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 bgcolor="#FFEECA">
<form action="login1.php" method="post">
Username: <input type="text" name="username" value="xxxx" /><br />
Passwort: <input type="password" name="passwort" /><br />
<input type="submit" value="Anmelden" />
</form>
</body>
</html>
header('Location: http://'.$hostname.($path == '/' ? '' : $path).'/index.php');
exit;
switch ($username) {
case 'xxxx': header("Location: seite1.php");
break;
case 'yyyy': header("Location: seite2.php");
break;
default: break;
}
PHP-script killt One.com Server
wurzelpeter 25.03.2009 - 497 Hits - 7 Antworten
PEAR
ThmoaM 04.04.2009 - 222 Hits - 1 Antwort
Div verlangsamen - JS
Malochnix 29.03.2009 - 289 Hits - 11 Antworten
PHP-generiertes Bild mit Zeilenumbrüchen
scripter51 28.03.2009 - 212 Hits - 3 Antworten
Scripthilfe für verschiedene Anwendungszwecke
Romero 15.02.2010 - 495 Hits - 12 Antworten