Hallo,
ich bin grad am basteln, und musste feststellen, dass die Session gar nicht t, wie ich sie eingebaut habe:
acp.php (der Login)
check.php (nachm Login)
und
start.php (geschützte Seite)
ich bin grad am basteln, und musste feststellen, dass die Session gar nicht t, wie ich sie eingebaut habe:
acp.php (der Login)
PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>ACP - Login</title>
<style type="text/css">
body {
background-color: #3a3a3a;
margin-top: 50px;
padding: 0px;
position: absolute;
font-family: Verdana, Tahoma;
font-size: 10px;
border: 0px;
}
.input { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: #FFFFFF; background-color: #545454; border: 1px solid #000000; }
div#center {
width: 593px;
border: 0px;
}
div#header {
width: 593px;
height: 42px;
background-image:url("img/header.gif");
text-align: center;
padding-left: 0px;
padding-top: 10px
}
div#bg {
width: 583px;
background-image:url("img/background.gif");
padding-left: 10px;
}
div#footer {
width: 193px;
height: 21px;
background-image:url("img/footer.gif");
padding-left: 400px;
color: #000000;
}
</style>
</head>
<body link="#000000" vlink="#000000" alink="#000000">
<div id="header"><b>ACP : <font color="7d7d7d">Login</font></b></div>
<div id="bg">
<form name="Eingabe" action="check.php" method="post">
Benutzername:<br>
<input type="text" class="input" name="benutzer" size="20"><br>
Passwort:<br>
<input type="password" class="input" name="pass" size="20"><br><br>
<input type="submit" class="input" value="Login" style="width: 134px; ">
</form><br>
</div>
<div id="footer"></div>
</body>
</html
check.php (nachm Login)
PHP:
<?php
include("config.php");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>ACP - Login</title>
<style type="text/css">
body {
background-color: #3a3a3a;
margin-top: 50px;
padding: 0px;
position: absolute;
font-family: Verdana, Tahoma;
font-size: 10px;
border: 0px;
}
.input { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: #FFFFFF; background-color: #545454; border: 1px solid #000000; }
div#center {
width: 593px;
border: 0px;
}
div#header {
width: 593px;
height: 42px;
background-image:url("img/header.gif");
text-align: center;
padding-left: 0px;
padding-top: 10px
}
div#bg {
width: 583px;
background-image:url("img/background.gif");
padding-left: 10px;
}
div#footer {
width: 193px;
height: 21px;
background-image:url("img/footer.gif");
padding-left: 400px;
color: #000000;
}
</style>
</head>
<body link="#000000" vlink="#000000" alink="#000000">
<div id="header">ACP : <font color="7d7d7d">Login</font></b></div>
<div id="bg">
<?php
$benutzer=$HTTP_POST_VARS['benutzer'];
$pass=$HTTP_POST_VARS['pass'];
$db=mysql_connect($database_server,$database_user,$database_passwort);
mysql_select_db("$database_name");
$anfrage="SELECT * FROM $database_table WHERE benutzer LIKE'";
$anfrage.=$benutzer;
$anfrage.="'";
$ergebnis=mysql_query($anfrage);
$anz=mysql_num_rows($ergebnis);
if($anz==1) {
$zeile=mysql_fetch_row($ergebnis);
if($pass==$zeile[1])
@session_name("sid");
@session_start();
$s_user = $arr[0];
$s_pass = $arr[1];
@session_register("s_user", "s_pass");
{
echo "Login erfolgreich!<br><br>";
echo "<form action='start.php?<?php echo session_name() ?>=<?php echo session_id() ?>' method='post'><input type='submit' class='input' value='Weiter' style='width: 134px; '></form>";
}
}
else {
echo "Passwort oder Benutzername falsch!<br><br>";
echo "<form action='acp.php' method='post'><input type='submit' class='input' value='Zurück' style='width: 134px; '></form>";
}
mysql_close($db);
?>
<br>
</div>
<div id="footer"></div>
</body>
</html
und
start.php (geschützte Seite)
PHP:
<?php
@session_name("sid");
@session_start();
if (session_is_registered("s_user")) {
include 'start.txt';
}
else {
echo "Bitte Einloggen!<br><br>";
echo "<form action='acp.php' method='post'><input type='submit' class='input' value='Weiter zur ACP' style='width: 134px; '></form>";
}
?>