form('op') ){ //Imposta un valore ad un array di $_SESSION //esempio: push di un valore in $_SESSION['dashboard']['idtecnici'] //iversed: specifica se rimuovere dall'array il valore trovato e applicare quindi una deselezione (valori 0 o 1, default 1) case "session_set_array": $array = explode( ',', $html->form('session') ); $value = "'".$html->form('value')."'"; $inversed = $html->form('inversed'); $found = false; //Ricerca valore nell'array foreach( $_SESSION[ $array[0] ][ $array[1] ] as $idx => $val ){ //Se il valore esiste lo tolgo if( $val == $value ){ $found = true; if ($inversed == 1){ unset( $_SESSION[ $array[0] ][ $array[1] ][$idx] ); } } } if( !$found ){ array_push( $_SESSION[ $array[0] ][ $array[1] ], $value ); } print_r( $_SESSION[ $array[0] ][ $array[1] ] ); break; //Imposta un valore ad una sessione case "session_set": $array = explode( ',', $html->form('session') ); $value = $html->form('value'); $clear = $html->form('clear'); if( $clear == 1 || $value == '' ){ unset( $_SESSION[ $array[0] ][ $array[1] ] ); } else{ $_SESSION[ $array[0] ][ $array[1] ] = $value; } break; } ?>