Jump to content

Code Check Plz


PIAS2011

Recommended Posts

Hello All

Can you guys please check the codes of the following as I think that there is some problem with my codes.

LIVE FLIGHT BOARD

Problem that i am facing is that when there are no live flights the message 'there are currently no live flights' does NOT display properly.

<style type="text/css">
<!--
th {
color: #ff8710;

font-weight: bolder;

}
td {
color: #ff961e;


font-weight: normal;
}
-->
</style>
<h2>Flight Departures Board</h2>
<table style="border:1px solid grey;" cellspacing="0" cellpadding="0" bgcolor="#1F1F1F">
 <tr>
   <th align="center" style="background-color: #171717; width: 3.5%;"> </th>
   <th width="5%" align="center" style="background-color: #171717;">Flight</th>
   <th width="20%" align="center" style="background-color: #171717;">Pilot</th>
   <th width="25%" align="center" style="background-color: #171717;">Departure</th>
   <th width="25%" align="center" style="background-color: #171717;">Arrival</th>
   <th width="15%" align="center" style="background-color: #171717;">Aircraft</th>
   <th width="10%" align="center" style="background-color: #171717;">Status</th>
</tr>

<?php

$results = ACARSData::GetACARSData();

if (count($results) > 0)
  {
  foreach($results as $flight)
     {

        ?>
     <tr>
         <td align="center"><?php if($flight->phasedetail == "Boarding") { echo "<img style='padding-left:3px;' src='http://pias.waleeddc.com/lib/skins/PIAvirtual/images/dots_blink.gif'>"; } elseif($flight->phasedetail == "Arrived") { echo "<img style='padding-left:3px;' src='http://pias.waleeddc.com/lib/skins/PIAvirtual/images/dots.gif'>"; } elseif($flight->phasedetail == "Taxiing to Runway") { echo "<img style='padding-left:3px;' src='http://pias.waleeddc.com/lib/skins/PIAvirtual/images/dots.gif'>"; } elseif($flight->phasedetail == "On Approach") { echo "<img style='padding-left:3px;' src='http://pias.waleeddc.com/lib/skins/PIAvirtual/images/dots_yellow.gif'>"; } ?></td>
         <td align="center"><?php echo $flight->flightnum;?></td>
         <td align="center"><?php echo $flight->pilotname;?></td>/td>
         <td align="center"><?php echo $flight->depname;?></td>
         <td align="center"><?php echo $flight->arrname;?></td>
         <td align="center"><?php echo $flight->aircraftname;?></td>
         <td align="center"><?php if($flight->phasedetail
   != 'Paused') { echo $flight->phasedetail; }
   else { echo "Cruise"; }?></font></td>
     </tr>
 <?php          
               }
           } else { ?>
               <tr> <td align="center">No Flights in Progres</td></tr>
           <?php
           }
           ?>
</table>

RECENT FLIGHTS BOARD

Problem: The status of this board i.e ACCEPTED , REJECTED , PENDIMG does not work properly.

<center><h2>Recent Arrivals</center></h>
<table align="center" border="0" width="605px">
</table>
<?php
$count = 10;
$pireps = PIREPData::getRecentReportsByCount($count);
?>
<table style="border:1px solid grey;" cellspacing="0" cellpadding="0" bgcolor="#1F1F1F">
  <thead>
    <tr>
   <th width="7%" align="center" style="background-color: #171717;">Flight#</th>
   <th width="30%" align="center" style="background-color: #171717;">Departure</th>
   <th width="30%" align="center" style="background-color: #171717;">Arrival</th>
   <th width="15%" align="center" style="background-color: #171717;">Pilot</th>
   <th width="10%" align="center" style="background-color: #171717;">Landing Rate</th>
   <th width="8%" align="center" style="background-color: #171717;">Aircraft</th>
   <th width="5%" align="center" style="background-color: #171717;">Status</th>
    </tr> 	
   </thead>
   <tbody>
<?php
if(count($pireps) > 0)
{
 foreach ($pireps as $pirep)
 {
   $pilotinfo = PilotData::getPilotData($pirep->pilotid);
   $pilotid = PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid); 

   if($pirep->accepted == '0') $status = 'REJECTED';
   if($pirep->accepted == '1') $status = 'ACCEPTED';
   else $status = 'PENDING'; 

   echo "<tr>";
   echo "<td align=center   bgcolor=#171717> $pirep->code-$pirep->flightnum </font></td>";
   echo "<td align=center   bgcolor=#171717> $pirep->depname </font></td>";
   echo "<td align=center  bgcolor=#171717> $pirep->arrname </font></td>";
   echo "<td align=center   bgcolor=#171717> $pilotid $pilotinfo->firstname $pilotinfo->lastname </font></td>";
   echo "<td align=center  bgcolor=#171717> $pirep->landingrate </font></td>";
   echo "<td align=center   bgcolor=#171717> $pirep->aircraft </font></td>";
   echo "<td align=center    bgcolor=#171717> $status </font></td>";
   echo "</tr>";
 }
}
else
{
   echo "<tr><td><center>There are no recent flights!</td></tr></center>";
}
?>
</tbody>
</table>

Please if someone could check my codes and tell me whats wrong in them.

Thanks A lot

Link to comment
Share on other sites

<!--
th {
color: #ff8710;

font-weight: bolder;

}
td {
color: #ff961e;


font-weight: normal;
}
-->
</style>
<h2>Flight Departures Board</h2>
<table style="border:1px solid grey;" cellspacing="0" cellpadding="0" bgcolor="#1F1F1F">
 <tr>
   <th align="center" style="background-color: #171717; width: 3.5%;"> </th>
   <th width="5%" align="center" style="background-color: #171717;">Flight</th>
   <th width="20%" align="center" style="background-color: #171717;">Pilot</th>
   <th width="25%" align="center" style="background-color: #171717;">Departure</th>
   <th width="25%" align="center" style="background-color: #171717;">Arrival</th>
   <th width="15%" align="center" style="background-color: #171717;">Aircraft</th>
   <th width="10%" align="center" style="background-color: #171717;">Status</th>
</tr>

<?php

$results = ACARSData::GetACARSData();

if (!$results){ ?>
<tr> <td align="center">No Flights in Progress</td></tr>
<?php } else {
  foreach($results as $flight){ ?>
     <tr>
         <td align="center"><?php if($flight->phasedetail == "Boarding") { echo "<img style='padding-left:3px;' src='http://pias.waleeddc.com/lib/skins/PIAvirtual/images/dots_blink.gif'>"; } elseif($flight->phasedetail == "Arrived") { echo "<img style='padding-left:3px;' src='http://pias.waleeddc.com/lib/skins/PIAvirtual/images/dots.gif'>"; } elseif($flight->phasedetail == "Taxiing to Runway") { echo "<img style='padding-left:3px;' src='http://pias.waleeddc.com/lib/skins/PIAvirtual/images/dots.gif'>"; } elseif($flight->phasedetail == "On Approach") { echo "<img style='padding-left:3px;' src='http://pias.waleeddc.com/lib/skins/PIAvirtual/images/dots_yellow.gif'>"; } ?></td>
         <td align="center"><?php echo $flight->flightnum;?></td>
         <td align="center"><?php echo $flight->pilotname;?></td>/td>
         <td align="center"><?php echo $flight->depname;?></td>
         <td align="center"><?php echo $flight->arrname;?></td>
         <td align="center"><?php echo $flight->aircraftname;?></td>
         <td align="center"><?php if($flight->phasedetail != 'Paused') { echo $flight->phasedetail; } else { echo "Cruise"; }?></td>
     </tr>
<?php          
               }
           } ?>
</table>

Try that maybe?

P.S. (This is probably more to the person who originally wrote the code because I'm sure it's in the snippets forum) Stop using <font> it's so outdated.

P.P.S. 'Alot' -> 'a lot' ;)

Link to comment
Share on other sites

<!--
th {
color: #ff8710;

font-weight: bolder;

}
td {
color: #ff961e;


font-weight: normal;
}
-->
</style>
<h2>Flight Departures Board</h2>
<table style="border:1px solid grey;" cellspacing="0" cellpadding="0" bgcolor="#1F1F1F">
 <tr>
   <th align="center" style="background-color: #171717; width: 3.5%;"> </th>
   <th width="5%" align="center" style="background-color: #171717;">Flight</th>
   <th width="20%" align="center" style="background-color: #171717;">Pilot</th>
   <th width="25%" align="center" style="background-color: #171717;">Departure</th>
   <th width="25%" align="center" style="background-color: #171717;">Arrival</th>
   <th width="15%" align="center" style="background-color: #171717;">Aircraft</th>
   <th width="10%" align="center" style="background-color: #171717;">Status</th>
</tr>

<?php

$results = ACARSData::GetACARSData();

if (!$results){
  foreach($results as $flight){ ?>
     <tr>
         <td align="center"><?php if($flight->phasedetail == "Boarding") { echo "<img style='padding-left:3px;' src='http://pias.waleeddc.com/lib/skins/PIAvirtual/images/dots_blink.gif'>"; } elseif($flight->phasedetail == "Arrived") { echo "<img style='padding-left:3px;' src='http://pias.waleeddc.com/lib/skins/PIAvirtual/images/dots.gif'>"; } elseif($flight->phasedetail == "Taxiing to Runway") { echo "<img style='padding-left:3px;' src='http://pias.waleeddc.com/lib/skins/PIAvirtual/images/dots.gif'>"; } elseif($flight->phasedetail == "On Approach") { echo "<img style='padding-left:3px;' src='http://pias.waleeddc.com/lib/skins/PIAvirtual/images/dots_yellow.gif'>"; } ?></td>
         <td align="center"><?php echo $flight->flightnum;?></td>
         <td align="center"><?php echo $flight->pilotname;?></td>/td>
         <td align="center"><?php echo $flight->depname;?></td>
         <td align="center"><?php echo $flight->arrname;?></td>
         <td align="center"><?php echo $flight->aircraftname;?></td>
         <td align="center"><?php if($flight->phasedetail != 'Paused') { echo $flight->phasedetail; } else { echo "Cruise"; }?></td>
     </tr>
<?php          
               }
           } else { ?>
               <tr> <td align="center">No Flights in Progress</td></tr>
           <?php
           }
           ?>
</table>

Try that maybe?

P.S. (This is probably more to the person who originally wrote the code because I'm sure it's in the snippets forum) Stop using <font> it's so outdated.

P.P.S. 'Alot' -> 'a lot' ;)

Does not work

ERROR

Warning: Invalid argument supplied for foreach() in ********************* on line 33

Link to comment
Share on other sites

anyone on this problem

RECENT FLIGHTS BOARD

Problem: The status of this board i.e ACCEPTED , REJECTED , PENDIMG does not work properly.

<center><h2>Recent Arrivals</center></h>
<table align="center" border="0" width="605px">
</table>
<?php
$count = 10;
$pireps = PIREPData::getRecentReportsByCount($count);
?>
<table style="border:1px solid grey;" cellspacing="0" cellpadding="0" bgcolor="#1F1F1F">
  <thead>
    <tr>
   <th width="7%" align="center" style="background-color: #171717;">Flight#</th>
   <th width="30%" align="center" style="background-color: #171717;">Departure</th>
   <th width="30%" align="center" style="background-color: #171717;">Arrival</th>
   <th width="15%" align="center" style="background-color: #171717;">Pilot</th>
   <th width="10%" align="center" style="background-color: #171717;">Landing Rate</th>
   <th width="8%" align="center" style="background-color: #171717;">Aircraft</th>
   <th width="5%" align="center" style="background-color: #171717;">Status</th>
    </tr> 	
   </thead>
   <tbody>
<?php
if(count($pireps) > 0)
{
 foreach ($pireps as $pirep)
 {
   $pilotinfo = PilotData::getPilotData($pirep->pilotid);
   $pilotid = PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid); 

   if($pirep->accepted == '0') $status = 'REJECTED';
   if($pirep->accepted == '1') $status = 'ACCEPTED';
   else $status = 'PENDING'; 

   echo "<tr>";
   echo "<td align=center   bgcolor=#171717> $pirep->code-$pirep->flightnum </font></td>";
   echo "<td align=center   bgcolor=#171717> $pirep->depname </font></td>";
   echo "<td align=center  bgcolor=#171717> $pirep->arrname </font></td>";
   echo "<td align=center   bgcolor=#171717> $pilotid $pilotinfo->firstname $pilotinfo->lastname </font></td>";
   echo "<td align=center  bgcolor=#171717> $pirep->landingrate </font></td>";
   echo "<td align=center   bgcolor=#171717> $pirep->aircraft </font></td>";
   echo "<td align=center    bgcolor=#171717> $status </font></td>";
   echo "</tr>";
 }
}
else
{
   echo "<tr><td><center>There are no recent flights!</td></tr></center>";
}
?>
</tbody>
</table>

Please if someone could check my codes and tell me whats wrong in them.

Thanks A lot

Link to comment
Share on other sites

The problem is in the way YOU coded the table. Your page source show this:

<h2>Recent Flights Booked</h2>
<table style="border:1px solid grey;" cellspacing="0" cellpadding="0" bgcolor="#1F1F1F">
<th width="10%" align="center" style="background-color: #171717;">Flight Number</div></th>
<th width="10%" align="center" style="background-color: #171717;">Depart</div></th>	
<th width="10%" align="center" style="background-color: #171717;">Arrive</div></th>
<th width="20%" align="center" style="background-color: #171717;">Pilot Name</div></th>
<th width="20%" align="center" style="background-color: #171717;">Aircraft</th>   //There is no </div> in this line
<th width="10%" align="center" style="background-color: #171717;">Tail No.</div></th>
<th width="20%" align="center" style="background-color: #171717;">Flight Time</div></th>
</tr>          //You have a </tr> but no <tr> in the table
</thead> 
<tbody>

<tr bgcolor="#171717">
<td height="25" width="15%" align="center">PIA356</a> </td>  //There is a <span></span> missing here
<td height="25" width="13%" align="center"><span>OPLA</span></td>
<td height="25" width="13%" align="center"><span>OPRN</span></td>

<td height="25" width="20%" align="center"><span>Sajid Ali</span></td>
<td height="25" width="15%" align="center"><span>ATR42</span></td>
<td height="25" width="12%" align="center">AP-BHP</td> //There is a <span></span> missing here
<td height="25" width="12%" align="center"><span>1 Hours</span></td>
</tr> 

<tr bgcolor="#171717">
<td height="25" width="15%" align="center">PIA653</a> </td> //There is a <span></span> missing here
<td height="25" width="13%" align="center"><span>OPRN</span></td>
<td height="25" width="13%" align="center"><span>OPLA</span></td>

<td height="25" width="20%" align="center"><span>Ali Asad</span></td>
<td height="25" width="15%" align="center"><span>ATR42</span></td>
<td height="25" width="12%" align="center">AP-BHP</td>  //There is a <span></span> missing here
<td height="25" width="12%" align="center"><span>1 Hours</span></td>
</tr> 
</tbody>
</table>

Redo the table to fix the problems, then it should look right.

Link to comment
Share on other sites

The problem is in the way YOU coded the table. Your page source show this:

<h2>Recent Flights Booked</h2>
<table style="border:1px solid grey;" cellspacing="0" cellpadding="0" bgcolor="#1F1F1F">
<th width="10%" align="center" style="background-color: #171717;">Flight Number</div></th>
<th width="10%" align="center" style="background-color: #171717;">Depart</div></th>	
<th width="10%" align="center" style="background-color: #171717;">Arrive</div></th>
<th width="20%" align="center" style="background-color: #171717;">Pilot Name</div></th>
<th width="20%" align="center" style="background-color: #171717;">Aircraft</th>   //There is no </div> in this line
<th width="10%" align="center" style="background-color: #171717;">Tail No.</div></th>
<th width="20%" align="center" style="background-color: #171717;">Flight Time</div></th>
</tr>          //You have a </tr> but no <tr> in the table
</thead> 
<tbody>

<tr bgcolor="#171717">
<td height="25" width="15%" align="center">PIA356</a> </td>  //There is a <span></span> missing here
<td height="25" width="13%" align="center"><span>OPLA</span></td>
<td height="25" width="13%" align="center"><span>OPRN</span></td>

<td height="25" width="20%" align="center"><span>Sajid Ali</span></td>
<td height="25" width="15%" align="center"><span>ATR42</span></td>
<td height="25" width="12%" align="center">AP-BHP</td> //There is a <span></span> missing here
<td height="25" width="12%" align="center"><span>1 Hours</span></td>
</tr> 

<tr bgcolor="#171717">
<td height="25" width="15%" align="center">PIA653</a> </td> //There is a <span></span> missing here
<td height="25" width="13%" align="center"><span>OPRN</span></td>
<td height="25" width="13%" align="center"><span>OPLA</span></td>

<td height="25" width="20%" align="center"><span>Ali Asad</span></td>
<td height="25" width="15%" align="center"><span>ATR42</span></td>
<td height="25" width="12%" align="center">AP-BHP</td>  //There is a <span></span> missing here
<td height="25" width="12%" align="center"><span>1 Hours</span></td>
</tr> 
</tbody>
</table>

Redo the table to fix the problems, then it should look right.

Jeff thanks for your help but i did not ask help for this i asked help for RECENT FLIGHT ARRIVALS i mean the Recent Arrivals Board. I have problem that it DOES NOT display the current status properly.

Thanks

CEO PIASimulations

Link to comment
Share on other sites

Other than your math, I don't see anything wrong with either the code or how it looks on the site.

   <thead>
    <tr>
   <th width="7%" align="center" style="background-color: #171717;">Flight#</th>
   <th width="30%" align="center" style="background-color: #171717;">Departure</th>
   <th width="30%" align="center" style="background-color: #171717;">Arrival</th>
   <th width="15%" align="center" style="background-color: #171717;">Pilot</th>
   <th width="10%" align="center" style="background-color: #171717;">Landing Rate</th>
   <th width="8%" align="center" style="background-color: #171717;">Aircraft</th>
   <th width="5%" align="center" style="background-color: #171717;">Status</th>

This adds up to 105%, you're 5% over (maybe a workbook, or maybe a calculator might help).

If you'd like any more further support, I'd suggest you don't gripe about the answers you get for what you ask for, or how you ask them. This isn't going to get you far.

Link to comment
Share on other sites

Other than your math, I don't see anything wrong with either the code or how it looks on the site.

   <thead>
    <tr>
   <th width="7%" align="center" style="background-color: #171717;">Flight#</th>
   <th width="30%" align="center" style="background-color: #171717;">Departure</th>
   <th width="30%" align="center" style="background-color: #171717;">Arrival</th>
   <th width="15%" align="center" style="background-color: #171717;">Pilot</th>
   <th width="10%" align="center" style="background-color: #171717;">Landing Rate</th>
   <th width="8%" align="center" style="background-color: #171717;">Aircraft</th>
   <th width="5%" align="center" style="background-color: #171717;">Status</th>

This adds up to 105%, you're 5% over (maybe a workbook, or maybe a calculator might help).

If you'd like any more further support, I'd suggest you don't gripe about the answers you get for what you ask for, or how you ask them. This isn't going to get you far.

There is no problem in this THE PROBLEM IS THAT THE WHEN I REJECT ANY PIREP REPORT IT DOES NOT SHOW REJECTED. !!

Link to comment
Share on other sites

I did say look here ;

anyone on this problem

RECENT FLIGHTS BOARD

Problem: The status of this board i.e ACCEPTED , REJECTED , PENDIMG does not work properly.

<center><h2>Recent Arrivals</center></h>
<table align="center" border="0" width="605px">
</table>
<?php
$count = 10;
$pireps = PIREPData::getRecentReportsByCount($count);
?>
<table style="border:1px solid grey;" cellspacing="0" cellpadding="0" bgcolor="#1F1F1F">
  <thead>
    <tr>
   <th width="7%" align="center" style="background-color: #171717;">Flight#</th>
   <th width="30%" align="center" style="background-color: #171717;">Departure</th>
   <th width="30%" align="center" style="background-color: #171717;">Arrival</th>
   <th width="15%" align="center" style="background-color: #171717;">Pilot</th>
   <th width="10%" align="center" style="background-color: #171717;">Landing Rate</th>
   <th width="8%" align="center" style="background-color: #171717;">Aircraft</th>
   <th width="5%" align="center" style="background-color: #171717;">Status</th>
    </tr> 	
   </thead>
   <tbody>
<?php
if(count($pireps) > 0)
{
 foreach ($pireps as $pirep)
 {
   $pilotinfo = PilotData::getPilotData($pirep->pilotid);
   $pilotid = PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid); 

   if($pirep->accepted == '0') $status = 'REJECTED';
   if($pirep->accepted == '1') $status = 'ACCEPTED';
   else $status = 'PENDING'; 

   echo "<tr>";
   echo "<td align=center   bgcolor=#171717> $pirep->code-$pirep->flightnum </font></td>";
   echo "<td align=center   bgcolor=#171717> $pirep->depname </font></td>";
   echo "<td align=center  bgcolor=#171717> $pirep->arrname </font></td>";
   echo "<td align=center   bgcolor=#171717> $pilotid $pilotinfo->firstname $pilotinfo->lastname </font></td>";
   echo "<td align=center  bgcolor=#171717> $pirep->landingrate </font></td>";
   echo "<td align=center   bgcolor=#171717> $pirep->aircraft </font></td>";
   echo "<td align=center    bgcolor=#171717> $status </font></td>";
   echo "</tr>";
 }
}
else
{
   echo "<tr><td><center>There are no recent flights!</td></tr></center>";
}
?>
</tbody>
</table>

Please if someone could check my codes and tell me whats wrong in them.

Thanks A lot

Link to comment
Share on other sites

in this code it looks like everything is ok but THE PROBLEM IS HERE

in this part of it the status is being displayed wrong when i reject a pirep it shows pending.

 <?php
if(count($pireps) > 0)
{
 foreach ($pireps as $pirep)
 {
   $pilotinfo = PilotData::getPilotData($pirep->pilotid);
   $pilotid = PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid); 

   if($pirep->accepted == '0') $status = 'REJECTED';
   if($pirep->accepted == '1') $status = 'ACCEPTED';
   else $status = 'PENDING'; 

   echo "<tr>";
   echo "<td align=center   bgcolor=#171717> $pirep->code-$pirep->flightnum </font></td>";
   echo "<td align=center   bgcolor=#171717> $pirep->depname </font></td>";
   echo "<td align=center  bgcolor=#171717> $pirep->arrname </font></td>";
   echo "<td align=center   bgcolor=#171717> $pilotid $pilotinfo->firstname $pilotinfo->lastname </font></td>";
   echo "<td align=center  bgcolor=#171717> $pirep->landingrate </font></td>";
   echo "<td align=center   bgcolor=#171717> $pirep->aircraft </font></td>";
   echo "<td align=center    bgcolor=#171717> $status </font></td>";
   echo "</tr>";
 }
}
else
{
   echo "<tr><td><center>There are no recent flights!</td></tr></center>";
}
?>
</tbody>
</table>

Link to comment
Share on other sites

  • Administrators

I dont think that hollering at Mark IN CAPS is going to do anything for you. I will give you the key to the solution below, make an effort to figure it out.

From app.config.php

# PIREP Statuses

define('PIREP_PENDING', 0);

define('PIREP_ACCEPTED', 1);

define('PIREP_REJECTED', 2);

define('PIREP_INPROGRESS', 3);

Link to comment
Share on other sites

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...