rendered paste body<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'Log Book'); // change this depending on your filename
// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array(
);
// get special data templates from the datastore
$specialtemplates = array(
);
// pre-cache templates used by all actions
$globaltemplates = array(
'logbook_top',
'logbook_bottom',
);
// pre-cache templates used by specific actions
$actiontemplates = array(
);
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
//include('general/header.inc');
require_once('general/generallogbook.php');
if (isset($_GET['order'])) $myData->setOrderingInfo($_GET['order']);
if (isset($_GET['page'])) $myData->actPageNr = $_GET['page'];
if (isset($_POST['formdata'])) $myData->getWhereClause($_POST['formdata']);
$maxRecord = 15;
$sqlbase = "SELECT * FROM vb3_user ORDER BY userid ASC ";
$sql = $sqlbase."LIMIT ".(($myData->actPageNr-1)*$maxRecord).",".$maxRecord;
$Result = $MyDb->f_ExecuteSql($sql);
$ResultRowNr = $MyDb->f_GetSelectedRows($Result);
$ResultTotalRow = $MyDb->f_ExecuteSql($sqlbase);
$totalRows = $MyDb->f_GetSelectedRows($ResultTotalRow);
$row = 0;
while ($Resultset = $MyDb->f_GetRecord($Result)) {
$sqlbasevb3_userfield = "SELECT * FROM vb3_userfield WHERE userid = '".$Resultset['userid']."' ";
$Resultvb3_userfield = $MyDb->f_ExecuteSql($sqlbasevb3_userfield);
$Resultsetvb3_userfield = $MyDb->f_GetRecord($Resultvb3_userfield);
$total_hours = number_format($Resultsetvb3_userfield['field9'],1);
$sqlbaseflights = "SELECT COUNT( pirep_id ) as count_flights FROM pirep WHERE pilot_id = 'VAA".$Resultset['userid']."' ";
$Resultflights = $MyDb->f_ExecuteSql($sqlbaseflights);
$Resultsetflights = $MyDb->f_GetRecord($Resultflights);
$total_flights = number_format($Resultsetflights['count_flights']);
$sqlbaselastflight = "SELECT * FROM pirep WHERE pilot_id = 'VAA".$Resultset['userid']."' ORDER BY date DESC LIMIT 1 ";
$Resultlastflight = $MyDb->f_ExecuteSql($sqlbaselastflight);
$Resultsetlastflight = $MyDb->f_GetRecord($Resultlastflight);
$date = date("m-d-Y",strtoTime($Resultsetlastflight['date']));
$time = date("h:i A",strtoTime($Resultsetlastflight['date']));
$joindate = date('m-d-Y', $Resultset['joindate']);
$str = (($row++ % 2) == 0 ) ? '<tr>' : '<tr class="odd">';
echo $str;
echo '<td width="55" align="center" class="alt2Active">VAA'.$Resultset['userid'].'</td>';
if ($total_flights == 0) {
echo '<td STYLE="text-align: left; padding-left: 6px;" class="alt1Active">'.$Resultset['username'].'</td>';
echo '<td width="100" align="center" class="alt2Active">'.$joindate.'</td>';
echo '<td colspan="3" align="center" class="alt1Active">NO FLIGHTS LOGGED</td>';
echo '<td width="100" align="center" class="alt2Active">'.$Resultsetvb3_userfield['field13'].' hrs</td>';
} else {
echo '<td STYLE="text-align: left; padding-left: 6px;" class="alt1Active"><a href="list.php?pilot_id='.$Resultset['userid'].'" target="_self" STYLE="text-decoration:none; font-weight: bold;">'.$Resultset['username'].'</a></td>';
echo '<td width="100" align="center" class="alt2Active">'.$joindate.'</td>';
echo '<td width="80" align="center" class="alt1Active">'.$date.'</td>';
echo '<td width="60" align="center" class="alt2Active">'.$total_flights.'</td>';
echo '<td width="90" align="center" class="alt1Active">'.$total_hours.' hrs</td>';
echo '<td width="100" align="center" class="alt2Active">'.number_format($Resultsetvb3_userfield['field13'],1).' hrs</td>';
}
echo '</tr>';
}
$chrispage = setPager($myData->actPageNr,ceil($totalRows/$maxRecord),$IDPilot);
$navbits = array();
$navbits[$parent] = 'Logbook';
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('logbook_top') . '");');
eval('print_output("' . fetch_template('logbook_bottom') . '");');
eval('$navbar = "' . fetch_template('navbar') . '";');
?>
<?php
$_SESSION['usr']=serialize($myData);
?>
<?php
mysql_free_result($Result);
mysql_free_result($Resultvb3_userfield);
mysql_free_result($Resultflights);
mysql_free_result($Resultlastflight);
?>