Posted to tcl by Klipsch at Tue Jul 24 17:07:24 GMT 2007view raw
- proc set:handler {nick uhost hand chan args} {
- global conf_trigger conf_prefix conf_fields conf_seperate conf_help_use conf_help_desc
- set args [split [string trim $args "{,}"] " "]
- if { [llength $args] < 2 } {
- iprint error $chan "That's the incorrect syntax!"
- iprint info $chan "$conf_help_use(set)"
- iprint info $chan "$conf_help_desc(set)"
- iprint info $chan "Valid fields are: \002$conf_fields\002"
- return 0
- }
- set tag [lindex $args 0]
- set field [lindex $args 1]
- set data [join [lrange $args 2 end]]
- set db [sql_connect]
- if { [mysql::exec $db "UPDATE `sites` SET `$field`='[mysql::escape $db $data]' WHERE id='$tag' LIMIT 1"] > 0 } {
- iprint success $chan "Set field data for \002[string totitle $field]\002 to \"$data\"."
- } else {
- iprint error $chan "There was an error changing data for $tag!"
- }
- mysql::close $db
- }