egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Invitation/SAJOIN Script :)

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
honomsha
Voice


Joined: 09 Feb 2010
Posts: 1

PostPosted: Tue Feb 09, 2010 9:35 pm    Post subject: Invitation/SAJOIN Script :) Reply with quote

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
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Sat Feb 13, 2010 3:49 pm    Post subject: Reply with quote

some time ago i wrote something similar

eggdrop part (you can add some regexps in this proc, whatever):
Code:
# 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:
<?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
Quote:
[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
Back to top
View user's profile Send private message Visit poster's website
raider2k
Op


Joined: 01 Jan 2008
Posts: 140

PostPosted: Sun Oct 17, 2010 9:13 am    Post subject: Reply with quote

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 Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber