note 86173 added to function.session-set-save-handler

From: Date: Mon, 06 Oct 2008 19:11:46 +0000
Subject: note 86173 added to function.session-set-save-handler
Groups: php.notes 
Request: Send a blank email to php-notes+get-145103@lists.php.net to get a copy of this message
if you simply append the information from session variables every time you'll have many multiples for variables each time they are changed. a simple way to do this is explode the data twice to seperate the variable name from the other relevant information and foreach() check against the stored set. here is a little bit of a mess i wrote to do it. assuming stored session variables in both database and passed through function: $buffer = array(); $buffer = explode('|',$sessiondata); $buf1 = array(); $buf2 = array(); $finalbuff = ''; foreach($buffer as $i){ $i = explode(';',$i); foreach($i as $b){ array_push($buf1,$b); } } $buffer = explode('|',$result['data']); foreach($buffer as $i){ $i = explode(';',$i); foreach($i as $b){ array_push($buf2,$b);}} $z = 0; $x = 0; while($buf2[$z]){ while($buf1[$x]){ if($buf2[$z] == $buf1[$x]){ $buf2[($z+1)] = $buf1[($x+1)]; } $x+=2; } $z+=2; } foreach($buf2 as $i){ $finalbuff .= $i; } $sessiondata is the variable passed through the function and $result['data'] is the data stored in an sql database. ---- Server IP: 203.88.112.190 Probable Submitter: 122.105.149.173 ---- Manual Page -- http://www.php.net/manual/en/function.session-set-save-handler.php Edit -- https://master.php.net/note/edit/86173 Del: integrated -- https://master.php.net/note/delete/86173/integrated Del: useless -- https://master.php.net/note/delete/86173/useless Del: bad code -- https://master.php.net/note/delete/86173/bad+code Del: spam -- https://master.php.net/note/delete/86173/spam Del: non-english -- https://master.php.net/note/delete/86173/non-english Del: in docs -- https://master.php.net/note/delete/86173/in+docs Del: other reasons-- https://master.php.net/note/delete/86173 Reject -- https://master.php.net/note/reject/86173 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#145103) next »