Jump to content

checking authentication login IRC via PHP


xymcrush17

Recommended Posts

Hi everyone

I need help how to check the authentication by sending username and password form to IRC

<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

        $server = "XXXX";
        $port = "XXXX";
        $enable_password = true;

        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"); // here where i want to get output if 
the username and password that i input in form is connected,it will be printed "connected" and else is
 "not connected".. and i have try be add code in the next line below .
 
                //get $line
                $line = @fgets($socket, 1024);
                if (strstr($line, "Authentication successful. You are now Login")) {
                    echo "Connected";
                } else {
                    echo "Not Connected";
                }
            }
        }
    }
    ?>
</body>

but its not work..while i put correct user and password its still not connected.

any suggest?

I just keep trying to get this work's

at lease it works's

 <form method="get" >
        Username: <input type="text" name="user"><br>
        Password: <input type="password" name="pwd"><br>
        <input type="submit" value="Submit">
 </form>
 <?php
if (isset($_GET['user']) && isset($_GET['pwd'])) {
    $nick     = $_GET['user'];       

    $server   = "";

    $port     = "";

	$nickpass = $_GET['pwd'];

    
    $s = fsockopen( $server , $port, $errno, $errstr, 10 );
	
	fputs( $s, "NICK $nick\n" ); 
	fputs( $s, "NICK $nick\n" ); 
    fputs( $s, "NICK $nick\n" ); 
	fputs( $s, "PASS $nickpass\n" ); 
    fputs( $s, "USER $nick $nick $nick $nick :$nick\n" );
    
    while ($data = fgets( $s, 768 )) { 

    flush(); 

    $info = split( " ", $data );

        
	//parsing data auth
        
        if ( strstr( $data, "Authentication failed." )) {

          echo "<pre>Not Connected</pre>";

        }
	if ( strstr( $data, "Authentication successful. You are now logged in." )) {

          echo "<pre>Connected</pre>";

        }
    
	}
}
?> 

but its so long loading to connect to server..

would anybody help me how to make fast connect?

thanks

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.