Hi all,
I have a login page in localhost(website link : www.csoftindia.net) . When I logged in it is showing alternate html "you are logged in as..." but when moving another page like news or other page session is lost either or it is not destroying session.

Subrata

Have you used session_start() in all pages ?

On the header page header.php I used this code.

if(!session_id())
   {
   session_start();
   }

it seems that you are unseting the session on next page

Ok I am giving the user :sn@csoftindia.com and password :328023 of an website www.csoft.com where you can see the changes .
I am unsetting on the logout page.If you see the above will be clear what I want I think.

i am not seeing any changes
on all pages i am seeing

logged in as:
subrata nandi

Hi Baig ,
Yes ,this is done.
I included "include("config.php"); where session is started . Now the code written in every pages as :

if(!empty($_REQUEST['txtuser']) && !empty($_REQUEST['txtpassword']))
          {
    	  $textuser=$_REQUEST['txtuser'];
	  $texstpassword=$_REQUEST['txtpassword'];
	  $sql="select * from mytable where user='$textuser' and               password='$texstpassword'";
          $qry=mysql_query($sql);
          $row=mysql_num_rows($qry);
          $result=mysql_fetch_array($qry);
	  if($row >0)
	     {
	      $_SESSION['user']=$textuser;
	      $_SESSION['firstname']=$result['firstname'];
	      $_SESSION['lastname']=$result['lastname'];
	      }
	  }
       else
         {
         $row = 0;
         }
									  if(empty($_SESSION['textuser']))
	{
	 // NOT LOGGED IN CODE HERE
	}
else
       {
       logged code and html
       }		  
 ?>

and when logout the following code in logout.php page as follows :
<?php
include("common/config.php");
if(!isset($_SESSION))
{
unset($_SESSION);
}
session_destroy();
header("location:index.php");
?>
and that's it.
Subrata
skype id :subrata.nandi4

that's good
please mark the thread solved :)