root/dev/common/kill_export_search.php @ 35

Revision 35, 2.1 KB (checked in by beansman, 14 years ago)
  • Added the admin menu to pages ;)
Line 
1<?
2
3  /*
4   * Export killmails, uses the searchroutine to find them.
5   * Currently only supports users,
6   * but will be made to support corps and alliances
7   */
8 
9
10  require_once( "class.page.php" );
11  require_once( "db.php" );
12  require_once( "globals.php" );
13  require_once( "admin_menu.php" );
14
15  $page = new Page( "Administration - Export searcher" );
16  $page->setAdmin();   
17
18  $html .= "<form id=search action=\"?a=kill_export_search\" method=post>";
19  $html .= "<table class=kb-subtable><tr>";
20  $html .= "<td>Type:</td><td>Text: (3 letters minimum)</td>";
21  $html .= "</tr><tr>";
22  $html .= "<td><input id=searchphrase name=searchphrase type=text size=30/></td>";
23  $html .= "<td><input type=submit name=submit value=Search></td>";
24  $html .= "</tr></table>"; 
25  $html .= "</form>";
26 
27  if ( $_POST['searchphrase'] != "" && strlen( $_POST['searchphrase'] ) >= 3 ) {
28    $sql = "select plt.plt_id, plt.plt_name, crp.crp_name
29                  from kb3_pilots plt, kb3_corps crp
30                 where lower( plt.plt_name ) like lower( '%".slashfix( $_POST['searchphrase'] )."%' )
31                   and plt.plt_crp_id = crp.crp_id
32                 order by plt.plt_name";
33    $header = "<td>Pilot</td><td>Corporation</td>";   
34    $qry = new DBQuery();
35    if ( !$qry->execute( $sql ) )
36      die ( $qry->getErrorMsg() );
37
38    $html .= "<div class=block-header>Search results</div>";
39   
40    if ( $qry->recordCount() > 0 ) {
41      $html .= "<table class=kb-table width=450 cellspacing=1>";
42      $html .= "<tr class=kb-table-header>".$header."</tr>";
43    }
44    else
45      $html .= "No results.";
46     
47    while ( $row = $qry->getRow() )
48    {
49      $html .= "<tr class=kb-table-row-even>";
50      $html .= "<td><a href=\"?a=kill_export_csv&plt_id=".$row['plt_id']."\">".$row['plt_name']."</a></td><td>".$row['crp_name']."</td>";
51      $html .= "</tr>";
52    }
53    if ( $qry->recordCount() > 0 )
54      $html .= "</table>";
55  } 
56
57  $page->setContent( $html );
58  $page->addContext( $menubox->generate() );
59  $page->generate();
60?>
61
Note: See TracBrowser for help on using the browser.