also ich habe folgendes problem ich habe gerade einen login programmier und jetzt will ich den min sessio noch etwas sicherer machen doch wenn ich versuche session zu verwenden bekomme ich folgende fehlermeldung:
- Code: Select all
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at G:\BIOS\xampp\htdocs\test\login2.php:5) in G:\BIOS\xampp\htdocs\test\login2.php on line 7
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at G:\BIOS\xampp\htdocs\test\login2.php:5) in G:\BIOS\xampp\htdocs\test\login2.php on line 7
mein code:
- Code: Select all
<?php
session_start();
$_SESSION['test']="funktioniert";
$form="<form id=\"form\" name=\"form\" method=\"post\" action=\"login.php\">";
$form.="<p><input type=\"hidden\" name=\"test\" value=\"1\"/>";
$form.="</p>";
$form.="<p><label>";
$form.="Username";
$form.="<input name=\"user\" type=\"text\" id=\"user\" />";
$form.="</label>";
$form.="</p>";
$form.="<p>";
$form.="<label>Passwort ";
$form.="<input name=\"pass\" type=\"password\" id=\"pass\" />";
$form.="</label>";
$form.="</p>";
$form.="<p>";
$form.="<label>";
$form.="<input type=\"submit\" name=\"Submit\" value=\"LogIn\" />";
$form.="</label>";
$form.="</p>";
$form.="</form>";
echo($form);
if($_POST['test']==1){
$user = $_POST['user'];
$link = mysql_connect("localhost","root","xxxxxxxx");
mysql_select_db("test", $link);
$sql = "SELECT pass FROM login WHERE user LIKE '$user'";
$ergebnis = mysql_query($sql,$link);
$array = mysql_fetch_array($ergebnis);
if($array['pass'] == $_POST['pass']){
echo "eingeloggt";
unset($_POST['test']);
echo "<script type=\"text/javascript\">function go(){location.href=logged.php}window.setTimeout(\"go()\", 3000);</script>";
}
else{
echo "falsches passwort";
}
}
?>
PS ich verwende XAMPP v. 1.5.4a