note 53983 added to ref.session

From: Date: Mon, 20 Jun 2005 09:46:42 +0000
Subject: note 53983 added to ref.session
Groups: php.notes 
Request: Send a blank email to php-notes+get-90667@lists.php.net to get a copy of this message
############# ****************** 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 ---- Manual Page -- http://www.php.net/manual/en/ref.session.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+53983 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53983&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53983&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53983&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53983&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+53983&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53983&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+53983&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#90667) next »