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 | |
---|
14 | $page = new Page( "Administration - Export searcher" ); |
---|
15 | $page->setAdmin(); |
---|
16 | |
---|
17 | $html .= "<form id=search action=\"?a=kill_export_search\" method=post>"; |
---|
18 | $html .= "<table class=kb-subtable><tr>"; |
---|
19 | $html .= "<td>Type:</td><td>Text: (3 letters minimum)</td>"; |
---|
20 | $html .= "</tr><tr>"; |
---|
21 | $html .= "<td><input id=searchphrase name=searchphrase type=text size=30/></td>"; |
---|
22 | $html .= "<td><input type=submit name=submit value=Search></td>"; |
---|
23 | $html .= "</tr></table>"; |
---|
24 | $html .= "</form>"; |
---|
25 | |
---|
26 | if ( $_POST['searchphrase'] != "" && strlen( $_POST['searchphrase'] ) >= 3 ) { |
---|
27 | $sql = "select plt.plt_id, plt.plt_name, crp.crp_name |
---|
28 | from kb3_pilots plt, kb3_corps crp |
---|
29 | where lower( plt.plt_name ) like lower( '%".slashfix( $_POST['searchphrase'] )."%' ) |
---|
30 | and plt.plt_crp_id = crp.crp_id |
---|
31 | order by plt.plt_name"; |
---|
32 | $header = "<td>Pilot</td><td>Corporation</td>"; |
---|
33 | $qry = new DBQuery(); |
---|
34 | if ( !$qry->execute( $sql ) ) |
---|
35 | die ( $qry->getErrorMsg() ); |
---|
36 | |
---|
37 | $html .= "<div class=block-header>Search results</div>"; |
---|
38 | |
---|
39 | if ( $qry->recordCount() > 0 ) { |
---|
40 | $html .= "<table class=kb-table width=450 cellspacing=1>"; |
---|
41 | $html .= "<tr class=kb-table-header>".$header."</tr>"; |
---|
42 | } |
---|
43 | else |
---|
44 | $html .= "No results."; |
---|
45 | |
---|
46 | while ( $row = $qry->getRow() ) |
---|
47 | { |
---|
48 | $html .= "<tr class=kb-table-row-even>"; |
---|
49 | $html .= "<td><a href=\"?a=kill_export_csv&plt_id=".$row['plt_id']."\">".$row['plt_name']."</a></td><td>".$row['crp_name']."</td>"; |
---|
50 | $html .= "</tr>"; |
---|
51 | } |
---|
52 | if ( $qry->recordCount() > 0 ) |
---|
53 | $html .= "</table>"; |
---|
54 | } |
---|
55 | |
---|
56 | $page->setContent( $html ); |
---|
57 | $page->generate(); |
---|
58 | ?> |
---|
59 | |
---|