You are here: Re: Session termination issue « PHP Programming Language « IT news, forums, messages
Re: Session termination issue

Posted by David Haynes on 06/19/06 00:38

Geoff Berrow wrote:
> Message-ID: <1150645209.331434.17340@f6g2000cwb.googlegroups.com> from
> TristaSD contained the following:
>
>> I tried to follow php.net manual to the best of my ability, but I'm
>> getting two errors now:
>>
>> Warning: session_start(): Cannot send session cache limiter - headers
>> already sent
>> Warning: Cannot modify header information - headers already sent by
>>
>> All I want to do is create a login page that starts the session, and a
>> logout page that destroys the session. I'm having a hell of a time.
> Logout.php
> <?php
> session_start();
> session_destroy();
> header("Location: login.php");
> exit;
> ?>

My logout is a little more involved:

<?php
require_once('autoload.inc');
require_once('redirect.inc');

session_start();

$sessionName = session_name();
$sessionCookie = session_get_cookie_params();

session_destroy();

setcookie($sessionName, false, $sessionCookie['lifetime'],
$sessionCookie['path'], $sessionCookie['domain'],
$sessionCookie['secure']);

redirect('/ctrl/login.ctrl.php');
?>

-david-

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация