-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsebbo.php
52 lines (49 loc) · 1.34 KB
/
sebbo.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
function dcc_chat($nickd,$portdcc) {
global $oServer,$sMasterServer;
//$time=time();
$errno='';$errstr='';
$socket = stream_socket_server("tcp://0.0.0.0:".$portdcc, $errno, $errstr);
if (!$socket) {
echo "$errstr ($errno)<br />\n";
}
else {
$ip2long=sprintf('%u',ip2long(get_ip()));
stream_set_blocking($socket,0);//0 non bloquant 1 bloquant
//var_dump($portdcc);
//$portdcc=ntohs($portdcc);
$data="PRIVMSG $nickd :\001DCC CHAT CHAT ".$ip2long." ".$portdcc."\001\r\n";
//if($sMasterServer=='epiknet.net') $chan='#2037.org'; else
if($sMasterServer=='yumeru.net') $chan='#test_bot';
else $chan='#sebbu';
fwrite($oServer->rSocket,$data);
fwrite($oServer->rSocket,'PRIVMSG '.$chan.' :'.$data);
print('<br/><br/>'."\r\n");var_dump($data);print('<br/><br/>'."\r\n");
$timeout = 90;
$QUIT = FALSE;
$array = array($socket);
while(!$QUIT)
{
if(stream_select($array, $w=NULL, $e=NULL, $timeout) > 0)
{
if(($conn = stream_socket_accept($socket)) != FALSE)
{
$QUIT = TRUE;
}
}
else $QUIT = TRUE;
}
fclose($socket);
if(is_resource($conn))
{
echo 'ACCEPTING DONE !<br>'."\r\n";
stream_set_write_buffer($conn,0);
fputs($conn, 'J\'ai bien accepté le dcc chat.'."\r\n");
//fclose($conn);
}
}
$GLOBALS['fp'][$GLOBALS['dcc-chat']]=$conn;
$GLOBALS['data'][$GLOBALS['dcc-chat']]='';
$GLOBALS['dcc-chat']++;
}
?>