Jump to content

Recommended Posts

Posted

Hi there.

I'm the technical support staff from royal jordanian airlines which we are working on.

I want to make an online box like this: http://rj-va.uphero.com/box.png.

now i used this code

<html>
<head>
<title>...</title>
<style type="text/css">
.bg {
width:300px;
background:#333;
border:1px solid #999;
border-radius:10px;
margin-left:auto;
margin-right:auto;
}
</style>
</head>
<body>
<?php
$lng['trafficingb'] = 'Pilots';
$lng['notrafficingb'] = 'There is no traffic in the Jordanian Airspace.';
$weekdays = array(
1 => 'Monday',
2 => 'Tuesday',
3 => 'Wednesday',
4 => 'Thursday',
5 => 'Friday',
6 => 'Saturday',
0 => 'Sunday'
);
// Put here 2 first letter of airport ICAO codes
$countryicao = 'SB';
// Put here country code of staff members
$staffcountry = 'br';

$airports = array(
'OXXX' => 'Example Area Sector',
'OXXX' => 'Example Airport',
);
$validcontrollers = array('DEL','GND','TWR','DEP','APP','CTR','FSS');
$service = array(
'DEL' => 'Delivery',
'GND' => 'Ground',
'TWR' => 'Tower',
'APP' => 'Radar',
'DEP' => 'APP / Radar',
'CTR' => 'Sector',
'FSS' => '',
);
$ctrlevel = array(
1 => 'OBS',
2 => 'AS1',
3 => 'AS2',
4 => 'AS3',
5 => 'ADC',
6 => 'APC',
7 => 'ACC',
8 => '<span class="green">SEC</span>',
9 => '<span class="green">SAI</span>',
10 => '<span class="green">CAI</span>',
11 => '<span class="red">SUP</span>',
12 => '<span class="red">ADM</span>'
);
/*
END OF CONFIGURATION
*/
//http://www.ivao.aero/whazzup/status.txt
//http://dataservice.gatools.org/data/ivao.txt

// DOWNLOAD ONLINE-LISTAUS
//---------------------------------------------------------------------------------------------------------
$filecontents = file_get_contents('https://api.ivao.aero/getdata/whazzup');
//$filecontents = file_get_contents('whazzup.txt'); //Testing file
$rows = split("\n", $filecontents);
$filepart = '';
$pilots = array();
$pilotcount = 0;
$controllers = array();
$staff = array();
$controllercount = 0;
$generaldata = array();
$rating = array();
foreach ($rows as $row) {
if (substr($row,0,1) == '!') {
 $filepart = substr($row,1);
} else {
 switch ($filepart) {
	 case 'CLIENTS':
		 $fields = split(":", $row);
		 if ($fields[3] == 'ATC') {
			 $controllercount++;
			 if (in_array(substr($fields[0],-3), $validcontrollers) && substr($fields[0],0,strlen($countryicao)) == $countryicao) { array_push($controllers, $fields); }
				 if (substr($fields[0],0,3) == $staffcountry . '-') { array_push($staff, $fields); }
		 } else {
			 $pilotcount++;
			 if (substr($fields[11],0,strlen($countryicao)) == $countryicao OR substr($fields[13],0,strlen($countryicao)) == $countryicao) {
 $countrypcount++;
				 //if ($countrypcount <= 20) {
 array_push($pilots, $fields);
 //}
			 }
		 }
		 break;
	 case 'GENERAL':
		 list($key, $value) = split('=', $row);
		 $generaldata[trim($key)] = trim($value);
		 break;
 }
}
}
// ATC
//-------------------------------------------------------------------------------------------------------------------//
// Check there is ATC online then show count
//echo '<h3 align="left">' . $lng['atcingb'] ;
//if(count($controllers) != 0) echo ' ('.count($controllers).')';
//echo '</h3>';
//

if (count($pilots) != 0) {
echo '' . $lng['trafficingb'].' ('.count($pilots).')<div class="bg"><table class="trafficlisttable">';
foreach ($pilots as $pilot) {
 $realname = $pilot[2];
 if (substr($realname,-5,1) == ' ') {
	 $realname = substr($realname,0,-5);
 }
;



 echo '<tr align="left"><td>Rating Img</td>
<td width="75"><a href="flighttrack.php?cs=' . $pilot[0] . '" onclick="MM_openBrWindow(\'flighttrack.php?cs=' . $pilot[0] . '\',\'\',\'scrollbars=no,resizable=yes,width=430,height=525\');return false" target="_blank">' . $pilot[0] . '</a></td><td width="33">' . $pilot[11] . '</td>
<td width="40">> ' . $pilot[13] . '</td></tr>';
}
echo '</table></div>';
} else {
echo '<h3 align="left">' . $lng['trafficingb'].' </h3><p style="margin-bottom: 20px; color: #999;"><i>' .$lng['notrafficingb'] . '</i></p>';
}

?>
</body>
</html>

but when i add this code

<img src="http://www.ivao.aero/data/images/ratings/pilot/<? echo $rating ?>.gif" width="105" height="30" />
	 - <?php
 if ($rating == 1 )
 echo "OBS - Observer";
 elseif ($rating == 2 )
 echo "Basic Flight Student (FS1)";
 elseif ($rating == 3 )
 echo "Flight Student (FS2)";
 elseif ($rating == 4 )
 echo "Advanced Flight Student (FS3)";
 elseif ($rating == 5 )
 echo "Private Pilot (PP)";
 elseif ($rating == 6 )
 echo "Senior Private Pilot (SPP)";
 elseif ($rating == 7 )
 echo "Commercial Pilot (CP)";
 elseif ($rating == 8 )
 echo "Airline Transport Pilot (ATP)";
 elseif ($rating == 9 )
 echo "Senior Flight Instructor (SFI)";
 elseif ($rating == 10 )
 echo "Chief Flight Instructor (CFI)";
 elseif ($rating == 11 )
 echo "Supervisor (SUP)";
 elseif ($rating == 12 )
 echo "Administrator (ADM)";
 ?>

it turns into error 400 bad request.

so i want to add for this one :http://rj-va.uphero.com/new.png the rating imgs.

Posted

Ok look i have this one

<html>
<head>
<meta http-equiv="refresh" content="600">
<title>...</title>
<style type="text/css">
.bg {
width:300px;
background:#333;
border:1px solid #999;
border-radius:10px;
margin-left:auto;
margin-right:auto;
}
</style>
</head>
<body>
<?php 
$lng['trafficingb'] = 'Pilots';
$lng['notrafficingb'] = 'There is no traffic  in the Jordanian Airspace.';
$weekdays = array(
   1 => 'Monday',
   2 => 'Tuesday',
   3 => 'Wednesday',
   4 => 'Thursday',
   5 => 'Friday',
   6 => 'Saturday',
   0 => 'Sunday'
);
// Put here 2 first letter of airport ICAO codes
$countryicao = 'SB'; 
// Put here country code of staff members
$staffcountry = 'br';
$airports = array(
   'OXXX' => 'Example Area Sector',
'OXXX' => 'Example Airport',
);
$validcontrollers = array('DEL','GND','TWR','DEP','APP','CTR','FSS');
$service = array(
'DEL' => 'Delivery',
'GND' => 'Ground',
'TWR' => 'Tower',
'APP' => 'Radar',
'DEP' => 'APP / Radar',
'CTR' => 'Sector',
'FSS' => '',
);
$ctrlevel = array(
  1 => 'OBS',
  2 => 'AS1',
  3 => 'AS2',
  4 => 'AS3',
  5 => 'ADC',
  6 => 'APC',
  7 => 'ACC',
  8 => '<span class="green">SEC</span>',
  9 => '<span class="green">SAI</span>',
 10 => '<span class="green">CAI</span>',
 11 => '<span class="red">SUP</span>',
 12 => '<span class="red">ADM</span>'
);

/*
END OF CONFIGURATION
*/
//http://www.ivao.aero/whazzup/status.txt
//http://dataservice.gatools.org/data/ivao.txt
// DOWNLOAD ONLINE-LISTAUS
//---------------------------------------------------------------------------------------------------------
$filecontents = file_get_contents('https://api.ivao.aero/getdata/whazzup');
//$filecontents = file_get_contents('whazzup.txt'); //Testing file
$rows = split("\n", $filecontents);
$filepart = '';
$pilots = array();
$pilotcount = 0;
$controllers = array();
$staff = array();
$controllercount = 0;
$generaldata = array();
$rating = $pilot[41];
foreach ($rows as $row) {
   if (substr($row,0,1) == '!') {
    $filepart = substr($row,1);
   } else {
    switch ($filepart) {
	    case 'CLIENTS':
		    $fields = split(":", $row);
		    if ($fields[3] == 'ATC') {
			    $controllercount++;
			    if (in_array(substr($fields[0],-3), $validcontrollers) && substr($fields[0],0,strlen($countryicao)) == $countryicao) { array_push($controllers, $fields); }
				    if (substr($fields[0],0,3) == $staffcountry . '-') { array_push($staff, $fields); }
		    } else {
			    $pilotcount++;
			    if (substr($fields[11],0,strlen($countryicao)) == $countryicao OR substr($fields[13],0,strlen($countryicao)) == $countryicao) {
  $countrypcount++;
				    //if ($countrypcount <= 20) {
   array_push($pilots, $fields);
  //}
			    }
		    }
		    break;
	    case 'GENERAL':
		    list($key, $value) = split('=', $row);
		    $generaldata[trim($key)] = trim($value);
		    break;
    }
   }
}
// ATC
//-------------------------------------------------------------------------------------------------------------------//
// Check there is ATC online then show count
//echo '<h3 align="left">' . $lng['atcingb'] ;
//if(count($controllers) != 0) echo ' ('.count($controllers).')';
//echo '</h3>';
//echo "<img src= "<?php echo $rating "";



if (count($pilots) != 0) {
   echo '' . $lng['trafficingb'].' ('.count($pilots).')<div class="bg"><table class="trafficlisttable">';
   foreach ($pilots as $pilot) {
    $realname = $pilot[2];
    if (substr($realname,-5,1) == ' ') {
	    $realname = substr($realname,0,-5);
    }
 ;



    echo '<tr align="left"><td><img src="<? echo $rating ?>.gif" width="105" height="30" /></td>

 <td width="75"><a href="flighttrack.php?cs=' . $pilot[0] . '" onclick="MM_openBrWindow(\'flighttrack.php?cs=' . $pilot[0] . '\',\'\',\'scrollbars=no,resizable=yes,width=430,height=525\');return false" target="_blank">' . $pilot[0] . '</a></td><td width="33">' . $pilot[11] . '</td>
 <td width="40">> ' . $pilot[13] . '</td></tr>';
   }
   echo '</table></div>';
} else {
   echo '<h3 align="left">' . $lng['trafficingb'].' </h3><p style="margin-bottom: 20px; color: #999;"><i>' .$lng['notrafficingb'] . '</i></p>';
}

?>
</body>
</html>

and i did store the ivao ratings img in my root dir. but it keeping give me this : http://rj-va.uphero.com/pilot.png

i think that the problem is here

<img src="<? echo $rating ?>.gif" width="105" height="30" />

it's not storing the

$rating = $pilot[41];

and posting to the img src

Posted

just solved

<html>
<head>
<meta http-equiv="refresh" content="600">
<title>...</title>
<style type="text/css">
.bg {
width:300px;
background:#333;
border:1px solid #999;
border-radius:10px;
margin-left:auto;
margin-right:auto;
}
</style>
</head>
<body>
<?php 
$lng['trafficingb'] = 'Pilots';
$lng['notrafficingb'] = 'There is no traffic  in the Jordanian Airspace.';
$weekdays = array(
   1 => 'Monday',
   2 => 'Tuesday',
   3 => 'Wednesday',
   4 => 'Thursday',
   5 => 'Friday',
   6 => 'Saturday',
   0 => 'Sunday'
);
// Put here 2 first letter of airport ICAO codes
$countryicao = 'SB'; 
// Put here country code of staff members
$staffcountry = 'br';
$airports = array(
   'OXXX' => 'Example Area Sector',
'OXXX' => 'Example Airport',
);
$validcontrollers = array('DEL','GND','TWR','DEP','APP','CTR','FSS');
$service = array(
'DEL' => 'Delivery',
'GND' => 'Ground',
'TWR' => 'Tower',
'APP' => 'Radar',
'DEP' => 'APP / Radar',
'CTR' => 'Sector',
'FSS' => '',
);
$ctrlevel = array(
  1 => 'OBS',
  2 => 'AS1',
  3 => 'AS2',
  4 => 'AS3',
  5 => 'ADC',
  6 => 'APC',
  7 => 'ACC',
  8 => '<span class="green">SEC</span>',
  9 => '<span class="green">SAI</span>',
 10 => '<span class="green">CAI</span>',
 11 => '<span class="red">SUP</span>',
 12 => '<span class="red">ADM</span>'
);

/*
END OF CONFIGURATION
*/
//http://www.ivao.aero/whazzup/status.txt
//http://dataservice.gatools.org/data/ivao.txt
// DOWNLOAD ONLINE-LISTAUS
//---------------------------------------------------------------------------------------------------------
$filecontents = file_get_contents('https://api.ivao.aero/getdata/whazzup');
//$filecontents = file_get_contents('whazzup.txt'); //Testing file
$rows = split("\n", $filecontents);
$filepart = '';
$pilots = array();
$pilotcount = 0;
$controllers = array();
$staff = array();
$controllercount = 0;
$generaldata = array();
$rating = $pilot[41];
foreach ($rows as $row) {
   if (substr($row,0,1) == '!') {
    $filepart = substr($row,1);
   } else {
    switch ($filepart) {
	    case 'CLIENTS':
		    $fields = split(":", $row);
		    if ($fields[3] == 'ATC') {
			    $controllercount++;
			    if (in_array(substr($fields[0],-3), $validcontrollers) && substr($fields[0],0,strlen($countryicao)) == $countryicao) { array_push($controllers, $fields); }
				    if (substr($fields[0],0,3) == $staffcountry . '-') { array_push($staff, $fields); }
		    } else {
			    $pilotcount++;
			    if (substr($fields[11],0,strlen($countryicao)) == $countryicao OR substr($fields[13],0,strlen($countryicao)) == $countryicao) {
  $countrypcount++;
				    //if ($countrypcount <= 20) {
   array_push($pilots, $fields);
  //}
			    }
		    }
		    break;
	    case 'GENERAL':
		    list($key, $value) = split('=', $row);
		    $generaldata[trim($key)] = trim($value);
		    break;
    }
   }
}
// ATC
//-------------------------------------------------------------------------------------------------------------------//
// Check there is ATC online then show count
//echo '<h3 align="left">' . $lng['atcingb'] ;
//if(count($controllers) != 0) echo ' ('.count($controllers).')';
//echo '</h3>';
//echo "<img src= "<?php echo $rating "";



if (count($pilots) != 0) {
   echo '' . $lng['trafficingb'].' ('.count($pilots).')<div class="bg"><table class="trafficlisttable">';
   foreach ($pilots as $pilot) {
    $realname = $pilot[2];
    if (substr($realname,-5,1) == ' ') {
	    $realname = substr($realname,0,-5);
    }
 ;



    echo '<tr align="left"><td><img src="'. $pilot[41] .'.gif" width="105" height="30" /></td>

 <td width="75"><a href="flighttrack.php?cs=' . $pilot[0] . '" onclick="MM_openBrWindow(\'flighttrack.php?cs=' . $pilot[0] . '\',\'\',\'scrollbars=no,resizable=yes,width=430,height=525\');return false" target="_blank">' . $pilot[0] . '</a></td><td width="33">' . $pilot[11] . '</td>
 <td width="40">> ' . $pilot[13] . '</td></tr>';
   }
   echo '</table></div>';
} else {
   echo '<h3 align="left">' . $lng['trafficingb'].' </h3><p style="margin-bottom: 20px; color: #999;"><i>' .$lng['notrafficingb'] . '</i></p>';
}

?>
</body>
</html>

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...