473,385 Members | 1,782 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

logout script

hey guys ...
can anybody tell me a php logout script.
I want to log out from one page which i was developing ,
i tried but it's not working. I have tried
session_destroy(),session_unset() functions
but they are not working.
If any one is having that script then please help me .

Apr 13 '07 #1
7 9331
pank wrote:
hey guys ...
can anybody tell me a php logout script.
I want to log out from one page which i was developing ,
i tried but it's not working. I have tried
session_destroy(),session_unset() functions
but they are not working.
If any one is having that script then please help me .
Session_destroy should destroy all variables you have set in $_SESSION

Are you saying that the Session state is kept even after you close all
browsers?

Are you sure you're not using other cookies rather than Session data?

Apr 13 '07 #2
Tyno Gendo wrote:
pank wrote:
>hey guys ...
can anybody tell me a php logout script.
I want to log out from one page which i was developing ,
i tried but it's not working. I have tried
session_destroy(),session_unset() functions
but they are not working.
If any one is having that script then please help me .

Session_destroy should destroy all variables you have set in $_SESSION
No it does NOT. They are valid as long as the script runs. A call to
$_SESSIONS=array(); after the session_destroy() clears the session
variables.

Sh.
Apr 13 '07 #3
On 13 Apr, 20:48, Schraalhans Keukenmeester <bitbuc...@invalid.spam>
wrote:
Tyno Gendo wrote:
pank wrote:
hey guys ...
can anybody tell me a php logout script.
I want to log out from one page which i was developing ,
i tried but it's not working. I have tried
session_destroy(),session_unset() functions
but they are not working.
If any one is having that script then please help me .
Session_destroy should destroy all variables you have set in $_SESSION

No it does NOT. They are valid as long as the script runs. A call to
$_SESSIONS=array(); after the session_destroy() clears the session
variables.

Sh.
Does it HAVE to be that way around? I usually do it the other way
around: session_destroy then $_SESSIONS=array() and it works fine for
me.

If the original poster is doing this and still has problems; I would
suggest checking the session name on your logged in pages and also the
logging out page. Use the session_name() function to see this.
Personally I always use a custom session name for `security` purposes.

Apr 14 '07 #4
FrobinRobin wrote:
On 13 Apr, 20:48, Schraalhans Keukenmeester <bitbuc...@invalid.spam>
wrote:
>Tyno Gendo wrote:
>>pank wrote:
hey guys ...
can anybody tell me a php logout script.
I want to log out from one page which i was developing ,
i tried but it's not working. I have tried
session_destroy(),session_unset() functions
but they are not working.
If any one is having that script then please help me .
Session_destroy should destroy all variables you have set in $_SESSION
No it does NOT. They are valid as long as the script runs. A call to
$_SESSIONS=array(); after the session_destroy() clears the session
variables.

Sh.

Does it HAVE to be that way around? I usually do it the other way
around: session_destroy then $_SESSIONS=array() and it works fine for
me.

If the original poster is doing this and still has problems; I would
suggest checking the session name on your logged in pages and also the
logging out page. Use the session_name() function to see this.
Personally I always use a custom session name for `security` purposes.
I was a bit ambiguous in my phrasing. I use the same order you do.
technically I don't think there's much against the other way around,
from a logical point of view I think 'yours' is the preferred.

Sh.
Apr 14 '07 #5
Schraalhans Keukenmeester wrote:
FrobinRobin wrote:
>On 13 Apr, 20:48, Schraalhans Keukenmeester <bitbuc...@invalid.spam>
wrote:
>>Tyno Gendo wrote:
pank wrote:
hey guys ...
can anybody tell me a php logout script.
I want to log out from one page which i was developing ,
i tried but it's not working. I have tried
session_destroy(),session_unset() functions
but they are not working.
If any one is having that script then please help me .
Session_destroy should destroy all variables you have set in $_SESSION
No it does NOT. They are valid as long as the script runs. A call to
$_SESSIONS=array(); after the session_destroy() clears the session
variables.
Indeed. I've only ever used session_destroy() as the last statement
before quitting the page, so I never noticed. Seems a bit crap, after
all, you're asking it to 'destroy' the session, does anyone have a use
for destroying it and _still_ retaining the variables until script end?
Apr 15 '07 #6
Tyno Gendo wrote:
Schraalhans Keukenmeester wrote:
>FrobinRobin wrote:
>>On 13 Apr, 20:48, Schraalhans Keukenmeester <bitbuc...@invalid.spam>
wrote:
Tyno Gendo wrote:
pank wrote:
>hey guys ...
> can anybody tell me a php logout script.
>I want to log out from one page which i was developing ,
>i tried but it's not working. I have tried
>session_destroy(),session_unset() functions
>but they are not working.
> If any one is having that script then please help me .
Session_destroy should destroy all variables you have set in $_SESSION
No it does NOT. They are valid as long as the script runs. A call to
$_SESSIONS=array(); after the session_destroy() clears the session
variables.

Indeed. I've only ever used session_destroy() as the last statement
before quitting the page, so I never noticed. Seems a bit crap, after
all, you're asking it to 'destroy' the session, does anyone have a use
for destroying it and _still_ retaining the variables until script end?
I never destroy a session. Rather, I unset variables which are no
longer needed. Destroying a session might make other pages start to fail
because of session variables they use.

And maybe the site doesn't have this potential problem now - but what
about later? It's things like this which take hours (or days) to track
down.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Apr 15 '07 #7
Jerry Stuckle wrote:
Tyno Gendo wrote:
>Schraalhans Keukenmeester wrote:
>>FrobinRobin wrote:
On 13 Apr, 20:48, Schraalhans Keukenmeester <bitbuc...@invalid.spam>
wrote:
Tyno Gendo wrote:
>pank wrote:
>>hey guys ...
>> can anybody tell me a php logout script.
>>I want to log out from one page which i was developing ,
>>i tried but it's not working. I have tried
>>session_destroy(),session_unset() functions
>>but they are not working.
>> If any one is having that script then please help me .
>Session_destroy should destroy all variables you have set in
>$_SESSION
No it does NOT. They are valid as long as the script runs. A call to
$_SESSIONS=array(); after the session_destroy() clears the session
variables.

Indeed. I've only ever used session_destroy() as the last statement
before quitting the page, so I never noticed. Seems a bit crap, after
all, you're asking it to 'destroy' the session, does anyone have a use
for destroying it and _still_ retaining the variables until script end?

I never destroy a session. Rather, I unset variables which are no
longer needed. Destroying a session might make other pages start to fail
because of session variables they use.

And maybe the site doesn't have this potential problem now - but what
about later? It's things like this which take hours (or days) to track
down.
<coughI wish I could say "I haven't got the faintest idea what you
mean Jerry" </cough;-)

Sh.
Apr 15 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Harlin Seritt | last post by:
I have a remote linux server where I can only access it via ssh. I have a script that I need to have run all the time. I run like so: python script.py & It runs fine. When I log off ssh I...
5
by: Michael D. Jones | last post by:
Hi all, I would like to have a delay on a logout page. Here is what I have so far: logout.aspx ----------- Page_Load() FormsAuthentication.SignOut(); Thread.Sleep(5000);
12
kamill
by: kamill | last post by:
I have done a logout page for logout from admin section and provides a link to logout from admin section.Whenever i clicked on logout link it redirected to index.php of admin section......BUT when i...
2
by: muchexie | last post by:
I have created a log in system and logging in is functioning but logging out is not working its showing error warnings. logout.php <? //include function files for this application...
10
by: chaos | last post by:
How to do logout alert message when i press on the logout image <a href="../logout.php" target="_top" onClick="return logout()"...
7
by: thesti | last post by:
hi, i'm learning and trying to develop a web with php. the logout script of mine seems not working since that after i pressed the logout link. i still get the greeting "welcome, 'username' ". ...
6
by: Thiago Macedo | last post by:
I could not find on the web a complete solution for this task. This is not the perfect solution, because it's doesn't have the ability to log the logout if browser crash or user leave it open while...
10
by: DavidPr | last post by:
When I logout as one user and log in under a different user, it opens with the last user's information. User 1 - Unsername: Davey Jones User 2 - Unsername: David Smith I log out from Davey...
1
by: phpuser123 | last post by:
Hi,I have created a script where I want to use onclick event and javascript to log out.Here r my coodes .. <script type="text/javascript"> function logout(){ <?php...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.