Posted to tcl by Klipsch at Tue Jul 24 17:07:24 GMT 2007view raw

  1. proc set:handler {nick uhost hand chan args} {
  2. global conf_trigger conf_prefix conf_fields conf_seperate conf_help_use conf_help_desc
  3.  
  4. set args [split [string trim $args "{,}"] " "]
  5. if { [llength $args] < 2 } {
  6. iprint error $chan "That's the incorrect syntax!"
  7. iprint info $chan "$conf_help_use(set)"
  8. iprint info $chan "$conf_help_desc(set)"
  9. iprint info $chan "Valid fields are: \002$conf_fields\002"
  10. return 0
  11. }
  12.  
  13. set tag [lindex $args 0]
  14. set field [lindex $args 1]
  15. set data [join [lrange $args 2 end]]
  16.  
  17. set db [sql_connect]
  18. if { [mysql::exec $db "UPDATE `sites` SET `$field`='[mysql::escape $db $data]' WHERE id='$tag' LIMIT 1"] > 0 } {
  19. iprint success $chan "Set field data for \002[string totitle $field]\002 to \"$data\"."
  20. } else {
  21. iprint error $chan "There was an error changing data for $tag!"
  22. }
  23. mysql::close $db
  24. }