This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Invitation/SAJOIN Script :)

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
h
honomsha
Voice
Posts: 1
Joined: Tue Feb 09, 2010 9:30 pm

Invitation/SAJOIN Script :)

Post by honomsha »

Hi everybody

What im looking for is probaly never coded (or published before).

I have my eggdrop running on my own irc network, linked to my website (php/mysql) so i want to make the irc channels invite only.

The thing i want is so the people registrered to my website go to /irc.php (etc.) and choose the channels they wanna get invited. Then when they have chosen, they click a link or button and my eggdrop bot invites them to the channel(s) they have chosen.

The channels they can chose has to be specified in mysql so i can code it in my site.

Is this even possible?

Thanks
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

some time ago i wrote something similar

eggdrop part (you can add some regexps in this proc, whatever):

Code: Select all

# Author: tomekk
# e-mail:  tomekk/@/oswiecim/./eu/./org
# home page: http://tomekk.oswiecim.eu.org/
#
# Version 0.2
#
# This file is Copyrighted under the GNU Public License.
# http://www.gnu.org/copyleft/gpl.html

set secret_key "blahblah"
set listen_port 1234
set listen_host 127.0.0.1

###########################################################################
bind evnt - prerehash prerehash_proc

set s_socket [socket -server socket_proc -myaddr $listen_host $listen_port]

proc prerehash_proc { type } {
	global s_socket

	close $s_socket
}

proc socket_proc { sock host port } {
        fconfigure $sock -buffering line
	fileevent $sock readable [list soc_action $sock $host $port]
}

proc hex2str { hex_value } {
	binary format H* $hex_value
}

proc soc_action { chan host port } {
	global secret_key

	if {![eof $chan]} {
		set soc_data [gets $chan]

		if {$soc_data != ""} {
			set separate_data [split [hex2str $soc_data] "\n"]
			set sock_secret_key [lindex $separate_data 0]
			set sock_nick [lindex $separate_data 1]
			set sock_channels [lindex $separate_data 2]

			if {$secret_key == $sock_secret_key} {
				foreach inv_channel [split $sock_channels] {
					putserv "INVITE $sock_nick $inv_channel"
				}
			} {
				close $chan
			}
		}
	} {
		close $chan
	}
}

putlog "www-invite.tcl ver 0.2 by tomekk loaded"
simple proc in PHP (its very simple you should write some flood protect etc in your proper PHP script)

Code: Select all

<?php
	function send_to_eggy( $nick, $channels  )
	{
		// secret key, eggdrop host/port
		$secret_key = 'blahblah';
		$eggy_ip = '127.0.0.1';
		$eggy_port = 1234;

		//////////////////////////////////////////////////////////////////////////////
		$tcp_str = $secret_key . "\n" . $nick . "\n" . $channels;
		$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
		socket_connect($sock, $eggy_ip, $eggy_port) or die ("can't connect to eggy!");
		socket_write($sock, bin2hex($tcp_str));	
		socket_close($sock);
	}

	send_to_eggy('tomekk', '#chan1 #chan2 #chan3');
?>
when you start eggdrop with this TCL script, you should see that the eggdrop is listening on some port
[tomekk@zlom]:/# netstat -tapn | grep 1234
tcp 0 0 127.0.0.1:1234 0.0.0.0:* LISTEN 25057/eggdrop
all you have to do is to write your PHP page with some HTML forms for users,

one more thing, those scripts are based on TCP sockets,
make sure that your firewall is not blocking ports etc

try it
r
raider2k
Op
Posts: 140
Joined: Tue Jan 01, 2008 10:42 am

Post by raider2k »

sorry that Im digging out this rather old threat, but I definately have to say thank you tomekk for both scripts, tested it, modified it, works like a charm :)
Post Reply