Re: Sessions

From: Pedro Graca (hexkid_at_hotpop.com)
Date: 11/08/03


Date: 8 Nov 2003 18:40:13 GMT

Dan Walker wrote:
> Please can someone provide a nice simple script to test if my php is setup
> properly for sessions. Just a little 2 page thing to prove that it is me
> that is the problem would be excellent. Thanks.

I use this:

<?php
session_start();

if (isset($_GET['reset'])) {
  unset($_SESSION['counter']);
  session_unset();
  session_destroy();
  session_start();
  $_SESSION['counter'] = 0;
}
if (!isset($_SESSION['counter'])) {
  $_SESSION['counter'] = 0;
}

echo 'SID = ', session_id(), '<br/>counter: ',
     $_SESSION['counter'], '<br/>';
echo 'add one -- <a ',
     'href="', $_SERVER['PHP_SELF'], '?reset">reset</a>';
++$_SESSION['counter'];
?>

But I don't know why session_id doesn't change at every reset :o

-- 
.sig


Relevant Pages

  • Re: [PHP] PHP console script vs C/C++/C#
    ... My script is taking a longer time to execute than I want. ... I prefer to write in PHP because that is what I know best. ... This is why I am thinking about rewriting my whole script in a C language. ... Perhaps there are different methods I could be using to speed up execution. ...
    (php.general)
  • Re: How to Add a Feeback Form
    ... I saw nothing in that script that indicates where the form is e-mailed to so ... Greg Maxey/Word MVP ... PHP or not. ... have the support available yet. ...
    (microsoft.public.frontpage.programming)
  • Email form script
    ... I have a web form that posts to a .php ... who cannot run .php on their server. ... Or does anyone have a .asp script that will ... Thank you for choosing FormToEmail by FormToEmail.com ...
    (microsoft.public.scripting.jscript)
  • Re: [PHP] PHP console script vs C/C++/C#
    ... My script is taking a longer time to execute than I want. ... I prefer to write in PHP because that is what I know best. ... thinking about rewriting my whole script in a C language. ... execution of the code. ...
    (php.general)
  • NOCC Webmail <= 1.0 multiple vulnerabilities
    ... "NOCC is a webmail client written in PHP. ... remote code execution, there are two ways of execute arbitrary code on ... is defined in conf.php, by default no path is defined, but script suggests ... echo nl2br); ...
    (Bugtraq)