23587
Feb 22, 2007, updated at Mar 07, 2007 (UTC)
3850
1
0
PHP Login mit Session geht nicht
Hallo,
ich bin gerade dabei diese Seite hier zu machen: http://lan-nf.ath.cx
Das soll mal für die Feuerwehr in Husum/Nordsee die neue Internetseite werden.
Dieso Seite beinhaltet auch ein Login-Formular...
Das witzige ist, dass ich mich einloggen kann, ABER ich bei jedem Seitenwechseln wieder ausgeloggt werde.
Kann mir das jemand erklären?
Hier ist einmal der Quellcode von meiner Seite.
Danke schonmal
Gruß Aleks
ich bin gerade dabei diese Seite hier zu machen: http://lan-nf.ath.cx
Das soll mal für die Feuerwehr in Husum/Nordsee die neue Internetseite werden.
Dieso Seite beinhaltet auch ein Login-Formular...
Das witzige ist, dass ich mich einloggen kann, ABER ich bei jedem Seitenwechseln wieder ausgeloggt werde.
Kann mir das jemand erklären?
Hier ist einmal der Quellcode von meiner Seite.
Danke schonmal
Gruß Aleks
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link type="text/css" href="templates/feuerwehr-husum/feuerwehr-husum.css" rel="stylesheet" media="screen" />
<title>..::Feuerwehr-Husum.de ::..</title>
<link rel="shortcut icon" href="http://lan-nf.de/media/ico/site.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<STYLE>BODY {
scrollbar-face-color: red;
SCROLLBAR-TRACK-COLOR: blue;
scrollbar-arrow-color: black;
scrollbar-base-color: #ffff33;
scrollbar-shadow-color : #33cc99;
SCROLLBAR-3DLIGHT-COLOR: #ff33ff;
SCROLLBAR-DARKSHADOW-COLOR: #33ffff;
scrollbar-highlight-color: white;
} </STYLE>
<div id="container">
<div id="kopf" >
<?php
include "banner.php"
?>
</div>
<div id="login">
<?php
@session_start();
if($_POST['send'])
{
$con=mysql_connect("localhost", "root", "");
$con2=mysql_select_db("page");
$nutzer=$_POST["username"];
$pass=$_POST["passwort"];
$anfrage='SELECT * FROM user where nickname="'.$nutzer.'"';
$data = mysql_query($anfrage);
while($row = mysql_fetch_array($data))
{
if ($nutzer == $row["nickname"] && $pass == $row["passwort"])
{
$_SESSION['email']=$row['email'] ;
$_SESSION['id']=$row['id'] ;
$_SESSION['name']=$row['name'] ;
$_SESSION['passwort']=$row['passwort'] ;
$_SESSION['nickname']=$row['nickname'] ;
$_SESSION['geb']=$row['geb'] ;
$_SESSION['punkte']=$row['punkte'] ;
$_SESSION['icq']=$row['icq'] ;
$_SESSION['msn']=$row['msn'] ;
$_SESSION['nachname']=$row['nachname'] ;
$_SESSION['vorname']=$row['vorname'] ;
$_SESSION['ava']=$row['ava'] ;
$_SESSION['homepage']=$row['homepage'] ;
$_SESSION['signatur']=$row['signatur'] ;
$_SESSION['status']=$row['status'] ;
} else
{
$msg='User existiert nicht und/oder Passwort falsch!';
};
};
}
else {
};
if ($_GET['logout']==1){session_destroy(); }
?>
<h3><u>Login</u></h3>
<?php
if($_SESSION['id']=="")
{
echo '<form action="index.php" method="post">
Nick:
<INPUT type="text" class=form_input name="username" value="" size="15" maxlength="">
Passwort:
<INPUT type="password" name="passwort" class=form_input value="" size="15" maxlength="">
<INPUT type="submit" name="send" value="Ok">
';
}
else {
if($logout==1){
echo ' Erfolgreich Ausgeloggt';
}
else {
echo '<FONT face="Tahoma"><FONT size="-1"> <a href="index.php?action=profil&userid='.$_SESSION['id'].'">Hallo '.$_SESSION['nickname'].'!</a><br>
';
if($_SESSION['punkte']>=4 ) {
echo ' <b><a href="index.php?action=lesen">Grüße und Wünsche</a></b><br>';
};
if($_SESSION['punkte']>=3 ) {
echo ' <b><a href="admin/kicksource.php" target=blank>Playlist kicken</a></b><br>';
echo ' <b><a href="index.php?action=news_post">News schreiben</a></b><br>';
};
echo'
<b><a href="index.php?action=edit">Profil Editieren</a></b><br>
<b><a href="index.php?action=ava_upload"></a></b><br>
<b><a href="index.php?logout=1">Logout</a></b><br>
';
};
};
?>
<br>
<a href="index.php?section=registrieren">Registrieren</a>
</div>
<div id="ticker" >
<?php
include "ticker.php";
?>
</div>
<div id="rechts">
<?php
include "news_kurz.php";
?>
</div>
<div id="links">
<?php
include "menu.php";
?>
</div>
<div id="inhalt">
<?php
include "haupt.php"
?>
</div>
</body>
</html>
Please also mark the comments that contributed to the solution of the article
Content-Key: 52337
Url: https://administrator.de/contentid/52337
Printed on: April 19, 2024 at 14:04 o'clock
1 Comment