<?php
session_start();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Friend Book By Katsar0v</title>
</head>
<body bgcolor="cccccc"><center>
<?php
if($_SESSION['is_logged ']==true)
{
echo "Logged";
//TODO LIST OF FRIENDS
}
else
{
$login=trim($_POST['login']);
$pass=trim($_POST['pass']);
if(strlen($login)>3 && strlen($pass)>3)
{
if($login=="katsarov" && $pass=="123456")
{
$_SESSION['is_logged']=true;
header('Location: index.php');
}
else{
echo 'Wrong Username Or Password';
}
}
?>
<form method="post" action="index.php">
Username:<input type="text" name="login"><br>
Password:<input type="password" name="pass"><br>
<input type="submit" value="Login">
</form>
<?php
}
?></center>
</body>
</html>
Като се логна с user и pass изписва
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\book\index.php:11) in C:\xampp\htdocs\book\index.php on line 26....
session_start();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Friend Book By Katsar0v</title>
</head>
<body bgcolor="cccccc"><center>
<?php
if($_SESSION['is_logged ']==true)
{
echo "Logged";
//TODO LIST OF FRIENDS
}
else
{
$login=trim($_POST['login']);
$pass=trim($_POST['pass']);
if(strlen($login)>3 && strlen($pass)>3)
{
if($login=="katsarov" && $pass=="123456")
{
$_SESSION['is_logged']=true;
header('Location: index.php');
}
else{
echo 'Wrong Username Or Password';
}
}
?>
<form method="post" action="index.php">
Username:<input type="text" name="login"><br>
Password:<input type="password" name="pass"><br>
<input type="submit" value="Login">
</form>
<?php
}
?></center>
</body>
</html>
Като се логна с user и pass изписва
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\book\index.php:11) in C:\xampp\htdocs\book\index.php on line 26....