Jump to content

checking authentication login IRC via PHP


xymcrush17
Go to solution Solved by 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?

Link to comment
Share on other sites

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

Edited by xymcrush17
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.