Page 1 of 1

Can any body tell what wqrong i'm doing !

Posted: Sun May 04, 2003 1:41 am
by anz789
hi ,
i'm checking for the username if it is "usama" then i'm simply redirecting it to login page but it's not working .... it simply prints the user name and warnings ...
the out put of the this php code is
......................OUT_PUT..............................................

usama
Warning: Cannot modify header information - headers already sent by (output started at G:\MS Publishers\Login_test.php:4) in G:\MS Publishers\Login_test.php on line 7
PHP Warning: Cannot modify header information - headers already sent by (output started at G:\MS Publishers\Login_test.php:4) in G:\MS Publishers\Login_test.php on line 7

//..............................................................................

here is the code ....
//////////////////////////////////////////////////////////////////

<?php
require 'functions.php';

echo($DB_LOGIN);
// Check whether the user is already authenticated or not
if($DB_LOGIN=="usama"){
header("Location: http://localhost/default.htm",false);
$DB_LOGIN="";
exit;
}
else if(!authenticateUser( $cookie_user, $cookie_passwd)){
header("Location:http://localhost/display.php");
exit();
}
?>



////////////
i'm using winxp with IIS 5
what is the wrong i'm doing ... Can any budy tell...
Noman.

Posted: Sun May 04, 2003 5:06 am
by twigletmac
Have you read:
viewtopic.php?t=1157

That echo statement:

Code: Select all

echo($DB_LOGIN);
is output.

Mac

Posted: Sun May 04, 2003 5:08 am
by patrikG
you can't have any output before a header-command.

Your code should be working if you modify it likes this:

Code: Select all

<?php
<?php
require 'functions.php';
//echo($DB_LOGIN);
// Check whether the user is already authenticated or not
if($DB_LOGIN=="usama"){
header("Location: http://localhost/default.htm",false);
$DB_LOGIN="";
exit;
}
else if(!authenticateUser( $cookie_user, $cookie_passwd)){
header("Location:http://localhost/display.php");
exit();
}
?>

?>