Hello all,
How to JUMP from one php to another? This is called login.php. If user is a member I want to pass the control to site_summary.php. The current code results in this error:
ERROR ---
Warning: Cannot add header information - headers already sent by (output started at /var/www/docs/my/include/session.inc:10) in
/var/www/docs/my/PHP-samples/login.php4 on line 107
CODE HERE -----
if ( (isset($uname)) && ( $login_attempts < 3 ) )
{
$initialLogin = 1;
// First try members
$res = mysql_query( "SELECT * FROM KRsite WHERE siteUser='$uname' AND encrSitePassword=PASSWORD('$passwd')")
or die ("Unable to get results.");
$row = mysql_fetch_array($res);
$num = mysql_numrows($res);
if ($num != "0")
{
echo "Sucessful login!!!<br>";
$found = 1;
// set session variables
$user = $uname;
$password = $row['encrSitePassword'];
$SiteName = $row["siteName"];
echo "Session variables for member are <br>";
echo "user $user password $password sitename $SiteName<br>";
// Display MEMBER VIEW
header("Location: http://my.kanren.net/PHP-samples/site_summary.php");
//header("./site_summary.php$sid1");
exit(0);
}
else if ($num == "0") // try staff
{
$res = mysql_query( "SELECT * FROM KRstaff WHERE LastName='$uname' AND encrPassword=PASSWORD('$passwd')")
or die ("Unable to get results.");
$row = mysql_fetch_array($res);
$num = mysql_numrows($res);
if ($num != "0")
{
echo "Sucessful login!!!<br>";
$found = 1;
// set session variables
$user = strtolower($uname);
$password = $row['encrPassword'];
$SiteName = "staff";
echo "Session variables for staff are - <br>";
echo "user - $user password - $password sitename - $SiteName<br>";
// Display STAFF VIEW
}
}
if ( !$found ) // neither a member nor a staff user
{
echo "Failed to login. Please enter your username/password again!<br>";
$login_attempts++;
echo "login attempt = $login_attempts<br>";
}
}