[phplib] file sessions help! From: Jaime López (Jaime.Lopez <email protected>)
Date: 08/29/00

Hi there

I have

I've recently installed PHPLIB 7.2c on PHP-3.0.16 and I needed session
support with files (no database). I've made a single counter example
with two buttons (mysession.php), but it doesnt work as expected.

I have two problems:
- Pushing the "Next" button doesn't seem to reload the page, it uses the
previously cached copy. It works fine disabling the cache in Netscape.
- Calling $sess->delete(); doesn't actually deletes the session files.
In a few there could be thousands of temporary files ...

Any ideas?

Here's the source:
Note: MySession is derived from Session using a CT_File-derived
container.

<?php
  page_open(array("sess" => "MySession"));

  $sess->register("s_counter");

  if (!isset($s_counter)) {
        $s_counter = 0;
  }

  if ($clean_session == 1) {
        $sess->delete();
        page_close();
        header("location: mysession.php");
  }
  $s_counter++;
?>
<HTML>
<SCRIPT LANGUAJE="JavaScript">
  function Guarda(clean_session) {
    document.f.clean_session.value = clean_session;
    document.f.submit();
  }

</SCRIPT>
<CENTER>
<?php
     echo $s_counter."<BR>\n";
?>
 <FORM NAME="f" ACTION="mysession.php">
 <INPUT TYPE="HIDDEN" NAME="clean_session" VALUE="0">
 <INPUT TYPE="BUTTON" VALUE="Next" OnClick='Guarda(0)'>
 <INPUT TYPE="BUTTON" VALUE="Clean" OnClick='Guarda(1)'>
 </FORM>
</CENTER>
</HTML>
<?php page_close(); ?>

Thanks in advance,

-----------------------------------------
Jaime López Jiménez
Instituto de Ingeniería del Conocimiento
Universidad Autónoma de Madrid
Tel. 913.482.340

28049 Madrid
-----------------------------------------