PasteSite.Com

Recent Pastes

Sign Up!

PasteSite is open to the public, but with limited features. Register to be able to modify access rights, track your pastes and more...

Change the theme

If you prefer reading light text on a dark background to dark text on a light background, then you might want to try the dark theme.

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
 
// -- Old --
public function main(){
    $this->check_connection();
    
    while( $this->data = fgets($this->socket, 512) ){
        $this->alive = time();
        echo $this->data;
        flush();
        
        $this->data  = str_replace( array("\r", "\n", "\r\n"), "", $this->data );
        $this->sdata = explode(" ", $this->data);
        
        // Check server responses
        switch( $this->sdata[1] ){
            case "PRIVMSG":
                // code for privmsg
                break;
            case "NOTICE":
                // code for notice
                break;
        }
    }
}
 
 
// -- New --
public function get_data(){
    while( $this->data = fgets( $this->socket, 512 ){
        $this->alive = time();
        echo $this->data;
        flush();
        
        $this->data  = str_replace( array("\r", "\n", "\r\n"), "", $this->data );
        $this->sdata = explode(" ", $this->data);
    }
}
public function main(){
    $this->check_connection();
    $this->get_data();
    
    //check server response
    switch( $this->sdata[1] ){
        case "PRIVMSG":
            // code for privmsg
            break;
        case "NOTICE":
            // code for notice
            break;
    }
}

Reply to This Paste

(leave blank to make this paste permanent)
(if set as private)