Пак сесиите :(

katsar0v

Registered
Работеше , обаче нещо се прецака и не знам какво да правя :(

<?php
session_start();
$user=$_POST['user'];
$pass=$_POST['pass'];
include('config.php');
echo'<!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" lang="en" xml:lang="bg">
<title>Портфолиото на Кацаров</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link href="style.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="content">
<div id="header" align="center">
<a href="index.php"><img src="img/logo.png" style="margin-top:15px;" border=0 alt=""/></a>';



echo'
<br/><br/><br/><br/><div id="con">
<div class="right"></div>
<div class="left"></div>
<div class="center">
<p class="title">Admin Panel</p>';

if($user && $pass)
{
if($user!=$admin & $pass!=$password)
{
echo'Wrong Password!!!';
}
else
{
if(session_start!=false)
$_SESSION['logged']=true;
echo'You are logged in';
}
}

if($_SESSION['logged']===true)
{
echo'<br/><br/><form action="index.php" method="post">USER<input type="text" name="user"/><br/><br/>PASS<input type="password" name="pass"/>
<br/><br/><input type="submit" value="Влез"/></form>';
}
else
{
echo'logged in';
}
echo'</div>


</div>

</div>
</div>
</body>
</html>';
[/u]
 
<?php
session_start();
$user=$_POST['user'];
$pass=$_POST['pass'];
$admin=katsar0v;
$password=215581;
include('config.php');
echo'
<!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" lang="en" xml:lang="bg">
<head>

<title>Портфолиото на Кацаров</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link href="style.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="content">
<div id="header" align="center">
<a href="index.php"><img src="img/logo.png" style="margin-top:15px;" border=0 alt=""/></a>
<br/><br/><br/><br/><div id="con">
<div class="right"></div>
<div class="left"></div>
<div class="center">
<p class="title">Admin Panel</p>';

if($user & $pass)
{
if($user==$admin & $pass==$password)
{
$_SESSION['logged']==true;
echo'ok';
}
else
{
echo'wrong pass';
}
}
if($_SESSION['logged']==false)
{
echo'
<form action="index.php" method="post"><input type="text" name="user"><br/><br/><input type="password" name="pass"><br/><br/>
<input type="submit" value="submit"/>';
}
echo'
</div>
</div>
</div>
</div>
</body>
</html>';
?>


и така не става :(
 
<?php
session_start();
$user=$_POST['user'];
$pass=$_POST['pass'];
$admin='katsar0v';
$password='215581';
include('config.php');

if($user && $pass)
{
if($user=$admin && $pass=$password)
{
$_SESSION['log']==true;
}
}
if($_SESSION['log']==true)
{
echo'Logged123';
}
else
{
echo'<center><form action="index.php" method="post"><input type="text" name="user"/><br/><br/><input type="password" name="pass"/><br/><br/>
<input type="submit" value="Submit"/></form>';
}
echo'
</div>
</div>
</div>
</div>
</body>
</html>';

Ами сесиите не работят и показва

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\p\admin\index.php:1) in C:\xampp\htdocs\p\admin\index.php on line 2

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\p\admin\index.php:1) in C:\xampp\htdocs\p\admin\index.php on line 2
 
318025f39c66d3b2.png
 
Може да ти е сложило някакъв знак.
Конвертирай го до UTF-8 без BOM горе от менюто.
 
живи и здрави , енкодинга му е била майката :)

само че след като се "логна" пак го има логин полето :S
 

Back
Горе