Question about The PHP Group PHP

2 Answers

Logout script with session management in php5

I failed to script a logout web page in php with session management.my script doesn`t get any affect by logging out when the BACK button is pressed.can u help me

Posted by on

  • fetusbata May 11, 2010

    hi, can you give me the code that you made?
    I'll suggest to use cookies because cookies are suited for logging out implementation. As what i have read, session is use for passing the data to another page.

×

2 Answers

  • Level 1:

    An expert who has achieved level 1.

    Corporal:

    An expert that hasĀ over 10 points.

    Mayor:

    An expert whose answer gotĀ voted for 2 times.

    Problem Solver:

    An expert who has answered 5 questions.

  • Contributor
  • 15 Answers

Just create a logout.php script with the following

<?php
session_start();
session_destroy();

header("Location: index.php");
?>

Have your logout button/link/whatever just open that page which connects to the session with session_start. Session destroy does exactly what it sounds like... it unsets all session data and tells the server to end the session. The header request then just re-directs the user to whatever page you want after (just change out index.php)

Posted on Mar 17, 2009

  • djroot2 Mar 17, 2009

    I should have added the following between the session_start() and session_destroy() as session_destroy doesn't actually unset the variables and won't delete any cookies set.

    $_SESSION = array();

    if (isset($_COOKIE[session_name()])) {
    setcookie(session_name(), '', time()-42000, '/');
    }


×

  • Level 1:

    An expert who has achieved level 1.

  • Contributor
  • 3 Answers

If it doesnt take effect its probably not actualy exicuting your logout script right.

the main part would be that it does this... (eg. level session)
unset($_SESSION['level']);

as soon as thats happend the session should be gone

oo and its worth double looking out for having ..
session_start();
.. in there,
little line im always forgetting yet its so important

Posted on Feb 06, 2009

1 Suggested Answer

6ya6ya
  • 2 Answers

SOURCE: I have freestanding Series 8 dishwasher. Lately during the filling cycle water hammer is occurring. How can this be resolved

Hi,
a 6ya expert can help you resolve that issue over the phone in a minute or two.
best thing about this new service is that you are never placed on hold and get to talk to real repairmen in the US.
the service is completely free and covers almost anything you can think of (from cars to computers, handyman, and even drones).
click here to download the app (for users in the US for now) and get all the help you need.
goodluck!

Posted on Jan 02, 2017

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

2 Answers

.i am planning to open


You need Register the Domain Name first then Design the website in any one of the web languages here you quoted..So no need to study all the Languages study only the advance and currently popular among the people..For registering the Domain name You can reach here http://www.thewebpole.com/

Apr 24, 2011 | Computers & Internet

Tip

Auto End Tasks to Enable a Proper Shutdown


This reg file automatically ends tasks and timeouts that prevent programs from shutting down and clears the Paging File on Exit.

* Copy the following (everything in the box into notepad).

QUOTE
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management]
"ClearpageFileatShutdown"=dword:00000001

[HKEY_USERS\.DEFAULT\Control Panel\Desktop]
"AutoEndTasks"="1"

[HKEY+LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control]
"WaitToKillServiceTimeout"="1000"

* Save the file as shutdown.reg
* Double click the file to import into your registry.

NOTE: If your anti-virus software warns you of a "malicious" script, this is normal if you have "Script Safe" or similar technology enabled.

Good luck!

on Dec 23, 2009 | Computers & Internet

1 Answer

Please i want php script for image uploading in to wordpress upload folder


when you add a page or post from wordpress admin you get a image icon above the description textarea box to add images to the wordpress site

Other way is there is media manager in wordpress admin where you can upload images through that and make the gallery of images

Mar 08, 2010 | The PHP Group PHP

1 Answer

Parse error: syntax error, unexpected '<' in /home/nicoc/public_html/file.php on line 15


Contact the owner of the 'nicoc' account on the web-site.
The 'file.php' page, written in the PHP scripting-language, has a "bug" in the programming.

Nov 16, 2009 | Microsoft Windows XP Professional

1 Answer

Web disign - php issues


see the form which you downloaded is in html, so there is no issue of compatibility b/w php versions, and the way the file of this form are present in your system you must upload all the files in similar manner else you will face same problem continuously

Nov 05, 2009 | Adobe Dreamweaver CS3 ( Windows ) for PC...

1 Answer

My email ID is- mona_punjabi1286@yahoo.com. I unable to logout from my email account. when i am clicking on sign out, its say wait and after some time- page cannot be displayed is reflecting.


Hay! Mona,
This is Neeraj Singh from Allahabad. I found your problem via FIXYA.com

"My email ID is- mona_punjabi1286@yahoo.com. I unable to logout from my email account. When I am clicking on sign out, it’s say wait and after some time- page cannot be displayed is reflecting. "

If you unable to logout from your mail then you can restart your PC, Your all start session will be end automatically and you are able to safely logout from your mail.

These problems occur while server going to bad response.

May 31, 2009 | Microsoft Windows Vista Home Premium...

1 Answer

Logout problem


Hey,
what code are you using to destroy the session?

should look something like this
e.g. getting rid of email session
<?php
unset($_SESSION['email']);
?>

Jan 16, 2009 | The PHP Group PHP

1 Answer

Clarification


are you saying you're switching from a session variable to a cookie?

delete the cookie altogether by setting the expiration to a time in the past (negative value). don't forget that you'll then have to reload a page in order to reread the cookie data.

so if you have a cookie with a logged_in value = true, and you set it to logged_in value = false, you're still logged_in = true, until you reload that page (or another page) and it rereads the cookie data and now determines that logged_in = false.

make sense? write the logged_in=false to the cookie, then force a url redirection to reload the page is my suggestion.

Jan 13, 2009 | The PHP Group PHP

Not finding what you are looking for?
The PHP Group PHP Logo

Related Topics:

1,233 people viewed this question

Ask a Question

Usually answered in minutes!

Top The PHP Group Computers & Internet Experts

dhnguyen

Level 2 Expert

278 Answers

Computer Links

Level 3 Expert

2385 Answers

Mike

Level 3 Expert

4334 Answers

Are you a The PHP Group Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...