author | Dan |
Sun, 07 Dec 2008 01:55:03 -0500 | |
changeset 30 | 2cfcd2801e5a |
parent 29 | 300f673fbbdc |
permissions | -rw-r--r-- |
29
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
1 |
<?php |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
2 |
|
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
3 |
// auth if possible |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
4 |
if ( file_exists('./includes/common.php') ) |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
5 |
{ |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
6 |
require('includes/common.php'); |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
7 |
if ( !$session->user_logged_in ) |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
8 |
{ |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
9 |
// error out |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
10 |
$paths->main_page(); |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
11 |
die('Not authorized'); |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
12 |
} |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
13 |
$db->close(); |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
14 |
// unload Enano, we don't need it anymore |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
15 |
unset($db, $session, $paths, $template, $plugins); |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
16 |
} |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
17 |
|
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
18 |
function parse_wildcard($str) |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
19 |
{ |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
20 |
$append = isset($_POST['match_whole']) ? '' : '%'; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
21 |
return $append . mysql_real_escape_string(strtr(str_replace(array('%', '_'), array('\%', '\_'), $str), '*?', '%_')) . $append; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
22 |
} |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
23 |
|
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
24 |
function basenick($nick) |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
25 |
{ |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
26 |
if ( preg_match('/^`/', $nick) ) |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
27 |
{ |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
28 |
$nick = substr($nick, 1); |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
29 |
} |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
30 |
return preg_replace('/(`|\|)(.+?)$/', '', $nick); |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
31 |
} |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
32 |
|
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
33 |
function dbdie() |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
34 |
{ |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
35 |
die('MySQL query error: ' . mysql_error()); |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
36 |
} |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
37 |
|
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
38 |
function tableize_mysql_result($result) |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
39 |
{ |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
40 |
$col_strings = array( |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
41 |
'nick' => 'Nickname', |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
42 |
'basenick' => 'Basenick', |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
43 |
'ip' => 'IP', |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
44 |
'hostname' => 'Hostname', |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
45 |
'time' => 'Last join', |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
46 |
'channel' => 'Channel' |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
47 |
); |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
48 |
if ( mysql_num_rows($result) < 1 ) |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
49 |
{ |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
50 |
echo '<p>No results.</p>'; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
51 |
return true; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
52 |
} |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
53 |
$row = @mysql_fetch_assoc($result); |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
54 |
echo '<table border="1" cellpadding="3"><tr>'; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
55 |
foreach ( $row as $col => $_ ) |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
56 |
{ |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
57 |
echo "<th>{$col_strings[$col]}</th>"; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
58 |
} |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
59 |
echo '</tr>'; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
60 |
do |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
61 |
{ |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
62 |
echo "<tr>"; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
63 |
foreach ( $row as $col => $val ) |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
64 |
{ |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
65 |
if ( $col == 'nick' ) |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
66 |
echo "<td><a href=\"iplogs.php?query_user=" . urlencode($val) . "\">$val</a></td>"; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
67 |
else if ( $col == 'ip' ) |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
68 |
echo "<td><a href=\"iplogs.php?query_ip=" . urlencode($val) . "\">$val</a></td>"; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
69 |
else if ( $col == 'time' ) |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
70 |
echo "<td>" . date('r', intval($val)) . "</td>"; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
71 |
else |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
72 |
echo "<td>$val</td>"; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
73 |
} |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
74 |
echo "</tr>"; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
75 |
} |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
76 |
while ( $row = mysql_fetch_assoc($result) ); |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
77 |
echo '</table>'; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
78 |
return true; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
79 |
} |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
80 |
|
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
81 |
require('../../stats-fe.php'); |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
82 |
require('../../timezone.php'); |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
83 |
|
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
84 |
echo '<h2>' . $nick . ' IP logs</h2>'; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
85 |
|
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
86 |
if ( isset($_POST['submit']) ) |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
87 |
{ |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
88 |
$query = 'SELECT nick, basenick, ip, hostname, channel, time FROM ip_log'; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
89 |
$where = 'WHERE'; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
90 |
if ( !empty($_POST['nick']) ) |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
91 |
{ |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
92 |
$query .= " $where ( nick LIKE '" . parse_wildcard($_POST['nick']) . "'"; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
93 |
$query .= " OR basenick LIKE '" . parse_wildcard($_POST['nick']) . "' )"; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
94 |
$where = 'OR'; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
95 |
} |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
96 |
if ( !empty($_POST['ip']) ) |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
97 |
{ |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
98 |
$query .= " $where ip LIKE '" . parse_wildcard($_POST['ip']) . "'"; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
99 |
$where = 'OR'; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
100 |
} |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
101 |
if ( !empty($_POST['host']) ) |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
102 |
{ |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
103 |
$query .= " $where hostname LIKE '" . parse_wildcard($_POST['host']) . "'"; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
104 |
$where = 'OR'; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
105 |
} |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
106 |
if ( !empty($_POST['channel']) && $_POST['channel'] != '#' ) |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
107 |
{ |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
108 |
$query .= " $where channel LIKE '" . parse_wildcard($_POST['channel']) . "'"; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
109 |
$where = 'OR'; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
110 |
} |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
111 |
|
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
112 |
$query .= ';'; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
113 |
|
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
114 |
if ( $result = eb_mysql_query($query) ) |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
115 |
{ |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
116 |
$num_results = mysql_num_rows($result); |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
117 |
$str = ( $num_results == 1 ) ? "1 result" : "$num_results results"; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
118 |
tableize_mysql_result($result); |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
119 |
} |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
120 |
} |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
121 |
|
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
122 |
if ( isset($_GET['query_user']) ) |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
123 |
{ |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
124 |
$nick =& $_GET['query_user']; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
125 |
echo '<h3>' . htmlspecialchars($nick) . '</h3>'; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
126 |
echo '<p>Basenick: ' . htmlspecialchars(basenick($nick)) . '</p>'; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
127 |
|
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
128 |
echo '<h4>IP addresses this user has been seen from</h4>'; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
129 |
$nick = mysql_real_escape_string($nick); |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
130 |
$basenick = mysql_real_escape_string(basenick($nick)); |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
131 |
$q = eb_mysql_query("SELECT DISTINCT ip, hostname FROM ip_log WHERE nick = '$nick' OR basenick = '$basenick';"); |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
132 |
if ( !$q ) |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
133 |
dbdie(); |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
134 |
tableize_mysql_result($q); |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
135 |
|
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
136 |
echo '<h4>Channels this user has been seen in</h4>'; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
137 |
$q = eb_mysql_query("SELECT DISTINCT nick, channel, time FROM ip_log WHERE nick = '$nick' OR basenick = '$basenick';"); |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
138 |
if ( !$q ) |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
139 |
dbdie(); |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
140 |
tableize_mysql_result($q); |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
141 |
} |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
142 |
|
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
143 |
if ( isset($_GET['query_ip']) ) |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
144 |
{ |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
145 |
$ip =& $_GET['query_ip']; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
146 |
echo '<h3>' . htmlspecialchars($ip) . '</h3>'; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
147 |
$ip = mysql_real_escape_string($ip); |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
148 |
|
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
149 |
echo '<h4>Users seen from this IP address</h4>'; |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
150 |
$q = eb_mysql_query("SELECT DISTINCT nick, channel, time FROM ip_log WHERE ip = '$ip';"); |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
151 |
if ( !$q ) |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
152 |
dbdie(); |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
153 |
tableize_mysql_result($q); |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
154 |
} |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
155 |
|
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
156 |
// FORM |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
157 |
?> |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
158 |
<form action="iplogs.php" method="post"> |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
159 |
<h3>Search database</h3> |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
160 |
<p><small>Enter data in one or more fields. You can use an asterisk (*) anywhere to match multiple characters or a question mark (?) to match a single character.</small></p> |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
161 |
<table border="0"> |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
162 |
<tr> |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
163 |
<td>Nickname</td> |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
164 |
<td><input type="text" name="nick" size="30" /></td> |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
165 |
</tr> |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
166 |
<tr> |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
167 |
<td>IP address</td> |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
168 |
<td><input type="text" name="ip" size="30" /></td> |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
169 |
</tr> |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
170 |
<tr> |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
171 |
<td>Hostname</td> |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
172 |
<td><input type="text" name="host" size="30" /></td> |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
173 |
</tr> |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
174 |
<tr> |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
175 |
<td>Channel</td> |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
176 |
<td><input type="host" name="channel" size="30" value="#" /></td> |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
177 |
</tr> |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
178 |
<tr> |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
179 |
<td colspan="2"> |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
180 |
<label><input type="checkbox" name="match_whole" /> Exact matches</label> |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
181 |
</td> |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
182 |
</tr> |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
183 |
<tr> |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
184 |
<td colspan="2" style="text-align: center;"> |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
185 |
<input type="submit" name="submit" /> |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
186 |
</td> |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
187 |
</tr> |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
188 |
</table> |
300f673fbbdc
Added web interface for IP logger module; set display_errors to on in PHP
Dan
parents:
diff
changeset
|
189 |
</form> |