i have found that there is very bad idea that when we cant access to mysql from remote client (because of any reason e.g dynamic ip of client) we use xml output because xml output have many boring laws for special character and this can make many problems especially for utf-8 charset.

so i use this simple methed for transfering data from a server to another server and synchronize second server with first server:

this code in first server was ran:

<?php
function data_export($parameters){
$prices=array();
$r=db_query('select * from mytable where %s',$parameters);
while($row=db_fetch_array($r)) $data[$row['pk_table']]=$row[]
var_export($data);
}
data_export();
?>

and this code in second server was ran:

<?php
    $handle = fopen("http://firstserver/file_path", "r");
    $xml = "";
    if ($handle)
    {
       while (!feof($handle))
       {
           $xml .= fread($handle, 100000);
       }
        fclose($handle);
    }
	$xml='return '.$xml.';';
    $func_name=create_function('',$xml);
	$data=call_user_func($func_name);
print_r($data);
?>

data was transfered!
keywords may be you use for find this:

print_f output

,

var_export

,

array to xml

,

xml to array

Comments

esmailzadeh’s picture

print_f output ===>

print_r output array

array data transfer

Sikian’s picture

Could this be used to see if the actual user is from any role?

I mean:
I want only "staff" user to have access to a node, may this code help me do that?

Thank you very much in advance!

esmailzadeh’s picture

i cant understand what exactly you want to do that.
this code snippet is for transfering data from a server to another server
this still have not any role checking.

Sikian’s picture

Ok, thank you very much^^

I'm just looking for a code to check the actual user's role for accessing the node I want.