Jump to content

session help ...


imarockstar

Recommended Posts

For some reason ... my sessions are not clearing .. is there anything wrong with this ...

 

 


<?php


   if (isset($_SESSION['username'])){
      //echo "User : ".$_SESSION['username'];
      session_destroy();
      
      echo "
      
<div class=deleted>
You have been logged out of the job board !
</div>
      
      ";
      
      
   } 
   
   else {
   	  echo "Please log back into the admin section.";
   }

?>


Link to comment
Share on other sites

sorry i should of gave you the full code .... I am using start session ... whats wierd that this works fine on my nix box .. .but when i put it on a windows server . it doest work ..

 

 

 


<?php
    session_start();

$pgTitle = "Technology Staffing Services";
$pgMetaDescription = "Technology Staffing Services";
$pgMetaKeywords = "Technology Staffing Services";
$pgHead = "";
$style = 2;

include("includes/head.php");
include("includes/connect.php");
?>
<?php include("includes/header.php"); ?>
<?php include("includes/nav.php"); ?>	
<?php include("includes/slider.php"); ?>	









<!-- interior content wrapper start #intwrapper -->
<div class=intwrapper>			

<!-- left side start #leftside -->			
<div class='leftside body'>



<h2 class=>Admin Logout</h2>



<?php


   if (isset($_SESSION['username'])){
      //echo "User : ".$_SESSION['username'];
      unset($_SESSION['username']);
      
      echo "
      
<div class=deleted>
You have been logged out of the job board !
</div>
      
      ";
      
      
   } 
   
   else {
   	  echo "Please log back into the admin section.";
   }

?>

<br><bR>
<a href='admin_login.php'>log back in</a> 






</div> <!-- #leftside -->		











<?php include("includes/sidebaradmin.php"); ?>
<?php include("includes/footer.php"); ?>
















Link to comment
Share on other sites

The posted code appears to have a newline before the <?php tag. That content would prevent a session from starting, also preventing it from being destroyed.

 

Add the following two lines immediately after your <?php tag -

 

ini_set ("display_errors", "1");
error_reporting(E_ALL);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.