<?php
	$data=$_GET['r_id'].",".$_GET['l_id'].",".$_GET['p_id'].",'".$_GET['lat']."','".$_GET['lng']."'\n";
	$filepath = "./data/route/route_data".$_GET['r_id']."_".$_GET['l_id'].".csv";
	//file_put_contents($filepath,$data);

	if($_GET['p_id']==1){
		$fp = fopen($filepath, "w");
		chmod($filepath,0666);
	}else{
		$fp = fopen($filepath, "a");
	}
	if(flock($fp,LOCK_EX)){
		@fwrite($fp, $data);//通過バス停情報を書き込む
	}
	fclose($fp);
?>