NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Simulating Login script gives errors


Joined: 16 Apr 2008
Posts: 40
Reply with quote
I am trying to simulate a login scenario but when I run it via Nusphere I get the following messages

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\websites\PHPTest\htdocs\myhelpdesk\CLM\IndexSecureUploads.php:4) in C:\websites\PHPTest\htdocs\myhelpdesk\CLM\IndexSecureUploads.php on line 20

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\websites\PHPTest\htdocs\myhelpdesk\CLM\IndexSecureUploads.php:4) in C:\websites\PHPTest\htdocs\myhelpdesk\CLM\IndexSecureUploads.php on line 20

Warning: Cannot modify header information - headers already sent by (output started at C:\websites\PHPTest\htdocs\myhelpdesk\CLM\IndexSecureUploads.php:4) in C:\websites\PHPTest\htdocs\myhelpdesk\CLM\IndexSecureUploads.php on line 32

My code is as follows

// nusphere complains about this so for debugging purposes I'll hard code the user for the moment
session_start(); // clm 12/04/08 create a server side session


if (isset($_GET['Logout'])) { // clm 12/04/08 log the user out
$_SESSION["user"] = "";
header("Location: $strLogoutLocation"); // clm 12/04/08
}
if (isset($_POST['frmUserNames']) || isset($_SESSION["user"])) { // clm 12/04/08 run the code if the username is set by login page or the session variable is already set
if ($_SESSION["user"] == "") { // clm 12/04/08 If the session user value has yet to be set do it
$_SESSION["user"] = $_POST['frmUserNames']; // clm 12/04/08
} // clm 12/04/08
} else {// clm 12/04/08 if the user hasn't logged in then go to login page
header("Location: $strLogoutLocation");// clm 12/04/08
} // clm 12/04/08
$user = $_SESSION["user"]; // clm 12/04/08

Obviously this is a pain as I use the $user variable as a KEY, surprise surprise.

Works fine on the server. Is there anyway that I can run this locally?
View user's profileFind all posts by southcotSend private message
Veteran

Joined: 06 Jun 2007
Posts: 289
Location: Vancouver, Canada
Reply with quote
The error suggests that output was sent on line 4 of your script. For example, you are doing an echo or print. You cannot have any output before setting a cookie or sending a header.

I do not see the problem in your script source code around line 4. Did you paste the whole script?

_________________
Smile
View user's profileFind all posts by annoSend private messageVisit poster's website
Simulating Login script gives errors
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic