Problem with Redirect
| From: | Ashish Rizal | Date: | Fri, 16 Feb 2007 01:39:11 +0000 |
| Subject: | Problem with Redirect | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-248943@lists.php.net to get a copy of this message | ||
Hi friends, I am having problem with following code.
I have actually made the whole code on same page (login.php) and
the functions that i used in
this code are in functions.php. Now this time it is showing the
warning :
Warning: Cannot modify header information - headers already sent
by (output started at C:\Program
Files\xampp\htdocs\fselection\login.php:1) in C:\Program
Files\xampp\htdocs\fselection\login.php on line 19
The line 19 is header("Location: http://$host$uri/$extra");
Below is the list of code for login.php.
The Server i am using is SunOS 5.10.
<?php
session_start();
require_once 'functions.php';
$UserName = $_POST['UserName'];
$Password = $_POST['Password'];
$host = $_SERVER['HTTP_HOST'];
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
$extra = 'adminlogin.php';
$loc = "\"http://$host$uri/$extra\"";
if ($_POST){
$error = login_check($_POST);
if (trim ($error)=="")
{
$accesslevel = accessLevel($UserName);
?>
<?php
if ($accesslevel == "admin"){
$_SESSION["userid"] = login($_POST);
header("Location: http://$host$uri/$extra");
exit();
}
else if ($accesslevel == "user") {
//echo "this is user";
$_SESSION["userid"] = login($_POST);
header('Location: userlogin.php');
exit();
}
}
else {
print "Error :$error";
}
}
?>
<BODY>
<FORM id=form1 name=loginform method=post>
<TABLE align=center> ........
***********************Login Form Goes Here **********
nothing php Stuffs on this part
</body>
ANy help would be highly appreicated. Thanks