Home  |  Linux  | Mysql  | PHP  | XML
From:anonymous@anonymous.org Date:Mon Oct  6 13:11:46 2008
Subject:note 86173 added to function.session-set-save-handler
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

Navigate in group php.notes at sever news.php.net
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by PHP Developer
Powered By PHP Consultants