?> <div id="main"> <?php // Initialize the latest data counter $maxdate = 0; // Get the requested period, if blank choose the latest $period = $_GET['period']; if ($period < 1) { $SQL = "SELECT MAX(period) FROM netreport"; $period = singleResult($SQL, $db); } echo " <center>\n"; // Display the month name for this report $SQL = 'SELECT lastday FROM periods WHERE periodno=' . $period; echo " <p><h1>Public Service Honor Roll<br>for " . convertDate(singleResult($SQL, $db)) . "</h1></p>\n"; // Get the actual report data for this period $SQL = 'SELECT `call`,`cat1`,`cat2`,`cat3`,`cat4`,`cat5`,`cat6`,`total`,`comment`,`updated` FROM `pshr` WHERE `period`=' . $period . ' ORDER BY `total` DESC'; $result = getResult($SQL, $db); echo " <table>\n"; echo " <th>Call<th>Nets<th>Tfc<th>Appt<th>Plan<th>Emrg<th>Digi<th>Total<th>Comments<tr>\n"; // We will remember rownum to alternate colors in the table $rownum = 1; // Now loop through the rows of the data while ($myrow = getRow($result, $db)) { // Keep track of the latest data if ($myrow[9] > $maxdate) { $maxdate = $myrow[9]; } // Switch between light and dark rows if ($rownum != 0) {
echo " <table>\n"; $SQ1 = "SELECT `NETID`,count(*) AS Reports FROM `netreport` " . "WHERE `PERIOD` BETWEEN " . $startp . " AND " . $endp . " GROUP BY `NETID` " . "ORDER BY Reports DESC, `NETID`"; $rs1 = getResult($SQ1, $db); while ($myr1 = getRow($rs1, $db)) { echo " <tr>\n"; $SQ2 = "SELECT `NETACRO`,`NETFULLNAME` FROM `nets` WHERE `NETID`=" . $myr1[0]; $rs2 = getResult($SQ2, $db); $myr2 = getRow($rs2, $db); $netname = substr($myr2[1], 0, 25); echo " <th>" . $myr2[0] . "</th>\n"; echo " <td>" . $netname . "</td>\n"; echo " <th>" . $myr1[1] . "</th>\n"; for ($p = 0; $p < 12; $p++) { $thisp = $startp + $p; $SQ3 = "SELECT COUNT(*) FROM `netreport` " . "WHERE `netid`=" . $myr1[0] . " AND `period`=" . $thisp; $rs3 = singleResult($SQ3, $db); if ($rs3 == 1) { echo " <td>X</td>\n"; } else { echo " <td style=\"background-color: red;\">-</td>\n"; } } echo " </tr>\n"; } echo " </table>\n"; echo "<p></p>\n"; dateLinks($period, "netsummary", $db); echo "</center>\n"; ?> </div> <?php
echo "<p><h1>Individual History</h1></p>\n"; echo "<table>\n"; echo "<tr><th align=\"left\">Period</th><th>SAR</th><td>Num</td><th>PSHR" . "</th><td>Num</td></tr>\n"; for ($period = $lastperiod; $period > 71; $period--) { // Display the month name for this report $SQL = 'SELECT `lastday` FROM `periods` WHERE `periodno`=' . $period; $periodname = convertDate(singleResult($SQL, $db)); // Get the actual report data for this period $S01 = "SELECT SUM(`total`) FROM `sar` WHERE `period`=" . $period; $r1 = singleResult($S01, $db); $S02 = "SELECT SUM(`TOTAL`) FROM `pshr` WHERE `period`=" . $period; $r2 = singleResult($S02, $db); $S03 = "SELECT COUNT(*) FROM `sar` WHERE `period`=" . $period; $r3 = singleResult($S03, $db); $S04 = "SELECT COUNT(*) FROM `pshr` WHERE `period`=" . $period; $r4 = singleResult($S04, $db); // We will use rownum to keep track of light and dark rows $rownum = 1; // The following variables are used to calculate totals for the month // Display totals if ($rownum != 0) { $id = 'id="OsRow3"'; echo " <tr id=OsRow>\n"; $rownum = 0; } else { $id = 'id="OsRow4"'; echo " <tr id=OsRow2>\n"; $rownum = 1; } echo "<th align=\"left\">{$periodname}<td {$id} align=\"right\">" . $r1 . "</td><td {$id} align=\"right\">" . $r3 . "</td><td {$id} align=\"right\">" . $r2 . "</td><td {$id} align=\"right\">" . $r4 . "</td></tr>\n"; }
echo " </center>\n"; // Find out all calls that MIGHT be eligible $SQL1 = "SELECT DISTINCT `call` FROM `pshr` WHERE `total`>69 AND `period` " . "BETWEEN " . $startperiod . " AND " . $period . " ORDER BY `call`"; $result1 = getResult($SQL1, $db); // Now loop through the candidates while ($row1 = getRow($result1, $db)) { //echo "<p>" . $row1[0]; // Count up number of 70 or higher reports in past 12 months $SQL2 = "SELECT COUNT(*) FROM `pshr` WHERE `total`>69 AND `period` " . "BETWEEN " . $shortperiod . " AND " . $period . " AND `call`='" . $row1[0] . "'"; // If >11, then this station is eligible if (singleResult($SQL2, $db) > 11) { echo "<p>" . callsign($row1[0]) . " eligible - >=70 " . $shortstring; } else { // Count up number of 70 or higher in past 24 months $SQL3 = "SELECT COUNT(*) FROM `pshr` WHERE `total`>69 AND `period` " . "BETWEEN " . $startperiod . " AND " . $period . " AND `call`='" . $row1[0] . "'"; $count = singleResult($SQL3, $db); // If >17 then this station is eligible if ($count > 17) { echo "<p>" . callsign($row1[0]) . " eligible - >=70 " . $count . " months in past 24"; echo "<br />\n"; // Get the list of qualifying months $SQL4 = "SELECT `lastday` FROM `pshr` A, `periods` B " . "WHERE `total`>69 AND `period` BETWEEN " . $startperiod . " AND " . $period . " AND `call`='" . $row1[0] . "' AND A.`period`=B.`periodno` ORDER BY A.`period`"; $result4 = getResult($SQL4, $db); $dashed = 0; while ($row4 = getRow($result4, $db)) { if ($dashed) { echo " - "; } $dashed = 1; echo convertDateShort($row4[0]); }
$qec = "SELECT `name` FROM `calldirectory` WHERE `callsign`='" . $row2[2] . "'"; $rec = getResult($qec, $db); $ecname = ''; // In case EC missing from calldirectory, display call only, // don't display ',' before call or (blank) name if ($rowec = getRow($rec, $db)) { $ecname = $rowec[0]; $eccall = $ecname . ", " . $eccall; } echo " <entry><indexterm><primary>" . $row2[0] . "</primary></indexterm>" . $row2[0] . "</entry>\n"; echo " <entry>" . $eccall . "</entry>\n"; // Pick up membership information $q3a = "SELECT MAX(`period`) FROM `arpsc_ecrept` " . "WHERE `county`='" . $row2[1] . "'"; if ($maxp = singleResult($q3a, $db)) { $q3 = "SELECT `aresmem` FROM `arpsc_ecrept` " . "WHERE `county`='" . $row2[1] . "' AND " . "`period`=" . $maxp; $r3 = singleResult($q3, $db); echo " <entry align=\"center\">" . $r3 . "</entry>\n"; } else { echo " <entry><para> </para></entry>\n"; } // Pick up contact information /* $q3="SELECT ares_contact_type, contact, validity " . */ /* "FROM ares_contact_info A, ares_contact_type B " . */ /* "WHERE A.type = B.type AND A.call='" . $row2[2] . "'"; */ /* $r3 = getResult($q3,$db); */ /* echo " <entry>\n"; */ /* echo " <itemizedlist spacing='compact'>\n"; */ /* $membercount = 0; */ /* while ( $row3 = getRow($r3,$db) ) */ /* { */ /* if ( $row3[2] == 1 ) */
$maxdate = 0; // Get the requested period, if blank choose the latest $period = $_GET['period']; if ($period < 1) { $SQL = "SELECT MAX(`period`) FROM `netreport`"; $period = singleResult($SQL, $db); } echo " <center>\n"; $lastperiod = $period; echo "<p><h1>Net History</h1></p>\n"; echo "<table width=\"90%\">\n"; echo "<tr><th align=\"left\">Period</th><th>QNI</th><th>QTC" . "</th><th>QTR</th><th>Sess</th><th>Hours</th></tr>\n"; for ($period = $lastperiod; $period > 71; $period--) { // Display the month name for this report $SQL = 'SELECT `lastday` FROM `periods` WHERE `periodno`=' . $period; $periodname = convertDate(singleResult($SQL, $db)); // Get the actual report data for this period $SQL = 'SELECT B.`netfullname`,A.`QNI`,A.`QTC`,A.`QTR`,A.`sessions`,' . 'A.`updated`,A.`manhours`,A.`netid` ' . 'FROM `netreport` A, `nets` B ' . 'WHERE A.`period`=' . $period . ' AND A.`netID`=B.`netID` ' . 'ORDER BY `QTC` DESC, `QNI` DESC'; $result = getResult($SQL, $db); // We will use rownum to keep track of light and dark rows $rownum = 1; // The following variables are used to calculate totals for the month $TQNI = 0; $TQTC = 0; $TQTR = 0; $TSess = 0; $TMH = 0; // Loop through the rows of the result while ($myrow = getRow($result, $db)) { // Update the latest data date, if necessary if ($myrow[5] > $maxdate) {
$starttime = strftime("%A, %B %d %Y, %H:%M"); // Open the database $db = mysql_connect($host, $dbuser, $dbpassword); mysql_select_db($DatabaseName, $db); ARESheader($title, "Adjust Member Count"); ARESleftBar($db); echo ' <div id="main">' . "\n"; $Q1 = "SELECT DISTINCT `COUNTY` FROM `arpsc_ecrept`"; $R1 = getResult($Q1, $db); while ($row1 = getRow($R1, $db)) { $Q2 = "SELECT MAX(`PERIOD`) FROM `arpsc_ecrept` " . "WHERE `county`='" . $row1[0] . "'"; $last = singleResult($Q2, $db); $Q3 = "SELECT `ARESMEM` FROM `arpsc_ecrept` " . "WHERE `COUNTY`='" . $row1[0] . "' " . "AND `PERIOD`=" . $last; $latest = singleResult($Q3, $db); $Q4 = "SELECT `ARESMEM` FROM `arpsc_ecrept` " . "WHERE `COUNTY`='" . $row1[0] . "' " . "AND `PERIOD`=0"; $zeroth = singleResult($Q4, $db); echo "<p>" . $row1[0] . ": " . $last . ", "; if ($latest == $zeroth) { echo $latest . ", " . $zeroth . "</p>\n"; } else { if ($zeroth > 0) { echo "<b>" . $latest . ", " . $zeroth . "</b><br/>\n"; $Q5 = 'UPDATE `arpsc_ecrept` SET `ARESMEM`=' . $latest . " WHERE `COUNTY`='" . $row1[0] . "' AND `PERIOD`=0"; echo "---" . $Q5 . "---</p>\n"; $R5 = getResult($Q5, $db); } else { echo "<span style=\"color: red;\">" . $latest . ", " . $zeroth . "</span><br />\n"; $Q5 = "INSERT INTO `arpsc_ecrept` (PERIOD,COUNTY,ARESMEM,UPDATED) " . "VALUES(0,'" . $row1[0] . "'," . $latest . ",NOW());"; echo "---" . $Q5 . "---</p>\n"; $R5 = getResult($Q5, $db); }
$SQL7 = addUpdate('aresopsnum', $DNUMTOT, $SQL7); $SQL7 = addUpdate('aresops', $DPHTOT, $SQL7); $SQL7 = addUpdate('comments', $DCOMMENTS, $SQL7); $SQL7 = addUpdate('reportcall', $DREPORTCALL, $SQL7); $SQL7 = addUpdate('reportname', $DREPORTNAME, $SQL7); $SQL7 = substr($SQL7, 0, strlen($SQL7) - 2); $SQL7 = $SQL7 . ' WHERE period=' . $DPERIOD . ' AND county = ' . $DCOUNTY; // echo '<P><FONT FACE="Courier New" SIZE=3>' . $SQL7 . "</FONT></P>\n"; if (getResult($SQL7, $db)) { echo " <P>Your report has been updated in the database.</P>\n"; } } $SQL2 = "SELECT lastday FROM periods WHERE periodno=" . $PERIOD; $LASTDAY = singleResult($SQL2, $db); $SQL3 = "SELECT countyname FROM arpsc_counties WHERE countycode='" . $COUNTY . "'"; $COUNTYNAME = singleResult($SQL3, $db); echo " </TD>\n</TABLE>\n"; echo "<HR>\n"; echo "<TABLE CLASS=main_area>\n <TD>\n"; echo "<P CLASS=report_area><B>FSD-212 report from " . $REPORTNAME . ", " . $REPORTCALL . " <" . $REPORTEMAIL . ">" . ".</B></P>\n"; echo "<P CLASS=report_area>(1) County: <B>" . $COUNTYNAME . " (" . $COUNTY . ")</B></P>\n"; echo "<P CLASS=report_area>(2) Period: <B>" . convertDate($LASTDAY) . "</B></P>\n"; echo "<P CLASS=report_area>(4) Number of ARES members: <B>" . $ARESMEM . "</B></P>\n"; echo "<P CLASS=report_area>(5) Change since last month: <B>" . $ARESCHG . "</B></P>\n"; echo "<P CLASS=report_area>(6) Local net name: <B>" . $NETNAME . "</B></P>\n"; echo "<P CLASS=report_area>(7) Local net frequency: <B>" . $NETFREQ . "</B></P>\n"; echo "<P CLASS=report_area>(8) Liaisons maintained with the following NTS net(s): <B>" . $NETLIA . "</B></P>\n"; echo "<P CLASS=report_area>(9) Number of nets, drills, tests and training sessions: <B>" . $NUMNET . "</B> Hours: <B>" . $PHNET . "</B></P>\n"; echo "<P CLASS=report_area>(10) Number of public service events: <B>" . $NUMPSE . "</B> Hours: <B>" . $PHPSE . "</B></P>\n"; echo "<P CLASS=report_area>(11) Number of emergency operations: <B>" . $NUMEOP . "</B> Hours: <B>" . $PHEOP . "</B></P>\n"; echo "<P CLASS=report_area>(12) Total number of ARES events: <B>" . $NUMTOT . "</B> Hours: <B>" . $PHTOT . "</B></P>\n";
} } echo " </tr>\n"; for ($daynum = 0; $daynum < 7; $daynum++) { $SQL3 = "SELECT `day_of_week` FROM `rep_dow` WHERE `id`=" . $daynum; $daytext = singleResult($SQL3, $db); echo " <tr>\n"; echo " <th>" . $daytext . "</th>\n"; $res1 = getResult($SQL1, $db); while ($row1 = getRow($res1, $db)) { $SQL4 = "SELECT `call` FROM `rep_liaisons` WHERE `day_of_week`=" . $daynum . " AND `net`=" . $row1[0]; $call = singleResult($SQL4, $db); if ($call) { echo " <td align=\"center\">" . $call . "</td>\n"; $SQL6 = "SELECT `updated` FROM `rep_liaisons` WHERE `day_of_week`=" . $daynum . " AND `net`=" . $row1[0]; $updated = singleResult($SQL6, $db); if ($updated > $maxdate) { $maxdate = $updated; } } else { echo " <td> </td>\n"; } } echo " </tr>\n"; } echo "</table>\n"; echo "<p> </p>\n"; /* // Get the actual report data for this period $SQL='SELECT `call`,`total`,`notes`,`updated` FROM `sar` WHERE `period`=' . $period . ' ORDER BY `total` DESC'; $result=getResult($SQL,$db);
$SQL = 'SELECT `netid`,`qtc`,`updated` FROM `netreport` WHERE `period`=' . $period . ' ORDER BY `qtc` DESC'; $result = getResult($SQL, $db); echo " <P>Net traffic for " . convertDate($usedate) . ": "; $counter = 0; while ($myrow = getRow($result, $db)) { if ($counter > 0) { echo ", "; } if ($myrow[2] > $maxdate) { $maxdate = $myrow[2]; } $SQL2 = "SELECT `netfullname` FROM `nets` WHERE `netid`=" . $myrow[0]; $netname = singleResult($SQL2, $db); // Now display the data echo $netname . " " . $myrow[1]; $counter = $counter + 1; } echo ". </P>\n"; $SQL = "SELECT SUM(`QTC`) FROM `netreport`" . " WHERE `period`=" . $period; echo "<p>Total net traffic reported: " . singleResult($SQL, $db) . "</p>\n"; echo " </td></tr>\n"; echo " <tr><td> </td></tr>\n"; echo "</table>\n"; echo "<P> </p>\n"; echo "<div id=\"footer\">\n"; footer($starttime, $maxdate, "\$Revision: 1.0 \$ - \$Date: 2013-03-15 13:27:48-04 \$"); echo "</div>\n"; ?> </BODY> </HTML>
echo " <td align=\"center\" " . "style=\"background:white;\">" . $row1[1] . "</td>\n"; if ($maxdate < $row1[2]) { $maxdate = $row1[2]; } } else { echo " <td> </td>\n"; } echo " </tr>\n"; } } else { // QMN echo " <th>Early NCS</th>\n <th>Late NCS</th>\n"; echo " </tr>\n"; for ($day = 0; $day < 7; $day++) { $SQL3 = "SELECT `day_of_week` FROM `rep_dow` WHERE `id`=" . $day; $daytext = singleResult($SQL3, $db); echo " <tr>\n"; echo " <th>" . $daytext . "</th>\n"; // QMN Early $SQL4 = "SELECT `call`,`updated` FROM `net_controls` " . "WHERE `netid`=" . $netid . " AND `dow`=" . $day; $res4 = getResult($SQL4, $db); if ($row4 = getRow($res4, $db)) { echo " <td align=\"center\" " . "style=\"background:white;\">" . $row4[0] . "</td>\n"; if ($maxdate < $row4[1]) { $maxdate = $row4[1]; } } else { echo " <td> </td>\n"; } // QMN Late $SQL5 = "SELECT `call`,`updated` FROM `net_controls` " . "WHERE `netid`=" . $otherid . " AND `dow`=" . $day;
// Update the latest data date, if necessary if ($myrow[6] > $maxdate) { $maxdate = $myrow[6]; } // Choose between light and dark rows if ($rownum != 0) { $id = 'id="OsRow3"'; echo " <tr id=OsRow>\n"; $rownum = 0; } else { $id = 'id="OsRow4"'; echo " <tr id=OsRow2>\n"; $rownum = 1; } $SQL3 = "SELECT `lastday` FROM `periods` WHERE `periodno`=" . $myrow[0]; $longdate = singleResult($SQL3, $db); echo ' <td ' . $id . ' align="left">' . convertDateShort($longdate) . "</td>\n"; echo ' <td ' . $id . ' align="right">' . $myrow[1] . "</td>\n"; echo ' <td ' . $id . ' align="right">' . $myrow[2] . "</td>\n"; echo ' <td ' . $id . ' align="right">' . $myrow[3] . "</td>\n"; echo ' <td ' . $id . ' align="right">' . $myrow[4] . "</td>\n"; // Calculate totals for the obvious ones $TQNI = $TQNI + $myrow[1]; $TQTC = $TQTC + $myrow[2]; $TQTR = $TQTR + $myrow[3]; $TSess = $TSess + $myrow[4]; // For manhours, use reported if available if ($myrow[5] > 0) { echo ' <td ' . $id . ' align="right">' . $myrow[5] . "</td>\n"; $TMH = $TMH + $myrow[5]; } else {
//================================================================================================== $q1 = 'SELECT `districtkey`, `district_code` from `arpsc_districts` ORDER BY `district_code`'; $r1 = getResult($q1, $db); $olddistrict = 0; while ($row1 = getRow($r1, $db)) { $district = $row1[1]; $q2 = "SELECT `countyname`, `countycode` FROM `arpsc_counties` WHERE `district`='" . $district . "' ORDER BY `countyname`"; $r2 = getResult($q2, $db); if ($district < ":") { echo "<tr></tr>\n"; $sqlc = 'SELECT COUNT(*) FROM `arpsc_counties` WHERE `district`=' . $district; $lc = singleResult($sqlc, $db); // Extra line for staff, if reported ---------------------------- $key1 = "D" . $district; $sqlc1 = "SELECT COUNT(*) FROM `arpsc_ecrept` WHERE `county`='" . $key1 . "' AND `period`=" . $period; if (singleResult($sqlc1, $db) > 0) { $lc = $lc + 1; } while ($row2 = getRow($r2, $db)) { //echo $district . ',' . $row2[0] . "<br>\n"; $q3 = 'SELECT `aresmem`,`drillsnum`,`drillshrs`,`psesnum`,`pseshrs`,`eopsnum`,`eopshrs`,`aresopsnum`,`aresops` ' . "FROM `arpsc_ecrept` WHERE `county`='" . $row2[1] . "' AND `period`=" . $period; $r3 = getResult($q3, $db); if ($row3 = getRow($r3, $db)) { $hours = $row3[2] + $row3[4] + $row3[6] + $row3[8]; $value = $hours * $hourvalue; $lastperiod = $period - 1; $q4 = "SELECT `aresmem` FROM `arpsc_ecrept` WHERE `county`='" . $row2[1] . "' AND `period`=" . $lastperiod; $r4 = getResult($q4, $db); if ($row4 = getRow($r4, $db)) { $change = $row3[0] - $row4[0]; } else {
?> <div id="main"> <?php // Initialize the latest data counter $maxdate = 0; // Get the requested period, if blank choose the latest $period = $_GET['period']; if ($period < 1) { $SQL = "SELECT MAX(period) FROM netreport"; $period = singleResult($SQL, $db); } echo " <center>\n"; // Display the month name for this report $SQL = 'SELECT lastday FROM periods WHERE periodno=' . $period; echo "<p><h1>Net reports for " . convertDate(singleResult($SQL, $db)) . "</h1></p>\n"; // Get the actual report data for this period $SQL = 'SELECT B.netfullname,A.QNI,A.QTC,A.QTR,A.sessions,A.updated,A.manhours ' . 'FROM netreport A, nets B ' . 'WHERE A.period=' . $period . ' AND A.netID=B.netID ' . 'ORDER BY QTC DESC, QNI DESC'; $result = getResult($SQL, $db); echo "<table>\n"; echo "<tr><th align=\"left\">Net Name</th><th>QNI</th><th>QTC</th><th>QTR</th><th>Sessions</th><th>Hours</th></tr>\n"; // We will use rownum to keep track of light and dark rows $rownum = 1; // The following variables are used to calculate totals for the month $TQNI = 0; $TQTC = 0; $TQTR = 0; $TSess = 0; $TMH = 0; // Loop through the rows of the result while ($myrow = getRow($result, $db)) {
echo " <center><b>" . $county . " (" . $ccode . ")</b><br />\n"; // Now open the database and write the result //include('../includes/miscFunctions.inc'); $db = mysql_connect("localhost", $dbuser, $dbpwd); if (!$db) { echo "<p>User:"******" Pwd:" . $dbpwd . "</p>\n"; die($err . " Connect db error #" . mysql_errno($db) . "</p>\n"); echo "<p onload=document.getElementByID(\"errordiv\").innerHTML = \"ERROR\"> </p>\n"; $GLOBALS['uploaderror'] = 1; } if (!mysql_select_db($DatabaseName, $db)) { die($err . " Select db error #" . mysql_errno($db) . "</p>\n"); $GLOBALS['uploaderror'] = 1; } $q = "SELECT COUNT(*) FROM `ares_juris` WHERE `call` = '" . $_SESSION['call'] . "' AND `juris` = '" . $ccode . "'"; if (!($res = singleResult($q, $db))) { $GLOBALS['uploaderror'] = 1; die($err . " no authorization " . $county . "</p>\n"); } // Generate initial SQL $havedata = 0; $sql = "INSERT INTO `arpsc_ecrept` VALUES(" . thePeriod() . ",'" . $ccode . "',"; // Open the table for results display echo " </span>\n <span style=\"color:mediumblue;\">\n"; $s = fgets($fh, 256); $s = fgets($fh, 256); echo " <span style=\"font-size:8px;\">\n"; echo " <table border=\"0\" width=50%>\n"; // Members $sql = nextRow($fh, $sql, $m); $sql = $sql . "NULL,NULL,NULL,NULL, ";
$s2 = "SELECT `pageid` FROM `webpages` WHERE `url`='" . $pageurl . "'"; $pageid = singleResult($s2, $db); if ($pageid > 0) { $s3 = "SELECT `buttontext` FROM `anavbar_subs` WHERE `pageid`=" . $pageid; $buttontext = singleResult($s3, $db); echo $buttontext . " updated on " . $r1[1] . ".<br />\n"; } else { echo "txtblk.php?topic=" . $r1[0] . " updated on " . $r1[1] . ".<br />\n"; } $lastblock = $r1[0]; } } echo "</p>\n"; echo "<h3>Section Leaders</h3>\n"; $s1 = "SELECT MAX(`updated`) FROM `sect_appt`"; $leaderdate = singleResult($s1, $db); $s2 = "SELECT `title`,`id` FROM `sect_appt` WHERE `updated`='" . $leaderdate . "'"; $q2 = getResult($s2, $db); while ($r2 = getRow($q2, $db)) { echo "<p>" . $r2[0] . " updated on " . $leaderdate . ".</p>\n"; } if ($leaderdate > $maxdate) { $maxdate = $leaderdate; } echo "<h3>ARPSC Net Controls</h3>\n"; echo "<p>The ARPSC Net Control page relies entirely on calculation, and " . "thus may change any time you look at it.</p>\n"; echo " </div>\n"; sectLeaders($db); footer($starttime, $maxdate, "\$Revision: 1.1 \$ - \$Date: 2007-10-30 16:10:49-04 \$"); ?> </div>
include 'includes/functions.inc'; // Remember the launch time $starttime = strftime("%A, %B %d %Y, %H:%M"); // Open the database $db = mysql_connect($host, $dbuser, $dbpassword); mysql_select_db($DatabaseName, $db); // Get the requested period, if blank choose the latest $county = $_GET['county']; // // Display the month name for this report // $SQL = 'SELECT lastday FROM `periods` WHERE `periodno`=' . $period; // $usedate=singleResult($SQL,$db); //ARESheader($title,"NTS Michigan Section Traffic"); //ARESleftBar( $db ); //echo ' <div id="main">' . "\n"; $q2 = "SELECT `countyname` FROM `arpsc_counties` WHERE `countycode`='" . $county . "'"; $countyname = singleResult($q2, $db); //echo ' <p><h1>FSD-212 Report for ' . $countyname . "</h1></p>\n"; /*?> <table> <tr> <td class="rowS0" rowspan="2">Period</td> <td class="rowS0" rowspan="2">Monthly Man Hours</td> <td class="rowS0" rowspan="2">Contrib Dollar Value</td> <td class="rowS0" rowspan="2">Total # ARES mbrs</td> <td class="rowS0" colspan="2">Net</td> <td class="rowS0" colspan="2">Public Service</td> <td class="rowS0" colspan="2">Emergency</td> </tr> <tr> <td class="rowS0">Num</td> <td class="rowS0">Man Hours</td>
$db = mysql_connect($host, $dbuser, $dbpassword); mysql_select_db($DatabaseName, $db); // Remember the launch time $starttime = strftime("%A, %B %d %Y, %H:%M"); echo '<P></P>' . "\n"; // Initialize the most recent data counter $maxdate = 0; // Get the requested period, if blank choose the latest $period = $_GET['period']; if ($period < 1) { $SQL = "SELECT MAX(period) FROM netreport"; $period = singleResult($SQL, $db); } // Display the month name for this report $SQL = 'SELECT lastday FROM periods WHERE periodno=' . $period; $usedate = convertDate(singleResult($SQL, $db)); echo '"Net reports for ' . $usedate . '"<BR><BR>' . "\n"; // Get the actual report data for this period $SQL = 'SELECT B.netfullname,A.QNI,A.QTC,A.QTR,A.sessions,A.updated,A.manhours,B.nethf ' . 'FROM netreport A, nets B ' . 'WHERE A.period=' . $period . ' AND A.netID=B.netID ' . 'ORDER BY QTC DESC, QNI DESC'; $result = getResult($SQL, $db); echo "<TABLE class=main_page>\n"; echo '<TD>"Net Name","QNI","QTC","QTR","Sessions","Hours"<TR>' . "\n"; // We will use rownum to keep track of light and dark rows $rownum = 1; // The following variables are used to calculate totals for the month $TQNI = 0; $TQTC = 0; $TQTR = 0; $TSess = 0; $TMH = 0; $TQNIH = 0;
$starttime = strftime("%A, %B %d %Y, %H:%M"); // Open the database $db = mysql_connect($host, $dbuser, $dbpassword); mysql_select_db($DatabaseName, $db); // $period=92; // Get the requested period, if blank choose the latest $period = $_GET['period']; if ($period < 1) { $SQL = "SELECT MAX(`period`) FROM `arpsc_ecrept`"; $period = singleResult($SQL, $db); } $p9 = $period; $p1 = (int) ((int) $p9 - 11); // Display the month name for this report $SQL = 'SELECT lastday FROM `periods` WHERE `periodno`=' . $period; $usedate = singleResult($SQL, $db); $monthnames = array('J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'); ARESheader($title, "ARPSC Michigan Section Summary"); ARESleftBar($db); echo ' <div id="main">' . "\n"; echo " <center>\n"; // CSS classes used in the table $s0 = "class=\"rowS0\""; $s1 = "class=\"rowS1\""; $s1B = "class=\"rowS1B\""; $s1S = "class=\"rowS1S\""; $s1L = "class=\"rowS1L\""; $s2 = "class=\"rowS2\""; $s2S = "class=\"rowS2S\""; //================================================================================================== // F S D 2 1 2 T a b l e
if (isset($_GET['netid'])) { $netid = $_GET['netid']; } else { if (isset($_POST['netid'])) { $netid = $_POST['netid']; } } echo "<p>Day [" . $day . "]</p>\n"; echo "<p>Call [" . $call . "]</p>\n"; echo "<p>Net [" . $netid . "]</p>\n"; if ($day == "#") { header("Location: ncsedit.php?netid=" . $netid); } $db = myInit($aa0, $aa1, $aa2, $aa3); $SQL0 = "SELECT COUNT(*) FROM `net_controls` WHERE `netid`=" . $netid . " AND `dow`=" . $day; if (singleResult($SQL0, $db) == 0) { $SQL = "INSERT INTO `net_controls` VALUES(" . $netid . "," . $day . ",'" . $call . "',NOW())"; $res = getResult($SQL, $db); } else { if ($call == "") { $SQL = "DELETE FROM `net_controls` " . " WHERE `netid`=" . $netid . " AND `dow`=" . $day; } else { $SQL = "UPDATE `net_controls` SET `call`='" . $call . "' WHERE `netid`=" . $netid . " AND `dow`=" . $day; } $res = getResult($SQL, $db); } if (!$res) { echo "<p><b>Error!</p></b>\n"; } else { header("Location: ncsedit.php?netid=" . $netid); }
} echo "Total all districts" . ",," . round($gmanhrs) . ',' . round($gvalue) . ',' . $garesmem . ',' . $gareschg . ',' . $gnetsess . ',' . round($gnethrs) . ',' . $gpsnum . ',' . round($gpshrs) . ',' . $gemnum . ',' . round($gemhrs) . "<br />\n"; //================================================================================================== // D e t a i l L i n e s //================================================================================================== $q1 = 'SELECT `districtkey`, `district_code` from `arpsc_districts` ORDER BY `district_code`'; $r1 = getResult($q1, $db); $olddistrict = 0; while ($row1 = getRow($r1, $db)) { $district = $row1[1]; $q2 = "SELECT `countyname`, `countycode` FROM `arpsc_counties` WHERE `district`='" . $district . "' ORDER BY `countyname`"; $r2 = getResult($q2, $db); if ($district < ":") { echo "<tr></tr>\n"; $sqlc = 'SELECT COUNT(*) FROM `arpsc_counties` WHERE `district`=' . $district; $lc = singleResult($sqlc, $db); while ($row2 = getRow($r2, $db)) { //echo $district . ',' . $row2[0] . "<br>\n"; $q3 = 'SELECT `aresmem`,`drillsnum`,`drillshrs`,`psesnum`,`pseshrs`,`eopsnum`,`eopshrs`,`aresopsnum`,`aresops` ' . "FROM `arpsc_ecrept` WHERE `county`='" . $row2[1] . "' AND `period`=" . $period; $r3 = getResult($q3, $db); if ($row3 = getRow($r3, $db)) { $hours = $row3[2] + $row3[4] + $row3[6] + $row3[8]; $value = $hours * 18.11; $lastperiod = $period - 1; $q4 = "SELECT `aresmem` FROM `arpsc_ecrept` WHERE `county`='" . $row2[1] . "' AND `period`=" . $lastperiod; $r4 = getResult($q4, $db); if ($row4 = getRow($r4, $db)) { $change = $row3[0] - $row4[0]; } else { $q4 = "SELECT `aresmem` FROM `arpsc_ecrept` WHERE `county`='" . $row2[1] . "' AND `period`=0"; $r4 = getResult($q4, $db);
mysql_select_db($DatabaseName, $db); // If the call has been set by the form, grab it if (isset($_POST['call'])) { $call = strtoupper($_POST['call']); // Too-long call might be SQL injection attempt if (strlen($call) > 7) { $call = 'fail'; } else { $pwd = $_POST['pwd']; // Extra long pwd might be SQL injection attempt if (strlen($pwd) > 24) { $call = 'fail'; } else { // Read the password from the database and compare it $q = "SELECT `password` FROM `ares_password` WHERE `call`='" . $call . "'"; $tpw = singleResult($q, $db); // If wrong password, set to fail if ($tpw != $pwd) { $call = 'fail'; } } } } else { $call = 'fail'; } // If call == fail, return to login screen if ($call == 'fail') { session_destroy(); header("Location: login.php"); } else { session_start();