homepage Welcome to WebmasterWorld Guest from 54.227.215.139
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Redirect Stumped
Redirecting from login success
mafaz

5+ Year Member



 
Msg#: 3895107 posted 9:54 am on Apr 18, 2009 (gmt 0)

<head>
<title>VPO</title>
<link href="css/hhcss.css" rel="stylesheet" type="text/css" media="handheld" />
</head>

<body>
<div id="title">
<a href="mindex.php"><img src="img/mtitle.gif"</a>
</div>
<?php
include("/data/validate/login.php");
if (isset($_POST['submitted']))
{
//This function has been set to return FALSE no other code
$noUser = valUser ($_POST['uName'], $_POST['pass']);
if ($noUser==true)
{
//No User Found
echo ("<div id=\"error\">Account not found, please try again</div>");
}
else
{
//user successfully authenticated
header("Location:/data/individual/in_home");
exit();
}
}
?>

//The login form is after this code

I get the error header already sent from the same line. Please help, I'm a stumped NEWBIE

 

mafaz

5+ Year Member



 
Msg#: 3895107 posted 10:01 am on Apr 18, 2009 (gmt 0)

Please note that there is a message printed in a div when the username is not valid

mafaz

5+ Year Member



 
Msg#: 3895107 posted 10:26 am on Apr 18, 2009 (gmt 0)

for those who myt be in the same situ:

<?php
include ("data/validate/login.php");
$noUser=false;
if (isset($_POST['submitted']))
{
$noUser = valAccount($_POST['uName'], $_POST['pass']);
if ($noUser=="false")
{
header("Location:data/individual/in_home.php");
exit();
}
}
?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<head>
<link href="css/hhcss.css" rel="stylesheet" type="text/css" media="handheld" />
</head>
<body>
<div id="title">
<a href="mindex.php"><img src="img/mtitle.gif" /></a>
</div>
<?php
if (isset($_POST['submitted']))
{
if ($noUser=="true")
{
echo ("<div id=\"error\">Account not found, please try again</div>");
}
}
?>

coopster

WebmasterWorld Administrator coopster us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3895107 posted 11:30 am on Apr 18, 2009 (gmt 0)

Welcome to WebmasterWorld, mafaz.

You figured it out. You must not send any output to the browser first, not even blank spaces. Details on the header [php.net] manual page.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved