php - IRC login with authentication send to NICKSERV if loggin try echo connected? -
here code
<html> <title></title> <body> <form method="get" > username: <input type="text" name="user"><br> password: <input type="password" name="pwd"><br> <input type="submit" value="submit"> </form> <?php //konfig $server = "xxxx"; $port = "xxxx"; $enable_password = true; //error error_reporting(0); if (isset($_get['user']) && isset($_get['pwd'])) { $username = $_get['user']; $password = $_get['pwd']; if (($username !== "") && ($password !== "")) { set_time_limit(30); if (!($socket = fsockopen($server, $port, $errno, $errstr, 10))) { echo "cant connect server"; flush(); } else { if ($enable_password) fputs($socket, "user " . $username . "\n"); fputs($socket, "pass " . $password . "\n"); //get $line $line = @fgets($socket, 1024); if (strstr($line, "authentication successful. login")) { echo "connected"; } else { echo "not connected"; } } } } ?> </body>
sock installed in php. try , output not connected while username , password true. required identify username password sending /msg nickserv identify [passwd]. idea how add command script ? , hope result of output correct while input username , password..
i found topic:
which has following function:
function sendcommand ($cmd) { global $server; //extends our $server array function @fwrite($server['socket'], $cmd, strlen($cmd)); //sends command server echo "[send] $cmd <br>"; //displays on screen }
so sending commands, shown i.e.:
sendcommand("pong :".substr($server['read_buffer'], 6)."\n\r");
it seems should follow schema fwrite($socket, $cmd, strlen($cmd));
Comments
Post a Comment