Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $address = "0.0.0.0";
- $port = "9999";
- $servername = "fake.irc.server";
- /* create a socket in the AF_INET family, using SOCK_STREAM for TCP connection */
- $mysock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
- socket_bind($mysock, $address, $port);
- socket_listen($mysock, 5);
- while(true) {
- $client = socket_accept($mysock);
- // Say Looking up hostname
- $output = $servername . "NOTICE Auth :Please wait while we process your connection...";
- socket_write($client, $output);
- // Read the input from the client
- $input = socket_read($client, 1024);
- $output = $servername . "NOTICE Auth :Thank you for being tricked into connecting to this server! Your nick is:" . $input;
- // Display output back to client
- socket_write($client, $output);
- // CLOSE CONNECTION AND LOOP
- socket_close($client);
- }
- ?>
Add Comment
Please, Sign In to add comment