答复: [PHP] header information problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



And if you have some special intent, you can use ob_start().

 
Best regards,
Yang Shiqi
 
 
 
-----邮件原件-----
发件人: yangshiqi [mailto:yangshiqi@xxxxxxxx] 
发送时间: 2004年12月18日 19:36
收件人: 'Ahmed Abdel-Aliem'; 'php-general@xxxxxxxxxxxxx'
主题: 答复:  header information problem

I don't understand why you want to include header.html before you redirect
the users to the login_success.php?

By the way, you 'd better to add mysql_escape_string() with the username and
password to ensure the security of your code. Coz we can't believe any
users' input from web. May be the sql injection with your site.
Just be careful.

Best regards,
Yang Shiqi

-----邮件原件-----
发件人: Ahmed Abdel-Aliem [mailto:me2resh@xxxxxxxxx] 
发送时间: 2004年12月18日 18:52
收件人: php-general@xxxxxxxxxxxxx
主题:  header information problem

Dear Groups members.

i am making a user protected page, the script works excellent on my
local server, but online it gives me this error :

Warning: Cannot modify header information - headers already sent by
(output started at
/home/me2resh/public_html/apex/upload/header.html:10) in
/home/me2resh/public_html/apex/upload/upload.php on line 33

the script of the page is 

<?
if (!isset($ID)){
	include 'header.html';
	echo "No ID is Set.<br>You Got To This Page By Mistake";
	include 'footer.html';
}else{
	session_start();  
	include 'db.php'; 
	include 'header.html';
	$username = $_POST['username']; 
	$password = $_POST['password']; 
	if((!$username) || (!$password)){ 
  		echo "Please enter ALL of the information! <br />"; 
	    include 'login_form.html'; 
	    include 'footer.html'; 
	    exit(); 
	}
	$sql = mysql_query("SELECT * FROM user WHERE User_Login='$username'
AND User_Password='$password'");
	$login_check = mysql_num_rows($sql); 
	if($login_check > 0){
	session_register('ID'); 
    $_SESSION['ID'] = $ID;  
    while($row = mysql_fetch_array($sql)){ 
    foreach( $row AS $key => $val ){ 
        $$key = stripslashes( $val ); 
    } 
        session_register('User_First_Name'); 
        $_SESSION['User_First_Name'] = $User_First_Name; 
        session_register('User_Last_Name'); 
        $_SESSION['User_Last_Name'] = $User_Last_Name;   
        session_register('User_ID'); 
        $_SESSION['User_ID'] = $User_ID;         
        header("Location: login_success.php"); 
    }
	}else{
		include 'header.html';
		echo "You could not be logged in! Either the username and
password
do not match!<br />
   		Please try again!<br />"; 
   		include 'login_form.html'; 
   		include 'footer.html'; 
	}
} 
?>


Can anyone help me with that problem please ?

-- 
Ahmed Abdel-Aliem
www.ApexScript.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux