",$_REQUEST['WifiSsid']))))); } if(isset($_REQUEST['WifiPassword'])){ $json['WifiPassword'] = str_replace("&","&",str_replace(""",'"',str_replace("'","'",str_replace("<","<",str_replace(">",">",$_REQUEST['WifiPassword']))))); } if(isset($_REQUEST['WifiDhcpServer'])){ $json['WifiDhcpServer'] = $_REQUEST['WifiDhcpServer']; } if(isset($_REQUEST['WifiDhcpClient'])){ $json['WifiDhcpClient'] = $_REQUEST['WifiDhcpClient']; } if(isset($_REQUEST['WifiIpAddress'])){ $json['WifiIpAddress'] = $_REQUEST['WifiIpAddress']; } if(isset($_REQUEST['WifiSubmaskAddress'])){ $json['WifiSubmaskAddress'] = $_REQUEST['WifiSubmaskAddress']; } if(isset($_REQUEST['WifiGatewayAddress'])){ $json['WifiGatewayAddress'] = $_REQUEST['WifiGatewayAddress']; } if(isset($_REQUEST['TelcomApn'])){ $json['TelcomApn'] = str_replace("&","&",str_replace(""",'"',str_replace("'","'",str_replace("<","<",str_replace(">",">",$_REQUEST['TelcomApn']))))); } if(isset($_REQUEST['TelcomChapPapId'])){ $json['TelcomChapPapId'] = str_replace("&","&",str_replace(""",'"',str_replace("'","'",str_replace("<","<",str_replace(">",">",$_REQUEST['TelcomChapPapId']))))); } if(isset($_REQUEST['TelcomChapPapPwd'])){ $json['TelcomChapPapPwd'] = str_replace("&","&",str_replace(""",'"',str_replace("'","'",str_replace("<","<",str_replace(">",">",$_REQUEST['TelcomChapPapPwd']))))); } if(isset($_REQUEST['TelcomIpAddress'])){ $json['TelcomIpAddress'] = $_REQUEST['TelcomIpAddress']; } if(isset($_REQUEST['TelcomEnabled'])){ $json['TelcomEnabled'] = $_REQUEST['TelcomEnabled']; } if(isset($_REQUEST['TelcomNetworkType'])){ $json['TelcomNetworkType'] = $_REQUEST['TelcomNetworkType']; } // ob_start(); shell_exec('sync;sync;sync'); chdir("/root"); $str_json=json_encode($json); exec("'./WebService' '3' '".$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['result'] = $str_json; $jsone['message'] = "Something went wrong on machine"; echo json_encode($jsone); return false; exit; } // ob_end_clean(); } function checkip($id){ $ip=$_REQUEST[$id]; if($_REQUEST[$id] != ""){ if(ip2long($ip)){ } else{ $jsone['result'] = "Fail"; $jsone['message'] = "You have entered an invalid IP address on " . $id; echo json_encode($jsone); exit; } } } 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(!is_numeric($_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 WifiMode_changed(){ if($_REQUEST['WifiMode']=="0"){ // $_REQUEST['WifiDhcpServer']=1; // $_REQUEST['WifiDhcpClient']=1; $_REQUEST['WifiSsid']=""; $_REQUEST['WifiPassword']=""; } if($_REQUEST['WifiMode']=="1"){ // $_REQUEST['WifiDhcpServer']=1; // $_REQUEST['WifiDhcpClient']=0; } if($_REQUEST['WifiMode']=="2"){ // $_REQUEST['WifiDhcpServer']=0; // $_REQUEST['WifiDhcpClient']=1; $_REQUEST['WifiSsid']=""; $_REQUEST['WifiPassword']=""; } } ?>