",$_REQUEST['OcppServerURL']))))); } if(isset($_REQUEST['MaintainServerURL'])){ $json['MaintainServerURL'] = str_replace("&","&",str_replace(""",'"',str_replace("'","'",str_replace("<","<",str_replace(">",">",$_REQUEST['MaintainServerURL']))))); } if(isset($_REQUEST['ChargeBoxId'])){ $json['ChargeBoxId'] = str_replace("&","&",str_replace(""",'"',str_replace("'","'",str_replace("<","<",str_replace(">",">",$_REQUEST['ChargeBoxId']))))); } if(isset($_REQUEST['chargePointVendor'])){ $json['chargePointVendor'] = str_replace("&","&",str_replace(""",'"',str_replace("'","'",str_replace("<","<",str_replace(">",">",$_REQUEST['chargePointVendor']))))); } if(isset($_REQUEST['OcppSecurityProfile'])){ checkValue("OcppSecurityProfile"); $json['OcppSecurityProfile'] = (int)$_REQUEST['OcppSecurityProfile']; } if(isset($_REQUEST['OcppSecurityPassword'])){ $json['OcppSecurityPassword'] = str_replace("&","&",str_replace(""",'"',str_replace("'","'",str_replace("<","<",str_replace(">",">",$_REQUEST['OcppSecurityPassword']))))); } if(isset($_REQUEST['isEnableLocalPowerSharging'])){ checkValue("isEnableLocalPowerSharging"); $json['isEnableLocalPowerSharging'] = (int)$_REQUEST['isEnableLocalPowerSharging']; } if(isset($_REQUEST['OcppReceiptrURL'])){ $json['OcppReceiptrURL'] = str_replace("&","&",str_replace(""",'"',str_replace("'","'",str_replace("<","<",str_replace(">",">",$_REQUEST['OcppReceiptrURL']))))); } if(isset($_REQUEST['isEnableTTIA'])){ checkValue("isEnableTTIA"); $json['isEnableTTIA'] = (int)$_REQUEST['isEnableTTIA']; } if(isset($_REQUEST['server_addr'])){ $json['server_addr'] = str_replace("&","&",str_replace(""",'"',str_replace("'","'",str_replace("<","<",str_replace(">",">",$_REQUEST['server_addr']))))); } if(isset($_REQUEST['server_port'])){ isNumeric("server_port",65535); $json['server_port'] = (int)$_REQUEST['server_port']; } if(isset($_REQUEST['busVenderId'])){ isNumeric("busVenderId",65535); $json['busVenderId'] = (int)$_REQUEST['busVenderId']; } if(isset($_REQUEST['EquipmentProvider'])){ checkLength("EquipmentProvider",15); $json['EquipmentProvider'] = str_replace("&","&",str_replace(""",'"',str_replace("'","'",str_replace("<","<",str_replace(">",">",$_REQUEST['EquipmentProvider']))))); } if(isset($_REQUEST['TransportationCompanyNo'])){ isNumeric("TransportationCompanyNo",255); $json['TransportationCompanyNo'] = (int)$_REQUEST['TransportationCompanyNo']; } if(isset($_REQUEST['TTIAChargeBoxId'])){ isNumeric("TTIAChargeBoxId",255); $json['TTIAChargeBoxId'] = (int)$_REQUEST['TTIAChargeBoxId']; } if(isset($_REQUEST['evseStation'])){ checkLength("evseStation",15); $json['evseStation'] = str_replace("&","&",str_replace(""",'"',str_replace("'","'",str_replace("<","<",str_replace(">",">",$_REQUEST['evseStation']))))); } // ob_start(); shell_exec('sync;sync;sync'); chdir("/root"); $str_json=json_encode($json);//var_dump($str_json); exec("'./WebService' '4' '".$str_json."'",$output,$return_var); if(count($output)!=0){ $jsone['result'] = "Success"; $jsone['message'] = $json; echo json_encode($jsone); exit; } else{ $jsone['result'] = "Error"; $jsone['message'] = "Something went wrong on machine"; echo json_encode($jsone); return false; exit; } // ob_end_clean(); } function checkValue($id){ if($_REQUEST[$id] != ""){ if(strlen($_REQUEST[$id])!=1){ $jsone['result'] = "Fail"; $jsone['message'] = "You have entered a wrong value on " . $id . ", it should be numeric"; echo json_encode($jsone); exit; } if(!ereg("[0-9]",$_REQUEST[$id])){ $jsone['result'] = "Fail"; $jsone['message'] = "You have entered a wrong value on " . $id . ", it should be numeric"; echo json_encode($jsone); exit; } } } function checkLength($id,$value){ if(strlen($_REQUEST[$id])>$value){ $jsone['result'] = "Fail"; $jsone['message'] = "Length of " . $id . " should be less than ".$value+"(Chinese 5 words)"; echo json_encode($jsone); exit; } } function isNumeric($id,$value){ if($_REQUEST[$id] != ""){ if(!ereg("[0-9]",$_REQUEST[$id])){ $jsone['result'] = "Fail"; $jsone['message'] = "You have entered a wrong value on " . $id . ", it should be numeric"; echo json_encode($jsone); exit; } if($_REQUEST[$id]>$value){ $jsone['result'] = "Fail"; $jsone['message'] = "Value of " . $id . " should be less than ".$value; echo json_encode($jsone); exit; } } } ?>