Re: cannot read a session in php

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

 



Try phpinfo() and look whether session is enabled in ur server ......

Also never save password as such . Atleast use an md5 . Its never good , especially to see others passwords and it may also make security issues.

Hari K T

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


--- On Thu, 23/4/09, ITP Vision Promotion <itpvision@xxxxxxxxx> wrote:

From: ITP Vision Promotion <itpvision@xxxxxxxxx>
Subject:  cannot read a session in php
To: php-objects@xxxxxxxxxxxxxxx
Date: Thursday, 23 April, 2009, 7:25 PM











    
            
            


      
      Hello

I have built 21 web sites, when I changed hosting, the PHP log in failed, due to failure to read the php session



to the log in pahe:

@session_start( );

if(isset($_POST[ 'user']) && $_POST['user' ] != '' && isset($_POST[ 'pass']) && $_POST['pass' ] != '')

{

$pass = mysql_escape_ string(addslashe s($_POST[ 'pass'])) ;

$user = mysql_escape_ string(addslashe s($_POST[ 'user'])) ;

$query = "select * from table where name = '$user' AND pass = password('$pass' ) ";

$query2 = mysql_query( $query);

	if(mysql_num_ rows($query2) < 1)

	{

		header("location: login.php" );

		exit;

	}

	else

	{

		$_SESSION['user' ] = $user;

		$_SESSION['keylock' ] = "abcd";

		header("location: privatepage. php");

		

	}

}

else

{

	

	header("location: $referer" );

	exit;



}



I reach the private page, here the session cannot be read , and I am redirected to the forbidden page

@session_start( );

if(isset($_SESSION[ 'keylock' ]) && $_SESSION['keylock' ] == "abcd")

{

	$user = $_SESSION['user' ] ;

 	$display = "<br><div align = 'center'> Welcome <b> $user </b> 

	

	<a href = 'signout.php' > <b> &raquo; SIGN OUT </b> </a>

	</div> <br> ";

	require_once( 'header.php' );

	echo $display;

}

else

{

	header("location: forbiden. php");

	exit;

}

The second case is true

I tried to comment the redirection, and 

wrote a varaiable

$d = $_SESSION['keylock' ] ;

echo " session $d ";

I only get an output session, the session cannot be read




 

      

    
    
	
	 
	
	








	


	
	


      Now surf faster and smarter ! Check out the new Firefox 3 - Yahoo! Edition http://downloads.yahoo.com/in/firefox/

[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