R: [PHP] how to unregister session stored as multidimensional array?
| From: | Sebastian \"En3pY\" Zdrojewski | Date: | Mon, 05 Dec 2005 20:51:37 +0000 |
| Subject: | R: [PHP] how to unregister session stored as multidimensional array? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-226897@lists.php.net to get a copy of this message | ||
Try
<?
@reset( $_SESSION['client'] );
while ( list( $var, $val ) = @each( $_SESSION['client'] ) ) {
if ( $var != 'name' ) unset( $_SESSION['client'][ $val ] );
}
?>
a bit dirty but works... :-/
Sebastian Konstanty Zdrojewski
________________________________
URL: http://www.en3py.net/
E-Mail: en3py@itvc.net
________________________________
Le informazioni contenute in questo messaggio sono riservate e
confidenziali. Il loro utilizzo è consentito esclusivamente al destinatario
del messaggio, per le finalità indicate nel messaggio stesso. Qualora Lei
non fosse la persona a cui il presente messaggio è destinato, La invito ad
eliminarlo dal Suo Sistema ed a distruggere le varie copie o stampe, dandone
gentilmente comunicazione. Ogni utilizzo improprio è contrario ai principi
del D.lgs 196/03 e alla legislazione Europea (Direttiva 2002/58/CE).
-----Messaggio originale-----
Da: afan@afan.net [mailto:afan@afan.net]
Inviato: lunedì 5 dicembre 2005 21.46
A: PHP eMail List
Oggetto: [PHP] how to unregister session stored as multidimensional array?
Is this possible at all:
I have stored info from form in session:
$_SESSION['client']['name'] = 'Name'
$_SESSION['client']['address'] = 'Address'
$_SESSION['client']['city'] = 'City'
$_SESSION['client']['state'] = 'State'
$_SESSION['client']['zip'] = 'Zip
Now, I want to unregister all $_SESSION['client'] info EXCEPT
$_SESSION['client']['name'].
With
session_unregister('client');
I clear everything.
session_unregister('address');
doesn't clear this session.
session_unregister($_SESSION['client']['address']);
doesn't work.
What am I doing wrong?
Thanks for any help.
-afan
--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.362 / Virus Database: 267.13.11/191 - Release Date: 02/12/2005
Attachment: [application/x-pkcs7-signature] smime.p7s
Attachment: [application/x-pkcs7-signature] smime.p7s