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
https://forums.phpfreaks.com/topic/124688-session-help/
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
https://forums.phpfreaks.com/topic/124688-session-help/#findComment-644022
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
https://forums.phpfreaks.com/topic/124688-session-help/#findComment-644092
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.