Witam posiadam pewien problem w php i nie mogę sobie z nim poradzić. Proszę mnie nie odsyłać do
manuala bo czytałem już
http://pl.php.net/header i nic robie tak jak tam jest pokazane choć próbowałem też innych metod.
Błąd:
Warning: Cannot modify header information - headers already sent by (output started at /httpd/mycms/logowanie.php:1) in /httpd/mycms/logowanie.php on line 2Kod wygląda następująco:
<?php
header("Location: index.php"); ini_set( 'session.use_cookies', 1
); include ("syscms/function.inc.php");
//MySQL
$db_hots = "*******";
$db_root = "*******";
$db_pass = "*******";
$db_name = "*******";
db_connect ($db_hots, $db_root, $db_pass, $db_name);
if( !empty( $_POST['login'] ) && $_POST['haslo'] ) {
//us
$query = mysql_query("SELECT * FROM users WHERE ksywa = '{$_POST['login']}'"); print "Brak loginu ".$_POST['login']." w bazie"; }else{
$querypass = mysql_query("SELECT * FROM users WHERE ksywa = '{$_POST['login']}' and pass = '{$_POST['haslo']}'"); print "Nie poprawne hasło"; }else{
$_SESSION['user'] = $rekord['ksywa'];
$_SESSION['status'] = $rekord['statususer'];
print "<a href="".$_POST['from']."">Zostałeś zalogowany.</a>n"; }
}
}
elseif( $_GET['def'] == 'logout' )
{
print "<a href="".$_SERVER['HTTP_REFERER']."">Zostałeś wylogowany.</a>n"; }
else
{
print "<a href="".$_SERVER['HTTP_REFERER']."">Zostałeś wylogowany.</a>n"; }
?>
Próbowałem też:
<?php
header("Location: index.php"); ?>
<?php
header("Location: index.php"); ?>
Proszę o pomoc.
Ten post edytował Mike122 2.01.2007, 21:45:22