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]

 



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


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

  Powered by Linux