prepare("select lastdate, userip from vpnuser where vuser='" . $username . "' and vpass = '" . $password . "'"); $data->execute(); $row = $data->fetch(PDO::FETCH_ASSOC); if (empty($row)) { echo json_encode([ "status" => 401, "message" => "Email and password are not matched with our record!", ]); return; } else { if (strtotime($row['lastdate']) < time()) { $status = 404; } else { $status = 200; } if ($address == '') { if ($optimize_server && $optimize_server != "") { if ($platform == 'Android' || $platform == 'iOS') { $data = $db->prepare("select ipname, ip, id, config, country, protocol, port, tcp from vpnlinek where ip = '" . $optimize_server . "' and protocol in ('IKEV2', 'OpenVPN')"); } else if ($platform == 'Mac') { $data = $db->prepare("select ipname, ip, id, config, country, protocol, port, tcp from vpnlinek where ip = '" . $optimize_server . "' and protocol in ('IKEV2', 'OpenVPN')"); } else { $data = $db->prepare("select ipname, ip, id, config, country, protocol, port, tcp from vpnlinek where ip = '" . $optimize_server . "'"); } } else { if ($platform == 'Android' || $platform == 'iOS') { $data = $db->prepare("select (select count(vu.nasip) from vpnuser vu where vu.nasip = vl.address group by vu.nasip) as count, vl.* from vpnlinek vl where vl.is_auto = 1 and vl.su=1 and vl.protocol in ('IKEV2', 'OpenVPN') order by count"); } else if ($platform == "Mac") { $data = $db->prepare("select (select count(vu.nasip) from vpnuser vu where vu.nasip = vl.address group by vu.nasip) as count, vl.* from vpnlinek vl where vl.is_auto = 1 and vl.su=1 and vl.protocol in ('IKEV2', 'OpenVPN', 'L2TP') order by count"); } else { $data = $db->prepare("select (select count(vu.nasip) from vpnuser vu where vu.nasip = vl.address group by vu.nasip) as count, vl.* from vpnlinek vl where vl.is_auto = 1 and vl.su=1 order by count"); } } } else { $data = $db->prepare("select ipname, ip, id, config, country, protocol, port, tcp from vpnlinek where ip = '" . $address . "' and protocol = '" . $protocol . "'"); } $data->execute(); $row_server = $data->fetch(PDO::FETCH_ASSOC); echo json_encode([ "status" => $status, "data" => $row, "server" => $row_server ]); } } else { echo json_encode([ "status" => 401, "message" => "Email, password are required!", ]); return; } ?>