The variable 'start' does not seem to register. Any idea? I'm running php 4.1.2 on linux apache 1.3.x.
<?php
// Create a new session or re-establish an existing one.
session_start( );
// If new session, then $count will not be registered
if (!session_is_registered( "count"
)
{
echo "not registered";
echo "<br />";
session_register("count", "start"
;
$count = 0;
$start = time( );
echo "Registering Count: " . $count . "<br/>";
echo "Registering Start: " . $start . "<br />";
}
else
{
echo "registered <br />";
$count++;
echo "Registering Count: " . $count . "<br/>";
echo "Registering Start: " . $start . "<br />";
echo "<br />";
}
$sessionId = session_id( );
?>
<html>
<head><title>Sessions</title></head>
<body>
<p>This page points at session:
(<?=$sessionId?>)
<br>count = <?= $count?>.
<br>start = <?= $start?>.
<p>This session has lasted
<?php
$duration = time() - $start;
echo "$duration";
?>
seconds.
</body>
</html>
I'm learning php. If possible can you supply an example of how to destroy this session with a button? I tried:
<input type="button" name="Destroy"
value="Destroy"
alt="Destroy Session"
onclick="session_destroy()";>
This would save from having to ssh to server & deleteing the session in the \tmp.
Thanks in advance - Keith
<?php
// Create a new session or re-establish an existing one.
session_start( );
// If new session, then $count will not be registered
if (!session_is_registered( "count"
{
echo "not registered";
echo "<br />";
session_register("count", "start"
$count = 0;
$start = time( );
echo "Registering Count: " . $count . "<br/>";
echo "Registering Start: " . $start . "<br />";
}
else
{
echo "registered <br />";
$count++;
echo "Registering Count: " . $count . "<br/>";
echo "Registering Start: " . $start . "<br />";
echo "<br />";
}
$sessionId = session_id( );
?>
<html>
<head><title>Sessions</title></head>
<body>
<p>This page points at session:
(<?=$sessionId?>)
<br>count = <?= $count?>.
<br>start = <?= $start?>.
<p>This session has lasted
<?php
$duration = time() - $start;
echo "$duration";
?>
seconds.
</body>
</html>
I'm learning php. If possible can you supply an example of how to destroy this session with a button? I tried:
<input type="button" name="Destroy"
value="Destroy"
alt="Destroy Session"
onclick="session_destroy()";>
This would save from having to ssh to server & deleteing the session in the \tmp.
Thanks in advance - Keith