Jump to content

[SOLVED] session stop?


zang8027

Recommended Posts

I have this php book and it doesn't mention anything about stopping a session.

 

Im using a session to have a log in for this site. Now, i am working on a log out page that will stop the session. Is there a function for that?

 

I guess i could set the session to equal nothing ($_SESSION['priv'] = "") if that even works but is there a better way to make it "sign out" the user?

Link to comment
Share on other sites

another weird problem. It logs it out BUT i get the following error at the top of the page:

 

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/tyzangme/public_html/ClickNDine/html/logout.php:1) in /home/tyzangme/public_html/ClickNDine/html/logout.php on line 2

 

Warning: Cannot modify header information - headers already sent by (output started at /home/tyzangme/public_html/ClickNDine/html/logout.php:1) in /home/tyzangme/public_html/ClickNDine/html/logout.php on line 9

 

 

Here is my code

 

        <?php
		session_start();
		// Unset all of the session variables.
		$_SESSION = array();

		// If it's desired to kill the session, also delete the session cookie.
		// Note: This will destroy the session, and not just the session data!
		if (isset($_COOKIE[session_name()])) {
    			setcookie(session_name(), '', time()-42000, '/');
		}

		session_destroy();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Click N Dine - Online Food Ordering Service</title>
<meta name="keywords" content="Business Travel, Food, Dine Online, Click And Dine, Eat Online, Local Restaurants" />
<meta name="description" content="Click N Dine offers the ability to recieve food from local restaurants from around your area! No need to pick up the phone, just order online, and wait for it at your door!" />
<link rel="stylesheet" href="../css/global.css" media="screen" type="text/css" />
</head>

<body>
<div id="wrapper">
   		<div id="header">
        	<img src="../Images/siteLogo.gif" alt="Click N Dine" id="mainTitle"/>
            <div class="headerText">
            	<p><b>Welcome </b>-  Have an account already? <a href="login.php">Sign In</a></p>
            	<p><a href="#">My Account </a>|<a href="#"> My Receipts</a> | <a href="#">Customer Feedback</a></p>
            </div><!--headerText -->
        </div><!-- header -->
        
        <div id="navigation">
        	<ul>
            	<li><a href="../index.php">Home</a></li>
                <li><a href="findrestaurants.php">Find Restaurants</a></li>
                <li class="Shopping"><a href"#">Cart</a></li>
            </ul>
        </div> <!--navigation -->
        
        <div class="clearingDiv"></div>
        
        <div id="mainMiddle">
<?php
	print "Signed out succesfully";
?>
        </div>
        
        
        <div id="footer">
        <hr />
        <p><span class="subNavText">Home | Find Restaurants | Shopping Cart | My Account | My Receipts | Customer Feedback</span></p>
         <br />
         <p><span class="subNavText">Company Policy | Privacy Statement | Contact Us | Terms of Service </span></p>
        </div>
        
    </div><!-- Wrapper -->
</body>
</html>

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.