Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Klaida

Parašė moonlike· 2011 Gru. 25 16:12:12
#3

O kaip ištaisyti štai tokią klaidą:

Warning: Cannot modify header information - headers already sent by (output started at /public_html/login_form.php:1) in /public_html/login.php on line 49


Login.php failas:


<?php
 
require_once('db.php');
require_once('users.php');
 
 
function find_user($nick, $pass)
{
    $nick = mysql_escape_string($nick);
 
    $pass = md5($pass);
 
    $sql = mysql_query("SELECT `uid` FROM `vartotojai` WHERE `nick` = '$nick'
            AND `pass` = '$pass'")
            or exit('find_user(): ' . mysql_error());
 
    if (mysql_num_rows($sql) == 0)
    {
        return 0;
    }
    else
    {
        return mysql_result($sql, 0, 'uid');
    }
}
 
function show_form($msg)
{
    echo $msg;
    include('index.php');
    exit();
}
 
 
if (isset($GLOBALS['user']))
    exit(header("Location: user_index.php"));
 
if (isset($_POST['submit']))
{
    $uid = find_user($_POST['nick'], $_POST['pass']);
 
    if ($uid != 0)
    {
        mysql_query("UPDATE `vartotojai` SET `login_time` = '" . time() . "'
            WHERE `uid` = $uid");
			include "login_form.php";
 
        $_SESSION['uid'] = $uid;
        header("Location: user_index.php");
		exit();
    }
    else
    {
		include "login_form.php";
        exit('<script language="JavaScript">alert ("Neteisingas vartotojo vardas arba slaptazodis!")</script>');    
}
    }
else
{
    show_form('');
}
?>