while(1) { // Continue the rest of the script here while($data = fgets($socket, 128)) { echo nl2br($data); flush(); // Separate all data $ex = explode(' ', $data); $count = count($ex); $namr = explode('!', $data); $namer = $namr[0]; $name = substr( trim($namer), 1); // Send PONG back to the server if($ex[0] == "PING"){ fputs($socket, "PONG ".$ex[1]."\n"); } if ($name == "GenX-Echo" or $name == "GenX-Acho" or strtolower($name) == "brandon"){ echo $name; if($ex[3] == ":***" && $ex[7] == "banned"){ $slice = implode('', array_slice($ex, 10)); $output = $ex[5]." ".$ex[9]." ".$slice; //admin player reason $handleo = fopen("bans.txt", 'r+'); fwrite($handleo, $output."\n"); fclose($handleo); } } $command = str_replace(array(chr(10), chr(13)), '', $ex[3]); if ($command == ":!isbanned") { $nombre = strtolower($ex[4]); if ($nombre == "") { fputs($socket, "PRIVMSG ".$ex[2]." :Error: No Name Was Identified\n"); } $handlei = fopen("bans.txt", "r+"); $i = 0; while(!feof($handlei) && $i <= 5){ $lines = fgets($handle, 4096); $ln = explode(' ', $lines); if (trim($nombre) == strtolower($ln[1])){ $match = true; $admin = $ln[0]; $reason = implode('', array_slice($ln, 2)); $output = $ln[1]." was banned by ".$admin." for ".$reason; fputs($socket, "PRIVMSG ".$channel." :".$output."\n"); $i++; } } if ($match == false) { fputs($socket, "PRIVMSG ".$channel." :No Matches Found\n"); } $match = false; fclose($handlei); } if ($command == ":!lastban") { $nombre = strtolower($ex[4]); if ($nombre == "") { fputs($socket, "PRIVMSG ".$ex[2]." :Error: No Name Was Identified\n"); } $handle = fopen("bans.txt", "r+"); if(feof($handle)){ $lines = fgets($handle, 4096); $ln = explode(' ', $lines); $match = true; $admin = $ln[0]; $reason = implode('', array_slice($ln, 2)); $output = "Last Ban:".$ln[1]." was banned by ".$admin." for ".$reason; fputs($socket, "PRIVMSG ".$channel." :".$output."\n"); } if ($match == false) { fputs($socket, "PRIVMSG ".$channel." :No Matches Found\n"); } $match = false; fclose($handle); } } }