Register Nick From web portal

Talk about pretty much anything here, but DO NOT USE FOR SUPPORT.

Moderator: Supporters

Number
Posts: 65
Joined: Thu Mar 03, 2005 6:44 pm

Register Nick From web portal

Post by Number »

I'm sorry but i can't use Awesome ...

I'm read and change the config file.. Whit localhost for ip of the server
But when i'm logon i didn't say anything ...


I would like to register nick from a web portal and I can use php ..
I use socket but i can't how to use it ....

Someone have a example please ??
I woul like to do this alone .. but i need help..
Number
Posts: 65
Joined: Thu Mar 03, 2005 6:44 pm

Post by Number »

I'm come back home...
And this is my code :

Code: Select all

<?php

$ip = "localhost";
$port = "6667";
$nickname = "Number_?";
$channel = "#Bienvenue";

$fp = fsockopen("$ip", $port, $errno, $errstr);


$fget = fgets($fp);

echo "$fget <br />";


$fputs = fputs($fp, "USER 'TEST' 'TEST'@'localhost' :TEST");

$fgets = fgets($fp);

echo "$fgets <br />";


$fput = fputs($fp,"NICK TEST");

$fg = fgets($fp);

echo "$fg <br />";

?>
But the only response i have is that :
:irc.number.no-ip.org NOTICE AUTH :*** Looking up your hostname...
:irc.number.no-ip.org NOTICE AUTH :*** Found your hostname
What can i do ? to be logon and have the motd whit socket in php ??

Thanks a lot
w00t
Posts: 1136
Joined: Thu Mar 25, 2004 3:31 am
Location: Nowra, Australia

Post by w00t »

Ugh. Try introducing at least a general loop checking the eof state of the socket.

You'll also need to handle IRC commands such as PING, etc etc etc etc.

Hint: Research the following PHP stuff: while loops, feof, fclose.
-ChatSpike IRC Network [http://www.chatspike.net]
-Denora Stats [http://denora.nomadirc.net]
-Omerta [http://www.barafranca.com]
Number
Posts: 65
Joined: Thu Mar 03, 2005 6:44 pm

Post by Number »

Thanks ... Now it run ...
But i have a another problem...

See this :
connect to localhost...
Ident...
:irc.number.no-ip.org NOTICE AUTH :*** Looking up your hostname...
:irc.number.no-ip.org NOTICE AUTH :*** Found your hostname
:irc.number.no-ip.org NOTICE Test :*** If you are having problems connecting due to ping timeouts, please type /quote pong 70EFC0C3 or /raw pong 70EFC0C3 now.
PING :70EFC0C3
PONG !
:irc.number.no-ip.org 451 STATS :You have not registered
ERROR :Closing Link: Test[127.0.0.1] (Ping timeout)
What does it mean : "451 STATS: You have not registered"

I don't need to be register to do /STATS u...

Why ???

Code: Select all

$fp=fsockopen("$serv","6667");

fputs($fp, "USER Test localhost localhost :register\r\n");
fputs($fp,"NICK Test\r\n");

sleep(1);

fputs($fp,"STATS u\r\n");   
     
            while ($line = fgets($fp,1024)) {

                $a = explode(" ", $line);

		echo "$line <br />";

                if ($a[0] == "PING") {

                    fputs($sock, "PONG $a[1]");
			echo "PONG ! <br />";
                }
		}
Thanks for your help w00t
w00t
Posts: 1136
Joined: Thu Mar 25, 2004 3:31 am
Location: Nowra, Australia

Post by w00t »

Try waiting for an "001" response in a[1] and sending the STATS request then.
-ChatSpike IRC Network [http://www.chatspike.net]
-Denora Stats [http://denora.nomadirc.net]
-Omerta [http://www.barafranca.com]
Number
Posts: 65
Joined: Thu Mar 03, 2005 6:44 pm

Post by Number »

But ...
On each fgets from a socket i'm print the result...

Thus i don't have anithing whit 00 .. ?
I can use sleep(5); for wait a response ..

i'm right ??
w00t
Posts: 1136
Joined: Thu Mar 25, 2004 3:31 am
Location: Nowra, Australia

Post by w00t »

fputs($sock, "PONG $a[1]");

echo that back EXACTLY so we cna see what you're sending.
-ChatSpike IRC Network [http://www.chatspike.net]
-Denora Stats [http://denora.nomadirc.net]
-Omerta [http://www.barafranca.com]
Number
Posts: 65
Joined: Thu Mar 03, 2005 6:44 pm

Post by Number »

i Know that ...

Echo Print what the server send by the socket ...
And for each thing the web page receive i use echo to see it ...

If i receive PING - 1234567
I send (now ) PONG- 1234567

But i have this :
=>USER Test localhost localhost :register
=>NICK Test
<= :irc.number.no-ip.org NOTICE AUTH :*** Looking up your hostname...
<= :irc.number.no-ip.org NOTICE AUTH :*** Found your hostname
<= :irc.number.no-ip.org NOTICE Test :*** If you are having problems connecting due to ping timeouts, please type /quote pong 6D4CBA32 or /raw pong 6D4CBA32 now.
<= PING :6D4CBA32
=> PONG :6D4CBA32
<= :irc.number.no-ip.org 451 STATS :You have not registered
<= ERROR :Closing Link: Test[127.0.0.1] (Ping timeout)
In php :

I send USER
I Send NICK
I wait 10 ''
I Respond to PONG if server send PING ..
And I Send STATS ...
codemastr
Former UnrealIRCd head coder
Posts: 811
Joined: Sat Mar 06, 2004 8:47 pm
Location: United States
Contact:

Post by codemastr »

Doesn't PHP come with a basic set of IRC functions? http://docs.php.net/en/ref.ircg.html
-- codemastr
w00t
Posts: 1136
Joined: Thu Mar 25, 2004 3:31 am
Location: Nowra, Australia

Post by w00t »

Don't wait that 10 seconds. You might be missing something, and you dont need to wait. The loop will only finish if the socket gets closed (so you'll want to send a QUIT after you recieve RPL_ENDOFSTATS or whatever
-ChatSpike IRC Network [http://www.chatspike.net]
-Denora Stats [http://denora.nomadirc.net]
-Omerta [http://www.barafranca.com]
Number
Posts: 65
Joined: Thu Mar 03, 2005 6:44 pm

Post by Number »

codemastr wrote:Doesn't PHP come with a basic set of IRC functions? http://docs.php.net/en/ref.ircg.html
It's not with php ..
You can't compile php with ircg ..
You need to install it after ...

I don't want to use ircg because my website must to be "portabl" ..

w00t ..
I deleted the "sleep(10)" but i have the same ...
You can test whit me ?? please ...
w00t
Posts: 1136
Joined: Thu Mar 25, 2004 3:31 am
Location: Nowra, Australia

Post by w00t »

codemastr, the ircg library also gave me quite a few headaches when i tried it :p (php/apache crashes, etc)

Number: Not today sorry. it's 3:45am, and i'm having trouble just typing. :)
-ChatSpike IRC Network [http://www.chatspike.net]
-Denora Stats [http://denora.nomadirc.net]
-Omerta [http://www.barafranca.com]
Number
Posts: 65
Joined: Thu Mar 03, 2005 6:44 pm

Post by Number »

Thanks w00t i'm patient ...

Thanks for your help .. And i wait a response from you to continue ..
While this response i'm continue to test ..

Thanks a lot ...
Matridom
Posts: 296
Joined: Fri Jan 07, 2005 3:28 am

Post by Matridom »

codemastr wrote:Doesn't PHP come with a basic set of IRC functions? http://docs.php.net/en/ref.ircg.html
Wow, Thanx codemastr, and i was using fsockets the entire time for some web based stuff to IRC.. Time to do some reading.
Number
Posts: 65
Joined: Thu Mar 03, 2005 6:44 pm

Post by Number »

w00z Your are ready for the socket adventure today ??
Locked