$level3 = $_POST['level3']; $clientIP = $_POST['clientIP']; $userId = $_POST['userId']; $typeId = $_POST['typeId']; $id = $level->AddLevel($userId, $clientIP, $level1, $level2, $level3, $typeId); return $id; } else { if ($url === 'selectLevels') { $level = new Level(); $data = $level->GetMiddleValue(); echo json_encode(mysql_fetch_assoc($data)); } else { if ($url === 'isactive') { $myfile = fopen("../db/isActive.txt", "r") or die("Unable to open file!"); echo fread($myfile, filesize("../db/isActive.txt")); fclose($myfile); } else { if ($url === 'mainStat') { $level = new Level(); $data = $level->GetMainStatistic(); $result = array(); while ($row = mysql_fetch_assoc($data)) { $result[] = $row; } echo json_encode($result); } } } } } }