Re: first time session values are not seeting in variable they are setting second

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello dear , 
If you are using session_start() before anything is outputted to the
    browser.
   
http://in.php.net/session_start

And in the page lgoincheck.php you have not started it , am I right ? I think this is the main pblm . I have not tried it .
It will be better to output the session values and check . eg : print_r( $_SESSION ); 

Hari K T

http://www.harikt.com/
http://ijust4u.blogspot.com/


--- On Fri, 13/2/09, malayappa2000 <malayappa@xxxxxxxxxxxxxxxxxx> wrote:
From: malayappa2000 <malayappa@xxxxxxxxxxxxxxxxxx>
Subject:  first time session values are not seeting in variable they are setting second
To: php-objects@xxxxxxxxxxxxxxx
Date: Friday, 13 February, 2009, 10:29 PM











    
            hi fallowing is my logincheck page

------------ --------- --------- ---

lgoincheck.php



include "config.php" ;



$mainU=$_POST[ 'username' ];

	$mainP=$_POST[ 'password' ];

	$exQ=mysql_query( "SELECT * FROM ztext_register WHERE username =

'".$mainU."' " ) or die(mysql_error( ));

	$fx = mysql_fetch_ array($exQ) ;

	$userid=$fx[ 'userid'] ;

	$username=$fx[ 'username' ];

	$password=$fx[ 'password' ];

	$email=$fx[' email'];

	$status=$fx[ 'blocked' ];

	

	echo "username db is".$username. "<br>";

	echo "username  db is".$userid. "<br>";

	if($status== 'y')

	{

	echo '<script>window. location= "blockmsg. php";</script> ';

	 } 



	if($mainU==$ fx['username' ])

	{

		if($mainP ==$fx['password' ])

		{     

			$_SESSION['userid' ]=$userid;

			$_SESSION['username ']=$fx['username '];

            

			echo '<script>window. location= "userhome. php";</script> ';

		     }			

				

	else

	echo "password not correct";

      echo '<script>window. location= "index.php? step=1";< /script>' ;

}

else

echo "user name not correct";

echo '<script>window. location= "index.php? step=1";< /script>' ;

  	?>



fallowing is user home page.



------------ --------- --------- -



<?php session_start( );

include "config.php" ;

$username=$_ SESSION[' username' ];

echo "$username". "hi";

?>

when i try to login first time iam uable to get the username in

userhome page.



if try to login second time i am able to login 

because firts time session values are not setting .

only second time session values are setting plesae provide some help




 

      

    
    
	
	 
	
	








	


	
	


      Unlimited freedom, unlimited storage. Get it now, on http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html/

[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux