]>
jfr.im git - irc/thales.git/blob - examples/clones/clones.php
2 /* Clones detection script
3 * Copyright (C) 2002 Jens 'DukePyrolator' Voss <DukePyrolator@wiredirc.net>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 /* ============================================================================
21 * clone-detecting-script www (powered by Thales)
24 * Author: Jens 'DukePyrolator' Voss | DukePyrolator@wiredirc.de
26 * Input: mySQL data from Thales tables
27 * Output: all clones on chan (a la mIRC)
28 * Usage: htp://.../clones.php?chan=mychan (without the leading '#')
30 * ===========================================================================
35 $start = doubleval(time() +
microtime());
38 function safe_mysql_pconnect()
41 $db_host = "localhost";
43 $db_pass = "mysecretpass";
46 $mysql_link = mysql_connect($db_host, $db_user, $db_pass) or die("Can't connect to mysql");
47 mysql_select_db($db_name);
51 $mysql_link = safe_mysql_pconnect();
59 $clones = mysql_query("SELECT nick
, hostname
61 WHERE channel
=\"$chan\" and ison
.chanid
=chan
.chanid
and user
.nickid
=ison
.nickid
");
67 while ($clones_f = mysql_fetch_row ($clones)) {
68 $u_nick[$i] = $clones_f[0];
69 $u_host[$i] = $clones_f[1];
76 for ($i=1;$i<$groesse;$i++) {
78 for ($j=1;$j<$groesse;$j++) {
79 if (($u_host[$i] == $u_host[$j]) AND !($i == $j) AND ($u_found[$i]==0)){
84 echo " ", $u_nick[$j];
97 echo " ", round(((time() + microtime())-$start),6), " Sek
";
100 mysql_close($mysql_link);