<?php


function f_logging($json,$php_file,$IP,$LOGINID,$sync_step,$sync_time,$site_cd){	
	
	
	$url = parse_url($IP);
	//print_r($url['path']);
	$url2 = explode("/",$url['path']);
	//print_r ($url2['1']);
	//print_r ($url2['2']);
	
	$url3 = $url2['1']."/".$url2['2'];
	
	//print_r ($url3);
	//echo $IP;
	$date = date('Y-m-d H:i:s');
	$data = json_decode($json, true);
	
	$sync_time = str_replace(":","",$sync_time);
	
	$uploaddir = "C:\\wamp64\\www\\".$url3."\\mobile_log\\";

	if (!is_dir($uploaddir)) {
		mkdir($uploaddir, 0777, true);
		
	}

    $uploaddir = "C:\\wamp64\\www\\".$url3."\\mobile_log\\".$LOGINID."\\";
	if (!is_dir($uploaddir)) {
		mkdir($uploaddir, 0777, true);
		
	}
	
	//write json to file
if (file_put_contents( $uploaddir.$sync_time."_(".$site_cd.")_".$php_file.".txt","\r\n".$sync_step."\r\n".$IP."\r\n".$date."\r\n".$json."\r\n",FILE_APPEND)){
	
}else{
	
}
 

}

?>