Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

session_destroy() gives warning after session_regenerate_id()

Posted on 2008-11-13
5
Medium Priority
?
1,201 Views
Last Modified: 2012-06-21
I am building this highscore system for a flash game. I am trying to protect this as much as possible. One of the protections is resetting a session id, using session_regenerate_id(). But this gives me an error when trying to destroy this session. I have attached the code i am using, and this gives me an error:

Warning: session_destroy(): Session object destruction failed in /path.to/script.php on line 65

View php info at: http://www.skybox.org/phpinfo.php

What is this error, and how can i make this work?
<?
 
// Start Session - For Cookies
session_start();
// Regenerate session id, keep data
session_regenerate_id();
 
// do stuff
 
// kill session
session_destroy();
// end php
die();
 
?>

Open in new window

0
Comment
Question by:wal_toor
  • 3
  • 2
5 Comments
 
LVL 8

Expert Comment

by:biztiger
ID: 22949308
Please post the output of the code snippet below
<?
 
// Start Session - For Cookies
session_start();
// Regenerate session id, keep data
session_regenerate_id();
 
// do stuff
 print_r($_SESSION);
// kill session
//session_destroy();
// end php
die();
 
?>

Open in new window

0
 
LVL 8

Author Comment

by:wal_toor
ID: 22949623
Output: Array ( [actionLogged] => flashAction )

Thanks.
0
 
LVL 8

Expert Comment

by:biztiger
ID: 22958739
I execute the code on my server and it works perfectly. There is some kinda php.ini configuration problem.

Check out
http://in2.php.net/manual/en/session.configuration.php

To configure your server properly.
0
 
LVL 8

Accepted Solution

by:
biztiger earned 500 total points
ID: 22958792
Very Sorry for my previous comment. Please ignore it

Use session_write_close() to close the session instead of using session_destroy().
0
 
LVL 8

Author Comment

by:wal_toor
ID: 22958952
Okay, i will try this right away. Can you explain me the difference between those?
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question