hi there all...
Hope you guys are in best of health..
okay.. here's a question about session
that has been bugging me for the past few nights..
before that, just wanna tell that my GLOBAL are off by default
and i have change the /tmp in the session.save_path to "C:\Program Files\PHP\tmp"
i'm using Apache 1.3, PHP 4.3.0, on WIN2k SP3.
fisrt of all... i have a page 'begin_session.php'
which register a session
then i have the 'session.php',
which i check if the variables been carried foward or not...
then there is this 'end_session.php', destroying the session.
my question is..
Why is it that the file in my tmp file (set in php.ini)
for that session is not deleted when i uses the
unset($_SESSION['name']) command? is it supposed to be like that?
the file = sess_7e7566356f55bfeaa18bc536ce1bf375 [0kb]
I know there's this session_destroy(); thingy..
but it seems not to work, if swap it with session_start();
in my 'end_session.php'. have i dont wrong anywhere...??
what's the correct way to use session.. i studied some tutorial,
(especially the 'count' one), it doesnt really work that well...
the count doesnt increase when i refresh my page...
Do i have to use session_start(); on EVERY page??
so to make things a bit clearer.. here's my code...
Thanks in advanced....
<?php
//this is my begin_session.php
session_start();
$_SESSION['name'] = "jassh";
echo $_SESSION['name'];
echo "<BR>";
echo "<A HREF=session.php>SESSION2</A>";
?>
<?php
// this is my session.php
session_start();
$myname = $_SESSION['name'];
echo $myname;
echo "<BR>";
echo "<A HREF=end_session.php>DESTROY SESSION</A>";
?>
<?php
//my end_session.php
session_start(); //why is it when i change this to session_destroy(); it doesnt work.
//when should i uses the session_destroy() ??
unset($_SESSION['name']);
echo "Session Destroyed";
echo "<BR>";
echo "<A HREF=session.php>SESSION2</A>";
?>
//and lastly.. here's the tutorial that start the confusion..
<?
//this is my session_tutorial.php. the value does not increase when i refresh my page
session_start();
session_register('count');
$count++;
echo "<P>You've been here $count times.</p>";
?>