PageRenderTime 58ms CodeModel.GetById 25ms RepoModel.GetById 1ms app.codeStats 0ms

/nmi_tools/www/results/Run-main.php

https://github.com/clalancette/condor-dcloud
PHP | 657 lines | 553 code | 73 blank | 31 comment | 97 complexity | d7b8c1944c5d288f2e99b8b97bbc4581 MD5 | raw file
Possible License(s): Apache-2.0
  1. <?php
  2. include "last.inc";
  3. ?>
  4. <html>
  5. <body bgcolor="#d9d9ff" text="navy" link="#666699" alink=#000000 vlink="#333333">
  6. <title>NWO run results</title>
  7. <LINK REL="StyleSheet" HREF="condor.css" TYPE="text/css">
  8. <center><h2>UW NMI build and test system</h2><br>
  9. Select a run id from the left column or a run dir from the right to view more details, or use the search options below to refine your view.
  10. <?php
  11. require_once "./load_config.inc";
  12. load_config();
  13. $local_hostname = WEBSERVER;
  14. # get args, and figure out if we are accessing this page for the first time or not
  15. $args["gid"] = $_REQUEST["gid"];
  16. $args["runid"] = $_REQUEST["runid"];
  17. $args["user"] = $_REQUEST["user"];
  18. $args["result"] = $_REQUEST["status"];
  19. $args["run_type"] = $_REQUEST["runtype"];
  20. $args["project"] = $_REQUEST["project"];
  21. $args["component"] = $_REQUEST["component"];
  22. $limit = $_REQUEST["limit"];
  23. # don't put the date arguments into the args array because they must be manipulated before we can use them
  24. $arg_day = $_REQUEST["day"];
  25. $arg_month = $_REQUEST["month"];
  26. $arg_year = $_REQUEST["year"];
  27. $currentDir = "results";
  28. $basedir = "rundir"; # absolute path is /nmi/run
  29. $su = $_REQUEST["search"]; # search button
  30. $re = $_REQUEST["reset"]; # reset button
  31. $da = $_REQUEST["today"]; # today button
  32. if ( is_null( $re ) ) {
  33. # trim down the array - remove keys whose value is ALL or ""
  34. foreach ($args as $key => $val) {
  35. if($val == "" || $val == " " || is_null($val) || (strstr($val, "ALL")) ) {
  36. unset($args[$key]);
  37. }
  38. }
  39. } else {
  40. # reset array of search values to null
  41. foreach ($args as $key => $val) {
  42. unset($args[$key]);
  43. }
  44. unset($arg_day);
  45. unset($arg_month);
  46. unset($arg_year);
  47. }
  48. $db = mysql_connect(WEB_DB_HOST, DB_READER_USER, DB_READER_PASS) or die ("Could not connect : " . mysql_error());
  49. mysql_select_db(DB_NAME) or die("Could not select database");
  50. # find all unique users of the system for the dropdown box
  51. $query2 = "SELECT DISTINCT user FROM Run";
  52. $result2 = mysql_query($query2) or die ("Query failed : " . mysql_error());
  53. while($res2 = mysql_fetch_array($result2)){
  54. $t_users[] = trim( $res2["user"]);
  55. }
  56. $tempusers = array_unique( $t_users );
  57. foreach ($t_users as $t_user) {
  58. $users["$t_user"] = "";
  59. }
  60. ksort( $users );
  61. $arg_users = $args["user"];
  62. if ( is_null( $arg_users ) ) {
  63. $users["ALL"] = "SELECTED";
  64. $users["$arg_users"] = "";
  65. } else {
  66. $users["ALL"] = "";
  67. $users["$arg_users"] = "SELECTED";
  68. }
  69. # find all possible run types for dropdown box
  70. $query3 = "SELECT DISTINCT run_type FROM Run";
  71. $result3 = mysql_query($query3) or die ("Query failed : " . mysql_error());
  72. while($res3 = mysql_fetch_array($result3)){
  73. $t_run_types[] = trim( $res3["run_type"] );
  74. }
  75. $t_run_types = array_unique( $t_run_types );
  76. foreach ($t_run_types as $t_run_type) {
  77. $run_types["$t_run_type"] = "";
  78. }
  79. ksort( $run_types );
  80. $arg_run_type = $args["run_type"];
  81. if ( is_null( $arg_run_type ) ) {
  82. $run_types["ALL"] = "SELECTED";
  83. $run_types["$arg_run_type"] = "";
  84. } else {
  85. $run_types["ALL"] = "";
  86. $run_types["$arg_run_type"] = "SELECTED";
  87. }
  88. # find all status possiblities for dropdown box
  89. $query4 = "SELECT DISTINCT result FROM Run";
  90. $result4 = mysql_query($query4) or die ("Query failed : " . mysql_error());
  91. while($res4 = mysql_fetch_array($result4)){
  92. if ( is_null( $res4["result"] ) ) {
  93. $t_statuses[] = "NULL";
  94. } else {
  95. $t_statuses[] = trim( $res4["result"] );
  96. }
  97. }
  98. $t_statuses = array_unique( $t_statuses );
  99. foreach ($t_statuses as $t_status) {
  100. $statuses["$t_status"] = "";
  101. }
  102. ksort( $statuses );
  103. $arg_result = $args["result"];
  104. if ( is_null( $arg_result ) ) {
  105. $statuses["ALL"] = "SELECTED";
  106. $statuses["$arg_result"] = "";
  107. } else {
  108. $statuses["ALL"] = "";
  109. $statuses["$arg_result"] = "SELECTED";
  110. }
  111. # find all project possiblities for dropdown box
  112. $query5 = "SELECT DISTINCT project FROM Run";
  113. $result5 = mysql_query($query5) or die ("Query failed : " . mysql_error());
  114. while($res5 = mysql_fetch_array($result5)){
  115. $t_projects[] = trim( $res5["project"] );
  116. }
  117. $t_projects = array_unique( $t_projects );
  118. foreach ($t_projects as $t_project) {
  119. $projects["$t_project"] = "";
  120. }
  121. uksort($projects, "strnatcasecmp");
  122. $arg_project = $args["project"];
  123. if ( is_null( $arg_project ) ) {
  124. $projects["ALL"] = "SELECTED";
  125. $projects["$arg_project"] = "";
  126. } else {
  127. $projects["ALL"] = "";
  128. $projects["$arg_project"] = "SELECTED";
  129. }
  130. # find all status possiblities for dropdown box
  131. $query6 = "SELECT DISTINCT component FROM Run";
  132. $result6 = mysql_query($query6) or die ("Query failed : " . mysql_error());
  133. while($res6 = mysql_fetch_array($result6)){
  134. $t_components[] = trim( $res6["component"] );
  135. }
  136. $t_components = array_unique( $t_components );
  137. foreach ($t_components as $t_component) {
  138. $components["$t_component"] = "";
  139. }
  140. uksort($components, "strnatcasecmp");
  141. $arg_component = $args["component"];
  142. if ( is_null( $arg_component ) ) {
  143. $components["ALL"] = "SELECTED";
  144. $components["$arg_component"] = "";
  145. } else {
  146. $components["ALL"] = "";
  147. $components["$arg_component"] = "SELECTED";
  148. }
  149. # To get date functions to work, you have to compile PHP with --enable-calendar.
  150. # find all day possiblities for dropdown box
  151. $find_date = date('d');
  152. for ($i = 1; $i <= 31; $i++) {
  153. $date_array["$i"] = "";
  154. }
  155. if ( is_null( $arg_day ) ) {
  156. $date_array["ALL"] = "SELECTED";
  157. $date_array["$arg_day"] = "";
  158. } else if ( !is_null( $da ) ) { # today button pressed
  159. $date_array["$find_date"]="SELECTED";
  160. $date_array["ALL"] = "";
  161. } else {
  162. $date_array["ALL"]="";
  163. $date_array["$arg_day"]="SELECTED";
  164. }
  165. # TODO: Use month name rather than numbers once we have date functions available.
  166. # find all month possiblities for dropdown box
  167. $find_date = date('m');
  168. for ($i = 1; $i <= 12; $i++) {
  169. #$month_array["$i"] = JDMonthName( $i, 0 );
  170. $month_array["$i"] = "";
  171. }
  172. if ( is_null( $arg_month ) ) {
  173. $month_array["ALL"] = "SELECTED";
  174. $month_array["$arg_month"] = "";
  175. } else if ( !is_null( $da ) ) { # today button pressed
  176. $month_array["$find_date"]="SELECTED";
  177. $month_array["ALL"] = "";
  178. } else {
  179. $month_array["ALL"] = "";
  180. $month_array["$arg_month"] = "SELECTED";
  181. }
  182. # find all year possiblities for dropdown box
  183. $find_date = date('Y');
  184. $year_array["2004"]="";
  185. $year_array["2005"]="";
  186. if ( is_null( $arg_year ) ) {
  187. $year_array["ALL"] = "SELECTED";
  188. $year_array["$arg_year"] = "";
  189. } else if ( !is_null( $da ) ) { # today button pressed
  190. $year_array["$find_date"]="SELECTED";
  191. $year_array["ALL"] = "";
  192. } else {
  193. $year_array["ALL"] = "";
  194. $year_array["$arg_year"] = "SELECTED";
  195. }
  196. ?>
  197. <br><br>
  198. <table width=750 border=0 bgcolor=#d9d9ff>
  199. <!-- User Area -->
  200. <tr bgcolor=#d9d9ff width=750 valign=middle>
  201. <td width=200 align=center valign=middle>
  202. <form method="get" action="Run-main.php">
  203. <SELECT name="user">
  204. <?php
  205. foreach($users as $user=>$selected) {
  206. echo "<OPTION VALUE=$user $selected> $user </OPTION>";
  207. }
  208. ?>
  209. </SELECT> User
  210. </td>
  211. <!-- Project Area -->
  212. <td width=300 align=center>
  213. <SELECT name="project">
  214. <?php
  215. foreach($projects as $project=>$selected) {
  216. echo "<OPTION VALUE=$project $selected> $project </OPTION>";
  217. }
  218. ?>
  219. </SELECT> Project
  220. </td>
  221. <!-- Status Area -->
  222. <td width=250 align=center>
  223. <SELECT name="status">
  224. <?php
  225. foreach($statuses as $status=>$selected) {
  226. if ( $status == "0" ) {
  227. echo "<OPTION VALUE='$status' $selected> 0";
  228. } else if ( $status == "NULL" ) {
  229. echo "<OPTION VALUE='$status' $selected> running";
  230. } else {
  231. echo "<OPTION VALUE=$status $selected> $status ";
  232. }
  233. }
  234. ?>
  235. </SELECT> Result
  236. </td></tr>
  237. <!-- RunType Area -->
  238. <tr bgcolor=#d9d9ff width=750>
  239. <td width=200 align=center>
  240. <SELECT name="runtype">
  241. <?php
  242. foreach($run_types as $run_type=>$selected) {
  243. echo "<OPTION VALUE=$run_type $selected> $run_type ";
  244. }
  245. ?>
  246. </SELECT> Run Type
  247. </td>
  248. <!-- Component Area -->
  249. <td width=300 align=center>
  250. <SELECT name="component">
  251. <?php
  252. foreach($components as $component=>$selected) {
  253. echo "<OPTION VALUE='$component' $selected> $component ";
  254. }
  255. ?>
  256. </SELECT> Component
  257. </td>
  258. <!-- Size Limit Area -->
  259. <td width=250 align=center>
  260. <input type=text name="limit" size=8> Results Limit
  261. </td></tr>
  262. <!-- Day Area -->
  263. <tr bgcolor=#d9d9ff width=600>
  264. <td width="50" align=center>
  265. <SELECT name="day">
  266. <?php
  267. foreach($date_array as $dates=>$selected) {
  268. echo "<OPTION VALUE='$dates' $selected>$dates ";
  269. }
  270. ?>
  271. </SELECT> Day
  272. </td>
  273. <!-- Month Area -->
  274. <td width="50" align=center>
  275. <SELECT name="month">
  276. <?php
  277. foreach($month_array as $months=>$selected) {
  278. echo "<option value='$months' $selected>$months ";
  279. }
  280. ?>
  281. </SELECT> Month
  282. </td>
  283. <!-- Year Area -->
  284. <td width="50" align=center>
  285. <SELECT name="year">
  286. <?php
  287. foreach($year_array as $years=>$selected) {
  288. echo "<option value='$years' $selected>$years ";
  289. }
  290. ?>
  291. </SELECT> Year
  292. </td></tr>
  293. <!-- Button for today's date -->
  294. <tr bgcolor=#d9d9ff width=600>
  295. <td width="50" align=center>
  296. <input type="submit" name="today" value="Today"></input>
  297. </td>
  298. <!-- Button for this month -->
  299. <td width="50" align=center>
  300. <input type="submit" name="thismonth" value="This month"></input>
  301. </td>
  302. <!-- Button for this year -->
  303. <td width="50" align=center>
  304. <input type="submit" name="thisyear" value="This year"></input>
  305. </td></tr>
  306. </table>
  307. <pre>
  308. <input type="submit" name="search" value="Submit Search"></input> <input type="submit" name="reset" value="Reset Values"></input>
  309. </pre>
  310. </form>
  311. <hr>
  312. <!-- ID select Form -->
  313. <center>
  314. <form method="get" action="Task-search.php">
  315. <input type="text" size=50 name="gid"></input>
  316. <input type="submit" name="submit" value="Search by GID" size=100></input>
  317. </form>
  318. <form method="get" action="Task-search.php">
  319. <input type="text" size=6 name="runid"></input>
  320. <input type="submit" name="submit" value="Search by RunID" size=100></input>
  321. </form>
  322. </center>
  323. <br>
  324. <?php
  325. ##############################################################################
  326. # Create database queries to populate the statistics header and results table.
  327. ##############################################################################
  328. # adjust date formats for statistics queries
  329. $dd .='_________';
  330. $date_format='%';
  331. $d_f ="%";
  332. # Put all date calculations here
  333. # TODO: To get PHP's date functions to work, you have to compile PHP with --enable-calendar.
  334. # TODO: Some of the date calculations are broken. Fix them when we have date functions available.
  335. if ( !is_null($arg_year) && !strstr( $arg_year, "ALL") ) {
  336. if ( !is_null($arg_month) && !strstr( $arg_month, "ALL") ) {
  337. if (!is_null($arg_day) && !strstr( $arg_day, "ALL") ) {
  338. $date_range_start = "$arg_year-$arg_month-$arg_day 05:00:00";
  339. $newday = $arg_day + 1;
  340. $date_range_finish = "$arg_year-$arg_month-$newday 05:00:00";
  341. } else {
  342. $date_range_start = "$arg_year-$arg_month-00 05:00:00";
  343. $newmonth = $arg_month + 1;
  344. $date_range_finish = "$arg_year-$newmonth-00 05:00:00";
  345. }
  346. } else {
  347. $date_range_start = "$arg_year-00-00 05:00:00";
  348. $newyear = $arg_year + 1;
  349. $date_range_finish = "$newyear-00-00 05:00:00";
  350. }
  351. } else { # no user input for dates
  352. $date_range_start = "2000-00-00 05:00:00";
  353. $date_range_finish = "2010-00-00 05:00:00";
  354. }
  355. $d_f = "$date_range_start";
  356. $date_format = "$date_range_finish";
  357. # create the SQL query for main page display
  358. $arsize = sizeof($args);
  359. $count = 0;
  360. $query1 = " FROM Run ";
  361. $limit1 = " ORDER BY runid DESC ";
  362. if ($arsize > 0) { # use user entered search criteria
  363. $query1 .= " WHERE ";
  364. # go through arg list
  365. foreach ($args as $key => $val) {
  366. if ( $val == "NULL" ) {
  367. $query1 .= " $key IS NULL ";
  368. } else {
  369. $query1 .= " $key='$val' ";
  370. }
  371. $count++;
  372. if ( $count < $arsize ) {
  373. $query1 .= "AND";
  374. }
  375. }
  376. if ($limit) {
  377. $limit1 .= " LIMIT $limit";
  378. } else {
  379. $limit1 .= " LIMIT 200";
  380. }
  381. $connector = " AND";
  382. } else if ($limit) {
  383. $query_main = "SELECT * FROM Run ORDER BY runid DESC LIMIT $limit";
  384. $connector = " WHERE";
  385. } else { # use default display criteria
  386. $query_main = "SELECT * FROM Run ORDER BY runid DESC LIMIT 400";
  387. $connector = " WHERE";
  388. }
  389. # if we have a complete query, don't bother with adding to it.
  390. if ( !strstr( $query_main, "SELECT") ) {
  391. $query_main = "SELECT * " . "$query1" . "and start > '$d_f' and start < '$date_format'". "$limit1";
  392. }
  393. # add the prefix for various statistics queries
  394. $query_stat = "select distinct user " . "$query1" . "$connector" . " start > '$d_f' and start < '$date_format'";
  395. $query_stat1 = "select result as builds1 " . "$query1" . "$connector" . " start > '$d_f' and start < '$date_format'";
  396. $query_stat2 = "select result" . "$query1" . "$connector" . " start > '$d_f' and start < '$date_format' and result IS NULL";
  397. $query_stat3 = "select count(result) as builds3" . "$query1" . "$connector" . " result >'0' and start > '$d_f' and start < '$date_format'";
  398. $query_stat4 = "select count(result) as builds4" . "$query1" . "$connector" . " result ='-1' and start > '$d_f' and start < '$date_format'";
  399. # run the statistics queries
  400. $db = mysql_connect(WEB_DB_HOST, DB_READER_USER , DB_READER_PASS) or die ("Could not connect : " . mysql_error());
  401. mysql_select_db(DB_NAME) or die("Could not select database");
  402. $result1 = mysql_query($query_main) or die ("Query failed : " . mysql_error());
  403. $result_stat = mysql_query($query_stat) or die ("Query failed : " . mysql_error());
  404. $buildsub = mysql_num_rows($result_stat);
  405. $result_stat1 = mysql_query($query_stat1) or die ("Query failed : " . mysql_error());
  406. $builds1 = mysql_num_rows($result_stat1);
  407. $result_stat2 = mysql_query($query_stat2) or die ("Query failed : " . mysql_error());
  408. $buidsprog = mysql_num_rows($result_stat2);
  409. $result_stat3 = mysql_query($query_stat3) or die ("Query failed : " . mysql_error());
  410. list($builds3) = mysql_fetch_row($result_stat3);
  411. $result_stat4 = mysql_query($query_stat4) or die ("Query failed : " . mysql_error());
  412. list($builds4) = mysql_fetch_row($result_stat4);
  413. # perform statistics calculations
  414. $percentage_multiplier = 100;
  415. if ($builds1 == '0') {
  416. $pprog = 0;
  417. $pfail = 0;
  418. $prem = 0;
  419. $psuc = 0;
  420. $ar=0;
  421. } else {
  422. $pprog = ($buidsprog/$builds1) * $percentage_multiplier;
  423. $pprog = round($pprog, 2);
  424. $pfail = ($builds3/$builds1) * $percentage_multiplier;
  425. $pfail = round($pfail, 2);
  426. $prem = ($builds4/$builds1) * $percentage_multiplier;
  427. $prem = round($prem, 2);
  428. $ar=$builds1 - ($buidsprog + $builds3 + $builds4);
  429. $psuc = ($ar/$builds1) * $percentage_multiplier;
  430. $psuc = round($psuc, 2);
  431. }
  432. # display the statistics
  433. echo "<table bgcolor='#cdcdcd' bordercolordark='black'>";
  434. echo "<tr><td>Total number of distinct users is " .$buildsub ."</td></tr>";
  435. echo "<tr><td>Total number of runs submitted is " . $builds1 ."</td></tr>";
  436. echo "<tr><td>Total number of runs in-progress is ".$buidsprog;
  437. echo "</td><td width='6'></td><td> Percentage of in-progress runs: ".$pprog . "% </td></tr>";
  438. echo "<tr><td>Total number of runs failed is " . $builds3;
  439. echo "</td><td width='6'></td><td>Percentage of failed runs: ".$pfail . "% </td></tr>";
  440. echo "<tr><td>Total number of runs removed is " . $builds4;
  441. echo "</td><td width='6'></td><td> Percentage of removed runs: ".$prem . "% </td></tr>";
  442. echo "<tr><td>Total number of runs successful is ".$ar ;
  443. echo "</td><td width='6'></td><td> Percentage of successful runs: ".$psuc . "% </td></tr></table>";
  444. # display the results table
  445. echo "<table width=100% border=1 bgcolor=#d9d9ff>";
  446. echo "<tr bgcolor=white>";
  447. echo "<td width=50>RunID</td>";
  448. echo "<td width=20>Result</td>";
  449. echo "<td width=70>User</td>";
  450. echo "<td width=120>Type</td>";
  451. echo "<td width=120>Project</td>";
  452. echo "<td width=120>Component</td>";
  453. echo "<td width=120>Start (CST) </td>";
  454. echo "<td width=120>Duration HH:MM:SS</td>";
  455. echo "<td width=100>Description</td>";
  456. echo "<td width=50>Platforms</td>";
  457. echo "<td width=50>Archived</td>";
  458. echo "<td width=100>Pin Expire Date</td>";
  459. echo "</tr>";
  460. while( $myrow = mysql_fetch_array($result1) ) {
  461. $gid = $myrow["gid"];
  462. $runid = $myrow["runid"];
  463. $project = $myrow["project"];
  464. $component = $myrow["component"];
  465. $user = $myrow["user"];
  466. $run_type = $myrow["run_type"];
  467. $start_ts = strtotime("$myrow[start]");
  468. $finish_ts = strtotime("$myrow[finish]");
  469. $start_ts = $start_ts + date("Z", $start_ts);
  470. $start = date("m/d/y H:i:s ", $start_ts);
  471. $finish_ts = $finish_ts + date("Z", $finish_ts);
  472. $finish = date("m/d/y H:i:s ", $finish_ts);
  473. $result = $myrow["result"];
  474. $description = $myrow["description"];
  475. $archived = $myrow["archived"];
  476. $archived_until = $myrow["archive_results_until"];
  477. $base = "$basedir/$gid/userdir";
  478. $webserver = $myrow["host"];
  479. $now_ts = strtotime("now");
  480. $pined_ts = strtotime("$myrow[archive_results_until]");
  481. $pined = $pined_ts - $now_ts;
  482. # find the duration, if the run is complete
  483. # if not finished, don't display a finish time
  484. if ( !( is_null($result)) ) {
  485. $duration_ts = $finish_ts - $start_ts;
  486. $duration = $duration_ts;
  487. } else {
  488. $duration = "In progress";
  489. $finish = "In progress";
  490. }
  491. echo "<tr>";
  492. echo "<td><a href=\"http://$webserver/$currentDir/Task-search.php?runid=$runid&gid=$gid\">$runid</a><br>$archived_until</td>";
  493. # figure out the result
  494. if ( is_null($result) ) {
  495. printf("<td bgcolor=#ffff55>%s</td>", "running");
  496. } else if ( $result == 0) {
  497. printf("<td bgcolor=#55ff55>%s</td>", $result);
  498. } else if ( $result == -1) {
  499. printf("<td bgcolor=#cd5c5c>%s</td>", "removed");
  500. } else {
  501. if ($component == 'condor' && preg_match('/^BUILD/', $run_type)) {
  502. $link = getLastGoodBuild($runid, 0);
  503. if ($link != '') {
  504. echo "<td bgcolor=#ff5555><a href=\"$link\">$result</a></td>";
  505. } else {
  506. printf("<td bgcolor=#ff5555>%s</td>",$result);
  507. }
  508. } else {
  509. printf("<td bgcolor=#ff5555>%s</td>",$result);
  510. }
  511. }
  512. printf("<td>%s</td>", $user);
  513. printf("<td>%s</td>", $run_type);
  514. printf("<td>%s</td>", $project);
  515. printf("<td>%s</td>", $component);
  516. echo "<td> $start </td>";
  517. # split up duration into readable units
  518. if ($duration != "In progress") {
  519. $hours = 0; $minutes = 0; $seconds = 0;
  520. $hours = floor($duration / 3600);
  521. $newruntime = $duration % 3600;
  522. $minutes = floor($newruntime / 60);
  523. $seconds = $duration % 60;
  524. echo("<td>$hours : $minutes : $seconds</td>");
  525. } else {
  526. printf("<td>%s</td>", $duration);
  527. }
  528. printf("<td>%s</td>", $description);
  529. # figure out if we have one or many platforms included in the runid
  530. # if there is only one (besides local), display it, otherwise print the number of platforms
  531. $query7 = "SELECT * FROM Task where runid=$runid";
  532. $db = mysql_connect(WEB_DB_HOST, DB_READER_USER, DB_READER_PASS) or die ("Could not connect : " . mysql_error());
  533. mysql_select_db(DB_NAME) or die("Could not select database");
  534. $result7 = mysql_query($query7) or die ("Query failed : " . mysql_error());
  535. $unique_plats = Array();
  536. while( $res7 = mysql_fetch_array($result7) ) {
  537. $unique_plats[] = trim( $res7["platform"] );
  538. }
  539. $unique_plats = array_unique( $unique_plats );
  540. # remove "local" and null from the list
  541. foreach($unique_plats as $key => $value) {
  542. if( $value == "" || $value == " " || is_null($value) || $value == "local" ) {
  543. unset( $unique_plats[$key] );
  544. } else {
  545. $myPlat = $value;
  546. }
  547. }
  548. if ( sizeof($unique_plats) > 1 ) {
  549. $tmp = sizeof($unique_plats);
  550. printf("<td><center>%s</center></td>", "$tmp");
  551. } else {
  552. printf("<td><center>%s</center></td>", "$myPlat");
  553. }
  554. foreach($unique_plats as $key => $value) {
  555. unset( $unique_plats[$key] );
  556. }
  557. if ( $archived == 1 ) {
  558. echo "<td bgcolor=#cdcdcd><center><a href=\"http://$local_hostname/$base\">Y</a></center></td>";
  559. printf("<td>%s</td>", $archived_until);
  560. } else {
  561. printf("<td><center>%s</center></td>", "N");
  562. printf("<td><center>%s</center></td>", "");
  563. }
  564. echo "</tr>";
  565. }
  566. echo "</table>";
  567. echo "</center>";
  568. mysql_free_result($result1);
  569. mysql_free_result($result2);
  570. mysql_free_result($result3);
  571. mysql_free_result($result4);
  572. mysql_free_result($result5);
  573. mysql_free_result($result6);
  574. mysql_close($db);
  575. ?>
  576. </body>
  577. </html>