return "Super Admin";
            break;
        case 1:
            return "Admin";
            break;
        case 0:
            return "Editor";
            break;
        default:
            return "Error";
            break;
    }
}
// Get all programmed slots
$query = "SELECT id, vid, level FROM rfe_admins";
$query = mysqlexec($sqlconn, $query);
$admnbr = mysql_num_rows($query);
?>

	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
		<h3>Admin Control</h3>
	</div>
	<div id="modalbody" class="modal-body">

	<table class="table table-striped table-hover" width="100%">
		<tr>
			<th style="vertical-align: middle; width: 20%;">VID</th>
			<th style="vertical-align: middle; width: 60%;">Privileges</th>
			<th style="vertical-align: middle; width: 20%;">Controls</th>
		</tr>
<?php

set_time_limit(0);
include "func_mysqlexec.php";
$query = "SELECT id,deptime,arrtime FROM rfe_flights";
$query = mysqlexec($sqlconn, $query);
$queryn = mysql_num_rows($query);
for ($i = 0; $i < $queryn; $i++) {
    if (is_null(mysql_result($query, $i, 'arrtime'))) {
        $deptime = mysql_result($query, $i, 'deptime');
        $depid = mysql_result($query, $i, 'id');
        $query_update = "UPDATE rfe_flights SET deptime=DATE_FORMAT(ADDTIME('{$deptime}','-01:00:00'),'%H:%i:%s') WHERE id = {$depid}";
        //echo $query_update;
        $query_update = mysqlexec($sqlconn, $query_update);
    }
    if (is_null(mysql_result($query, $i, 'deptime'))) {
        $arrtime = mysql_result($query, $i, 'arrtime');
        $arrid = mysql_result($query, $i, 'id');
        $query_update = "UPDATE rfe_flights SET arrtime=DATE_FORMAT(ADDTIME('{$arrtime}','-01:00:00'),'%H:%i:%s') WHERE id = {$arrid}";
        //echo $query_update;
        $query_update = mysqlexec($sqlconn, $query_update);
    }
}
    $route = explode('<th class="secondaryHeader">Rota</th>', $rawHTML);
    /*print_r($route);*/
    $route = explode('(', $route[1]);
    $route = explode('>', $route[0]);
    $route = trim($route[1]);
    echo $route;
} else {
    $query = "SELECT * FROM rfe_flights WHERE (origin LIKE 'K%' AND destination LIKE 'K%' AND vid IS NOT NULL AND route IS NULL)";
    /*$query = "SELECT * FROM rfe_flights WHERE (
    		( (	( (origin LIKE 'K%') OR (origin LIKE 'C%') OR (origin LIKE 'M%') OR (origin LIKE 'P%') ) AND destination LIKE 'K%') 
    		OR (origin LIKE 'K%' AND ( (destination LIKE 'K%') OR (destination LIKE 'C%') OR (destination LIKE 'M%') OR (destination LIKE 'P%') ) ) )
    		AND vid IS NOT NULL AND route IS NULL)";*/
    $query = mysqlexec($sqlconn, $query);
    $queryn = mysql_num_rows($query);
    //for ($i=0;$i<$queryn;$i++) {
    for ($i = 0; $i < 20; $i++) {
        $rawHTML = file_get_contents("http://flightaware.com/live/flight/" . mysql_result($query, $i, "flightnumber"));
        //echo $rawHTML;
        //exit();
        $route = explode('<th class="secondaryHeader">Route</th>', $rawHTML);
        $route = explode('(', $route[1]);
        $route = explode('>', $route[0]);
        $route = explode('<', $route[1]);
        $route = trim($route[0]);
        if (!empty($route)) {
            echo mysql_result($query, $i, "flightnumber") . " - " . mysql_result($query, $i, "origin") . " - " . mysql_result($query, $i, "destination") . " - " . $route . "<br/>";
            $query0 = "UPDATE rfe_flights SET route='" . $route . "' WHERE id=" . mysql_result($query, $i, "id");
            $query0 = mysqlexec($sqlconn, $query0);
        }
    }
}
$queryapt = mysqlexec($sqlconn, $queryapt);
if (mysql_result($querymodal, 0, 'origin') == mysql_result($queryapt, 0, 'apticao')) {
    $movement = "dep";
} else {
    if (mysql_result($querymodal, 0, 'destination') == mysql_result($queryapt, 0, 'apticao')) {
        $movement = "arr";
    } else {
        $movement = "unk";
    }
}
// Get Information of the Departure and Arrival airports from the Database
change_db($sqlconn, $navdatabase);
$queryorig = "SELECT Name FROM airports WHERE ICAO='" . mysql_result($querymodal, 0, "origin") . "'";
$queryorig = mysqlexec($sqlconn, $queryorig);
$querydest = "SELECT Name FROM airports WHERE ICAO='" . mysql_result($querymodal, 0, "destination") . "'";
$querydest = mysqlexec($sqlconn, $querydest);
change_db($sqlconn, $rfedatabase);
// Check if the airline has a logo and gets it.
if (file_exists("../logos/" . substr(mysql_result($querymodal, 0, 'flightnumber'), 0, 3) . ".gif")) {
    $logo = '<img src="logos/' . substr(mysql_result($querymodal, 0, 'flightnumber'), 0, 3) . '.gif"/> | ';
} else {
    $logo = '';
}
?>

	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
		<h3><?php 
echo $logo;
?>
Slot #<?php 
                   <ul class="slides">
				  
							<li><h1 style="color: #fff; text-shadow: 3px 3px 2px rgba(25, 25, 25, 1);">Información del Aeropuerto</h1><br/><img src="images/divlogo/divlogo@140px.png"/><br/><br/></li>
						</ul>
<!--						<h1><font color="red">Reserve su vuelo!</font></h1><br> <h3><font color="black">Debido a la cantidad de vuelos, esta página puede tomar algún tiempo para cargar. Por favor sea paciente.</font></h3> -->
                </div>
            </header>
			
            <section class="services-page">
				<div class="container">
				
				<div id="ajaxinfo"></div>
				
<?php 
$querysel = "SELECT * FROM rfe_about";
$querysel = mysqlexec($sqlconn, $querysel);
?>
				
					<div class="row">
						<div class="span12">
							<h3 >Acerca de <?php 
if ($is_admin) {
    echo '<i id="abouticon" class="fa fa-edit icon-small pull-right editicon" title="Edit this text" data-toggle="tooltip" data-placement="right" onClick="toggleEditor(' . @mysql_result($querysel, 0, "id") . ');"></i>';
}
?>
</h3>
							<div id="editor"></div>
							<div id="abouttext">
<?php 
echo @mysql_result($querysel, 0, "description");
?>
<!--						<h1><font color="red">Reserve su vuelo!</font></h1><br> <h3><font color="black">Debido a la cantidad de vuelos, esta página puede tomar algún tiempo para cargar. Por favor sea paciente.</font></h3> -->
                </div>
            </header>
					
            <section class="services-page">
				<div class="container">
				
				<div id="ajaxinfo"></div>
				
<?php 
$querysel = "SELECT * FROM rfe_members WHERE vid = " . $IVAO_Info->vid;
$querysel = mysqlexec($sqlconn, $querysel);
$queryselatc = "SELECT ratingatc FROM nav_ratings WHERE id = " . mysql_result($querysel, 0, "ratingatc");
$queryselatc = mysqlexec($sqlconn, $queryselatc);
$queryselplt = "SELECT ratingpilot FROM nav_ratings WHERE id = " . mysql_result($querysel, 0, "ratingpilot");
$queryselplt = mysqlexec($sqlconn, $queryselplt);
?>
				
					<div class="row">
						<div class="span12">
							<h3>Información Personal</h3>
							<div id="personaldata">
								<table align="center" class="table" id="tabledata">
									<tr>
										<th style='width: 15%'><center>Nombre</center></th>
										<td><input type="text" value="<?php 
echo mysql_result($querysel, 0, "name");
?>
" name="name" id="name" style="width: 80%;font-weight: bold;" disabled/></td>
									</tr>
									<tr>
// EXTERNAL VARIABLES
$flightID = $_REQUEST["id"];
// Define IVAO variables
define('cookie_name', 'rfe_token');
define('login_url', 'http://login.ivao.aero/index.php');
define('api_url', 'http://login.ivao.aero/api.php');
define('url', 'http://www.ivaous.org/main/events/rfe/booking');
// If the cookie is existent, get the Info Array with details of the user.
if ($_COOKIE[cookie_name]) {
    $IVAO_Info = json_decode(file_get_contents(api_url . '?type=json&token=' . $_COOKIE[cookie_name]));
}
// GLOBAL VARIABLES
global $navdatabase, $rfedatabase, $IVAO_Info, $sqlconn;
// Get Information of the Flight from the Database
$querymodal = "SELECT id,division,divisioniso,datestart,dateend,timestart,timeend,apticao,aptname,timezone,privatebook,status,sendermail,useradiocallsign\n               FROM rfe_config";
$querymodal = mysqlexec($sqlconn, $querymodal);
?>

	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
		<h3>Edit Event</h3>
	</div>
	<div id="modalFlightsbody" class="modal-body">
			<table border="0" cellspacing="0" cellpadding="3">
				<tr>
					<th style="vertical-align: middle; width: 240px;">Division Name and ISO Code</th>
					<td style="vertical-align: middle; width: 80%">
						<input type="text" value="<?php 
echo mysql_result($querymodal, 0, "division");
?>
" name="division" id="division" style="width: 30%;display:inline;" required/>
						<p>If you don\'t have intention to fly, please <strong>cancel</strong> your reservation ASAP via the form in the event\'s website in order to release the slot to another pilot.</p>
						<p>Thank you very much for your interest in our event!</p>
						<p class="end">Yours truly,<br><br><strong>IVAO ' . mysql_result($queryconfig, 0, 'division') . '</strong><br/>Event Department</p>
						<p class="foot">This is an automatic e-mail. Do not reply it. If you think you received this mail as a mistake, disregard it and delete from your computer, smartphone etc. In case of any doubt, contact one of our staff members.</p>
						
					</td>
				</tr>
			</table>
		</body>
	</html>';
} else {
    if ($_REQUEST["action"] == "freemsg") {
        $subject = $_REQUEST["subject"];
        // Get Information of the Flight from the Database
        $querymember = "SELECT m.name, m.email\tFROM rfe_privatependent AS pp\n\t\t\t\t\t\tLEFT JOIN rfe_members AS m ON m.vid = pp.vid\n\t\t\t\t\t\tWHERE pp.id='" . $_REQUEST["id"] . "'";
        $querymember = mysqlexec($sqlconn, $querymember);
        $email = mysql_result($querymember, 0, "email");
        $msg = '<!DOCTYPE html>
	<html>
		<head>
			<link href="http://fonts.googleapis.com/css?family=Lato:100,300,400" rel="stylesheet" type="text/css">
			<style>
				* {font-family: "Lato", sans-serif; margin: 5px auto;}
				h1,h3 {font-weight: 300;} h2 {font-weight: 500;}
				table.main {width: 600px; border:1px solid darkgray;padding: 10px;background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(0,0,0,0.04) 100%),linear-gradient(to bottom, rgba(255,255,255,0.85) 0%,rgba(255,255,255,0.85) 100%),0% 0%/40% no-repeat url(' . $baseuri . '/images/divlogo/divlogo@940px.png),linear-gradient(to bottom, rgba(255,255,255,0.6) 0%,rgba(255,255,255,0.6) 100%),50% 50%/180% no-repeat url(' . $baseuri . '/images/divlogo/divlogo@940px.png); box-shadow: 0px 0px 20px darkgray;}
				table.flight {margin: 25px 0 25px 0;}
				p {margin: 10 0;text-align: justify;} p.end{margin: 30px 0 0 0;text-align: right;} p.foot{margin: 30px 0 0 0;font-size: 13px; color: rgba(0,0,0,0.3);}
			</style>
		</head>
		<body>
			<table class="main" border="0" cellpadding="0" cellspacing="0" width="500px">
Objective: Creates the modal showing the airports' details.
   Author: Filipe Fonseca    14/06/2014
Revisions: 
========================================================================*/
// INCLUDES
include "func_mysqlexec.php";
include "func_general.php";
include "func_weather.php";
// EXTERNAL VARIABLES
$aptICAO = $_REQUEST["icao"];
// GLOBAL VARIABLES
global $navdatabase, $rfedatabase, $sqlconn;
// Get Information of the Departure and Arrival airports from the Database
change_db($sqlconn, $navdatabase);
$queryapt = "SELECT Name,Latitude,Longtitude,Elevation FROM airports WHERE ICAO='" . $aptICAO . "'";
$queryapt = mysqlexec($sqlconn, $queryapt);
change_db($sqlconn, $rfedatabase);
?>

	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
		<h3 style="font-weight: 300"><?php 
echo getCountry($aptICAO);
?>
 <?php 
echo $aptICAO;
?>
 - <?php 
echo mysql_result($queryapt, 0, 'name');
?>
</h3>
     $midword = "AND";
 }
 $query = "SELECT f.id, f.flightnumber, f.origin, f.destination, IFNULL(DATE_FORMAT(f.deptime, '%H%i'),'----') AS deptime,\n\t\t\t\t IFNULL(DATE_FORMAT(f.arrtime, '%H%i'),'----') AS arrtime, IFNULL(deptime,arrtime) AS opstimeorig, IFNULL(DATE_FORMAT(deptime, '%H%i'),DATE_FORMAT(arrtime, '%H%i')) AS opstime, IFNULL(f.gate,'TBD') AS gate, f.acft, IFNULL(f.route,'TBD') AS route, f.vid, f.bookingstatus, m.name\n\t\t\t\t FROM rfe_flights AS f\n\t\t\t\t LEFT JOIN rfe_members AS m ON m.vid = f.vid\n\t\t\t\t WHERE (f.flightnumber LIKE '%" . $param . "%' OR f.origin LIKE '%" . $param . "%' OR f.destination LIKE '%" . $param . "%' OR f.acft LIKE '%" . $param . "%')\n\t\t\t\t AND (IFNULL(deptime,arrtime) >= '" . $ts . "' " . $midword . " IFNULL(deptime,arrtime) <= '" . $te . "')\n\t\t\t\t ORDER BY opstime";
 $query = mysqlexec($sqlconn, $query);
 $queryn = mysql_num_rows($query);
 for ($i = 0; $i < $queryn; $i++) {
     change_db($sqlconn, $navdatabase);
     $queryorig = "SELECT Name FROM airports WHERE ICAO='" . mysql_result($query, $i, "origin") . "'";
     $queryorig = mysqlexec($sqlconn, $queryorig);
     $querydest = "SELECT Name FROM airports WHERE ICAO='" . mysql_result($query, $i, "destination") . "'";
     $querydest = mysqlexec($sqlconn, $querydest);
     change_db($sqlconn, $rfedatabase);
     $queryapt = "SELECT apticao FROM rfe_config";
     $queryapt = mysqlexec($sqlconn, $queryapt);
     $queryo = "SELECT DATE_FORMAT(CONVERT_TZ(CONCAT(CURDATE(),' ','" . mysql_result($query, $i, "opstimeorig") . "'),'+00:00','" . $tz . "'), '%H%i') AS opslocaltime";
     $queryo = mysqlexec($sqlconn, $queryo);
     $result .= '<tr><td style="vertical-align:middle">';
     if (mysql_result($query, $i, 'origin') == mysql_result($queryapt, 0, 'apticao')) {
         $result .= '<img src="images/dep.png" rel="tooltip" data-placement="top" title="Departing Flight"></td><td style="vertical-align:middle">';
     } else {
         if (mysql_result($query, $i, 'destination') == mysql_result($queryapt, 0, 'apticao')) {
             $result .= '<img src="images/arr.png" rel="tooltip" data-placement="top" title="Arriving Flight"></td><td style="vertical-align:middle">';
         }
     }
     if (file_exists("../logos/" . substr(mysql_result($query, $i, 'flightnumber'), 0, 3) . ".gif")) {
         $result .= '<img src="logos/' . substr(mysql_result($query, $i, 'flightnumber'), 0, 3) . '.gif">';
     } else {
         $result .= '&nbsp;';
     }
     $result .= '</td><td style="vertical-align:middle">';
     $result .= mysql_result($query, $i, 'flightnumber');
<?php

include "func_mysqlexec.php";
$action = $_REQUEST["action"];
if ($action == "grant") {
    $query = 'SELECT flightnumber,origin,destination,acft,route,vid
	          FROM rfe_privatependent
				 WHERE id = ' . $_REQUEST["id"];
    $query = mysqlexec($sqlconn, $query);
    $query2 = "UPDATE rfe_private SET \n\t\tflightnumber = '" . mysql_result($query, 0, 'flightnumber') . "', \n\t\torigin = '" . mysql_result($query, 0, 'origin') . "', \n\t\tdestination = '" . mysql_result($query, 0, 'destination') . "', \n\t\tacft = '" . mysql_result($query, 0, 'acft') . "', \n\t\troute = " . (is_null(mysql_result($query, 0, 'route')) ? 'NULL' : "'" . mysql_result($query, 0, 'route') . "'") . ", \n\t\tvid = '" . mysql_result($query, 0, 'vid') . "' \n\t\tWHERE slottime='" . $_REQUEST["slot"] . "'";
    $query2 = mysqlexec($sqlconn, $query2);
} else {
    if ($action == 'revoke') {
        $query2 = "UPDATE rfe_private SET \n\t\tflightnumber = null, \n\t\torigin = null, \n\t\tdestination = null, \n\t\tacft = null, \n\t\troute = null, \n\t\tvid = null,\n\t\tbookingtimestamp = null\n\t\tWHERE slottime='" . $_REQUEST["slot"] . "'";
        $query2 = mysqlexec($sqlconn, $query2);
    }
}
示例#12
0
 function put_sets()
 {
     foreach ($this->ice_sets as $k => $v) {
         mysqlexec("update sets set value=\"{$v}\" where name=\"{$k}\"");
     }
     if ($this->openClient() == 0) {
         $this->Client->_writesets(1, $this->ice_sets['autobox'], $this->ice_sets['autocut']);
         $this->Client->_writesets_text($this->ice_sets['firma'], $this->ice_sets['placename'], 'Касса №' . $this->ice_sets['nkassa']);
         $this->Client->close();
         return 1;
     }
     return 0;
 }
				<tr>
					<th style="vertical-align: middle; width: 240px;">Route</th>
					<td style="vertical-align: middle; width: 80%"><textarea name="route0" id="route0" style="width: 95%;font-family:Courier New,monospace;"><?php 
echo mysql_result($querymodal, 0, "route");
?>
</textarea></td>
				</tr>

				<tr>
					<th style="vertical-align: middle; width: 240px;">Turnover Flight</th>
					<td style="vertical-align: middle; width: 80%">
						<select name="turnover" id="turnover" style="width: 100%;">
							<option value="null">Select</option>
<?php 
$queryflightlist = "SELECT id,flightnumber,origin,destination FROM rfe_flights ORDER BY flightnumber";
$queryflightlist = mysqlexec($sqlconn, $queryflightlist);
for ($i = 0; $i < mysql_num_rows($queryflightlist); $i++) {
    ?>
							 <option value="<?php 
    echo mysql_result($queryflightlist, $i, 'id');
    ?>
" <?php 
    if (mysql_result($queryflightlist, $i, "flightnumber") == mysql_result($querymodal, 0, "turnover")) {
        echo "selected";
    }
    ?>
><?php 
    echo mysql_result($queryflightlist, $i, 'flightnumber') . " (" . mysql_result($queryflightlist, $i, 'origin') . "-" . mysql_result($queryflightlist, $i, 'destination') . ")";
    ?>
</option>
<?php 
function getDetailsAD($icao)
{
    // SQL Pointer is a global variable
    global $navdatabase, $rfedatabase, $sqlconn;
    change_db($sqlconn, $navdatabase);
    $sql = "SELECT Latitude,Longtitude,Elevation FROM Airports WHERE ICAO='{$icao}'";
    $res = mysqlexec($iddata, $sql);
    change_db($sqlconn, $rfedatabase);
    $latitud = mysql_result($res, 0, 0);
    $longitud = mysql_result($res, 0, 1);
    $elevation = mysql_result($res, 0, 2);
    echo '<table class="table table-bordered table-condensed table-striped">';
    //echo '<table class="table table-condensed">';
    echo '<tr><th>Coordinates</th><td colspan="3">' . DECtoDMS($latitud, "Lat") . ', ' . DECtoDMS($longitud, "Lon") . ' (' . sprintf('%2.6f', $latitud) . ', ' . sprintf('%3.6f', $longitud) . ')</td></tr>';
    echo '<tr><th>Elevation</th><td colspan="3">' . $elevation . ' ft (' . bcmul($elevation, 0.3048, 0) . ' m)</td></tr>';
    echo '<tr><th>DMG</th><td colspan="3">' . getDMG($latitud, $longitud) . '</td></tr>';
    //echo '</table>';
    change_db($sqlconn, $navdatabase);
    $sql = "SELECT rwy.Ident,rwy.TrueHeading,rwy.Length,rwy.Width,rwy.Surface,ils.ident,ils.category,ils.Freq,ils.HasDME\n\t\t\tFROM Airports AS apt\n\t\t\tLEFT JOIN Runways AS rwy ON rwy.AirportID = apt.ID\n\t\t\tLEFT JOIN ILSes AS ils ON ils.RunwayID = rwy.ID\n\t\t\tWHERE apt.ICAO = '" . $icao . "' ORDER BY rwy.Ident";
    $res = mysqlexec($iddata, $sql);
    change_db($sqlconn, $rfedatabase);
    //echo '<table class="table table-bordered table-condensed table-striped">';
    echo '<tr><th colspan=4 style="background: #d4d4d4;"><center>Runways</center></th></tr>';
    echo "<tr><th style='text-align: center;'>ID</th><th style='text-align: center;'>Dimensions</th><th style='text-align: center;'>Surface</th><th style='text-align: center;'>ILS</th></tr>";
    for ($i = 0; $i < mysql_num_rows($res); $i++) {
        echo "<tr><td style='text-align: center;vertical-align: middle;'>" . mysql_result($res, $i, 0) . "</td><td style='text-align: center;vertical-align: middle;'>" . mysql_result($res, $i, 2) . " ft X " . mysql_result($res, $i, 3) . " ft<br>" . bcmul(mysql_result($res, $i, 2), 0.3048, 0) . " m X " . bcmul(mysql_result($res, $i, 3), 0.3048, 0) . " m</td><td style='text-align: center;vertical-align: middle;'>" . mysql_result($res, $i, 4) . "</td>";
        $ils = mysql_result($res, $i, 5);
        if (!empty($ils)) {
            if (mysql_result($res, $i, 6) == 0) {
                echo "<td style='text-align: center;vertical-align: middle;'>" . $ils . " (LOC) - " . bcdiv(dechex(mysql_result($res, $i, 7)), "10000", 3) . "</td></tr>";
            } else {
                echo "<td style='text-align: center;vertical-align: middle;'>" . $ils . " (CAT " . mysql_result($res, $i, 6) . ") - " . bcdiv(dechex(mysql_result($res, $i, 7)), "10000", 3) . "</td></tr>";
            }
        } else {
            echo "<td style='text-align: center;vertical-align: middle;'>none</td></tr>";
        }
    }
    echo "</table>";
}