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.

IRC and MySQL help!!!!

Help for those learning Tcl or writing their own scripts.
Post Reply
A
Ace-T
Halfop
Posts: 82
Joined: Tue Aug 29, 2006 7:25 am

IRC and MySQL help!!!!

Post by Ace-T »

ok guys looking for some support here

i have a tcl code to update my mysqldb is a user joins or leaves irc...
i have mysqltcl in ok o i know what cant be the prob, its just it wont update the table in the sql.....

here is the code

Code: Select all

package require mysqltcl




set db_handle [mysqlconnect -host localhost -socket /var/lib/mysql/mysql.sock -user your db username -password your db pass -db you db name]


# main strings

bind pub "-|-" !user ircjoin

setudef flag testing


proc ircjoin { nick host handle channel text } {
global db_handle quote_noflags

if {![channel get $channel testing]} {
return 0
}

if [matchattr $handle $quote_noflags] { return 0 }

if {($handle == "") || ($handle == "*")} {
set handle $nick
}

set sql "UPDATE users SET onirc = 'yes' WHERE username ='$text'"
putloglev d * "ircstats: executing $sql"

set result [mysqlexec $db_handle $sql]
if {$result != 1} {
putlog "An error occurred with the sql :("
} else {
set id [mysqlinsertid $db_handle]
puthelp "PRIVMSG $channel :User Online \002$nick\002 added"
}
}
part 2

Code: Select all

# ---==( Channel Greet v1.1 )==-- by ArcAngeL -=o=- sysop@flexnet.org
# Version 1.0:
# - Website display and random info line for 2 chans
#
# Version 1.1:
# - added random part msg
#
#
##### CONFIGURATION ####

### Keep the channel names in lowercase !! if else it won't work !


##### Set the MAIN channel configuration #####

## Set the MAIN channel.
set channel1 "#"

## Set the channel website adress.
set www1 "http://www.xxxxxxxxx.org"

## Set date last update.
set update1 "never cause we're lazy"

### Set infolines for the MAIN channel
set info1 {
"You will recieve a point for every 15 minutes you spend in here."
}

## Do you want to display the website info on leave? (1-On/0-Off)
set siteinfo1 "1"

## The message diplayed when someone leaves.
set partmsg1 {
"Thanks for visiting, come again soon!"
"Leaving so soon ?"
"Hey, where do you think you are going ?"
}



##### Set the SECONDARY channel configuration #####

## Set the MAIN channel.
set channel2 "#"

## Set the channel website adress.
set www2 "http://www.xxxxxx.org"

## Set date last update.
set update2 "12 May 1999"

### Set infolines for the SECONDARY channel
set info2 {
"Dit is het eindpunt, u ken niet vedâh."
"Mocht u denkûh: Wat is dit ?, dit is nâh een i-er-zee kanaal"
"100% Haagse tjet, zeâh ongeschik voâh alle leifteidûh."
"Keik nâh, ein bezoekâh!"
"Mogt het nâh allemaal te ruig wordûh, druk dan alt+ef-vieâh"
"Het einigûh wat mein compjoetâh zeg is: Feetal error"
}

## Do you want to display the website info on leave? (1-On/0-Off)
set siteinfo2 "0"

## The message diplayed when someone leaves.
set partmsg2 {
"Kreigûh we nâh ? loopûh we weg ?!"
"Bedank dat je geweis ben !!"
"Massol!"
}


##### END OF CONFIGURATION #####





################################################################################
##################
## ##
## CODE STARTS HERE DON'T EDIT ANYTHING BELOW !! OR THE SCRIPT MIGHT NOT FUNCTION RIGHT!!! ##
## ##
################################################################################
##################


bind join - "$channel1 %" msg_jmsg1
bind part - "$channel1 %" msg_pmsg1

proc msg_pmsg1 {nick uhost hand channel args} {
global partmsg1 siteinfo1 www1 update1
if {$siteinfo1 == "0"} {
putserv "PRIVMSG # : [do_part1 $args]"
return 0
}
if {$siteinfo1 == "1"} {
putserv "PRIVMSG # : !useroff $nick"
putserv "PRIVMSG # : [do_part1 $args]"
return 0
}
}

proc do_part1 {nick} {
global partmsg1
set partoutput1 [lindex $partmsg1 [rand [llength $partmsg1]]]
return "$partoutput1"

}

proc msg_jmsg1 {nick uhost hand channel args} {
global www1 update1
putserv "PRIVMSG # :!user $nick"
putserv "PRIVMSG # :(iNFO): [do_random1 $args]"
return 0
}

proc do_random1 {nick} {
global info1
set output1 [lindex $info1 [rand [llength $info1]]]
return "$output1"

}


bind join - "$channel2 %" msg_jmsg2
bind part - "$channel2 %" msg_pmsg2

proc msg_pmsg2 {nick uhost hand channel args} {
global partmsg2 siteinfo2 www2 update2
if {$siteinfo2 == "0"} {
putserv "PRIVMSG $nick : [do_part2 $args]"
return 0
}
if {$siteinfo2 == "1"} {
putserv "PRIVMSG $nick : $www2 -updated!- $update2"
putserv "PRIVMSG $nick : [do_part2 $args]"
return 0
}
}

proc do_part1 {nick} {
global partmsg1
set partoutput1 [lindex $partmsg1 [rand [llength $partmsg1]]]
return "$partoutput1"

}

proc msg_jmsg2 {nick uhost hand channel args} {
global www2 update2
putserv "NOTICE $nick :(hTTP): $www2 -updated!- $update2"
putserv "NOTICE $nick :(iNFO): [do_random2 $args]"
}

proc do_random2 {nick} {
global info2
set output2 [lindex $info2 [rand [llength $info2]]]
return "$output2"

}


putlog "Channel Greet v1.1 By ArcAngeL.....Loaded!"
Post Reply