Page 1 of 1

help for session management

Posted: Tue Oct 31, 2006 5:25 am
by sangram_tek
i am establishing a session after varifying users userid and password accesssing from database.

Code: Select all

<?php
session_start();
$uid = $_POST['uid'];
$pass = $_POST['pwd'];
 $_SESSION['uidsession']="$uid";
	$_SESSION['passwordsession']="$pass";
	$URL="./myaccount.php";
     header ("Location: $URL");
	echo '<br /><a href="logout.php?'.SID.'">Log Out</a>';
    }
My Problem is that while user is getting logout ,and once again getting loged in without closing that broweser.
i am finding this error.

Warning: Cannot modify header information - headers already sent by (output started at /hsphere/local/home/teknowed/greatindian.in/marble/myaccount/login.php:16) in /hsphere/local/home/teknowed/greatindian.in/marble/myaccount/login.php on line 345
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:1. Select the correct board for your query. Take some time to read the guidelines in the sticky topic.

Posted: Tue Oct 31, 2006 5:52 am
by Maugrim_The_Reaper
You can only set Headers if nothing has been output to the browser. In login.php ensure no whitespace exists before the opening PHP tag, or after the closing ?> tag.

Posted: Tue Oct 31, 2006 6:22 am
by JayBird
Moved to PHP - Code

Posted: Tue Oct 31, 2006 11:28 am
by sh33p1985
unless you can show us line 16 (or preferably 14-18) cant help you identify where your script is outputting whitespace when it shouldnt be. it could be some variable you have output to test your script and have forgotten to remove. go through your script slowly and make sure there are no occurrences such as this!:P

Posted: Tue Oct 31, 2006 12:39 pm
by wyrmmage