- Home»
- Cod sursa: topic.sql.tcl
topic.sql.tcl
topic.sql.tcl
TCL snippet that saves the current topic into the sql database. First, create in phpmyadmin the table, using the sql query provided in the code. Due to the fact that this snippet is old, you might update the query to a new version of phpmyadmin.
| Postat de | Copyright | Categorie | Review user | Vizualizari | Data |
|---|---|---|---|---|---|
| btc | necunoscut | chanops | Cod testat | 405 | 2023-12-25 12:28:20 |
# Set this to the default password to assign to the added user
# record.
# First, create the SQL table
# CREATE TABLE irc_topics (
# id mediumint(9) NOT NULL auto_increment,
# topic text NOT NULL,
# nick varchar(50) NOT NULL default '',
# chan varchar(50) NOT NULL default '',
# data_laikas datetime NOT NULL default '0000-00-00 00:00:00',
# PRIMARY KEY (id)
# ) TYPE=MyISAM;
set _mysql_host "localhost"
set _mysql_port "3306"
set _mysql_user "username"
set _mysql_pass "password"
set _mysql_db "databasename"
#Bind
bind topc - * catch_topic
## sql-tcl packagae
package require sql
proc catch_topic {nick uhost hand chan topic} {
global botnick _mysql_host _mysql_port _mysql_user _mysql_pass _mysql_db url
if {$chan == "#ginklai"} then {
set conn [sql connect $_mysql_host $_mysql_user $_mysql_pass]
set res [catch {sql selectdb $conn $_mysql_db} msg]
if {$res != 0} {
putlog "could not connect... :$msg"
}
sql exec $conn "insert into irc_topics values (NULL, '$topic', '$nick', '$chan', NOW())"
putlog "New topic: $topic"
sql disconnect $conn
}
}
putlog "Script loaded: Catch_topics"
IRC Snippets