note 53983 deleted from ref.session by nlopess
| From: | nlopess@php.net | Date: | Mon, 20 Jun 2005 09:57:05 +0000 |
| Subject: | note 53983 deleted from ref.session by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-90673@lists.php.net to get a copy of this message | ||
Note Submitter: razvan_bc at yahoo dot com
----
#############
******************
chsession.php
******************
------------------------------
<?php
// put/change a new key session's value
// (key,value,url)
//_session["key"]=$value
// redirection to $url
if( (isset($key)and ($key!=null) )and( isset($value)and ($value!=null) ) )
{
session_start();
foreach($_SESSION as $ch => $vl)
{
$savesession[$ch]=$vl;
if(isset($_SESSION[$ch]))
unset($_SESSION[$ch]);
}
$savesession[$key]=$value;
}
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY>
<FORM NAME="f1" METHOD=POST ACTION="chsession2.php?url=<?= $url ?>">
<?php
if( (isset($key)and ($key!=null) )and( isset($value)and ($value!=null)) )
{
foreach($savesession as $ch => $vl)
{
echo('<INPUT TYPE="hidden" NAME="'.$ch.'"
value="'.$vl.'">');
}
}
?>
<INPUT TYPE="submit">
</FORM>
<SCRIPT LANGUAGE="JavaScript">
<!--
document.f1.submit();
//-->
</SCRIPT>
</BODY>
</HTML>
------------------------------
Notes:
now will put all _SESSION values in a new array named $savesession and will destroy old _SESSION
's values
(here unset($_SESSION[$ch]); )
then will redirect page to chsession2.php