Witam!
Mam problem dotyczący nagłówków i sesji. Otórz zrobilem system logowania którego kod jest podany poniżej:
<?
header ("Expires: Thu, 17 May 2001 10:17:17 GMT"); header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header ("Cache-Control: no-cache, must-revalidate");
if (!isset($_SESSION['SESSION'])) require ( "session_init.php");
if(isset($_SESSION['LOGGEDIN'])){ if($_SESSION['LOGGEDIN'] != TRUE){
header("Location: login.php"); }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="generator" content="Adobe GoLive" />
<title>Admin Login</title>
<link href="admin.css" rel="stylesheet" type="text/css" media="all" />
</head>
<body bgcolor="#ffffff">
<?
require_once 'functions.php';
if (!isset($_SESSION['SESSION'])) require ( "session_init.php"); // echo "<B>".$_SESSION['LOGGEDIN']."</b>";
if($_SESSION['LOGGEDIN'] == TRUE){
header("Location: index.php"); }
if($_POST[user] && $_POST[pass]){
$user=$_POST[user];
$pass=$_POST[pass];
$sql = "SELECT * FROM users WHERE USR_name = '$user' AND USR_passwd = PASSWORD('$pass') ";
$wynik = query($sql);
$_SESSION['LOGGEDIN'] = TRUE;
$_SESSION['USERNAME'] = $user;
@header("Location: index.php"); }
else fail("Podano niewłaściwe dane!");
}
else fail("Proszę podać nazwę użytkownika i hasło.");
?>
<form method="POST" action="login.php" style="margin-top:50px">
<table width="324" border="0" cellspacing="3" cellpadding="0" align="center">
<tr>
<td width="152">
Nazwa użytkownika:</td>
<td><input type="text" size="20" name="user" /></td>
</tr>
<tr>
<td width="152">
Hasło:</td>
<td><input type="password" name="pass" size="20" /></td>
</tr>
</table>
<br>
<br>
<center><input type="submit" value="zaloguj"/></center>
</body>
</html>
(IMG:
http://forum.php.pl/uwaga.gif)
poprawiam
---
nosporGdy to wszystko testowalem lokalnie działało bezproblemowo. Po wrzuceniu tego na serwer zaczelo szales nieziemsko wywalająć mi masębłędów
Cytat
Cannot modify header information - headers already sent by (...)
session_start(): Cannot send session cookie - headers already sent by (...) (
Próbowałem już rzeczy typu ob_start() - ob_flush(), usówanie pustych znaków etc, nie wiem ale jakośnic nie chce działa. Prosze o pomoc jest to BARDZ ważne.
Z góry diękuję.