<?php function TestConnection() { $mysqli = new mysqli($_POST['host'], $_POST['user'], $_POST['password'], $_POST['database']); if ($mysqli->connect_errno) { echo '0'; } else { echo '1'; } } if (isset($_POST['process'])) { switch ($_POST['process']) { case 'checkcon': TestConnection(); break; } }
} $PlayerCount = intval($con->real_escape_string($_REQUEST["playercount"])); $TTL = max(min(intval($con->real_escape_string($_REQUEST["ttl"])), $MAX_TTL), 1); $Rev = $con->real_escape_string($_REQUEST["rev"]); if (!CheckVersion($Rev)) { $con->close(); die("Invalid revision"); } $Coderev = $con->real_escape_string($_REQUEST["coderev"]); $IsDedicated = intval($con->real_escape_string($_REQUEST["dedicated"])); $OS = $con->real_escape_string($_REQUEST["os"]); if ($Name === "" || $IP === "" || $Port === "" || $TTL === "" || $PlayerCount === "") { error_log("Incorrect parameters " . $Name . " " . $IP . " " . $Port . " " . $TTL . " " . $PlayerCount . " "); $con->close(); die("Incorrect parameters"); } //Don't allow buggy Linux server versions, Windows server (ICS) is ok if (($Coderev == "r4179" || $Coderev == "r4185") && $_SERVER['HTTP_USER_AGENT'] != "Mozilla/4.0 (compatible; ICS)") { $con->close(); die("Please download the server update"); } $Pingable = intval(TestConnection($IP, $Port)); db_init($con); Remove_Old_Servers($con); $Expiry = date("Y-m-d H:i:s", time() + $TTL); $query = "REPLACE INTO Servers (IP, Port, Name, Players, Pingable, Dedicated, OS, Rev, CodeRev, Expiry) VALUES ('{$IP}', {$Port}, '{$Name}', {$PlayerCount}, {$Pingable}, {$IsDedicated}, '{$OS}', '{$Rev}', '{$Coderev}', '{$Expiry}')"; if (!$con->query($query)) { error_log("Error adding server: " . mysqli_error($con)); } $con->close(); die('success');
$render_params['error_message'] = SetError("Service URL Must be provided"); Render($render_params); } else { if ($_POST && isset($_POST['login'])) { // log in to Mediasite Edas if (get_headers($_POST['svc_url'])) { $_SESSION['svc_url'] = $_POST['svc_url']; try { // instantiate a new client and call login. Login will cache the ticket in the client // but we'll cache it in the SESSION for use in other new clients $client = new ExternalAccessClient($_SESSION['svc_url']); $login_resp = $client->Login($_POST['username'], $_POST['pass'], $_SESSION['application_name'], $_SESSION['impersonation_username']); $_SESSION['userticket'] = $login_resp->UserTicket; $_SESSION['impersonation_username'] = $client->ImpersonationUsername; // use the client which has kept a reference to the user ticket TestConnection($client, $render_params); } catch (Exception $ex) { $render_params['error_message'] = SetError($ex->getMessage()); } } else { $render_params['error_message'] = SetError("Cannot retrieve service url"); } Render($render_params); } else { if ($_POST && isset($_POST['query'])) { //Query Presentations // we no longer have the previously-instantiated client that we used to log in so we need to // create a new one. Then we call QueryPresentationsByCriteria() passing in the cached user ticket. // that ticket will be useful for that method call only; // if we call another method we'll need to supply it with the ticket as well, // because this instance of the client doesn't have a ticket cached