Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. #########################################################
  2. # !rdel <string> #
  3. #########################################################
  4.  
  5. proc rdel {nick uhost hand chan arg} {
  6. putlog "AaA"
  7. if {[channel get $chan db]} {
  8. global mysql db
  9.  
  10. set r_string [lindex [split $arg] 0]
  11.  
  12. if {[catch {
  13. set mysql(handle) [::mysql::connect -host $mysql(host) -user $mysql(user) -password $mysql(password) -port $mysql(port) -db $mysql(db)]
  14. set query1 [::mysql::sel $mysql(handle) "SELECT $db(rm_string),$db(rm_nick) FROM $mysql(rdb) WHERE $db(rm_nick) = '$nick'" -flatlist]
  15. mysqlclose $mysql(handle) } err]} { mysqlclose $mysql(handle)
  16. putlog $err }
  17.  
  18. if {[string equal $query1 ""] == 1} {
  19. echo $chan "(\00310 RDEL \003) \00310~\003 String not found in DB"
  20. return 0
  21. }
  22.  
  23. if {[string equal [lindex $query1 1] $nick ] == 1}{
  24. echo $chan "(\00310 RDEL \003) \00310~\003 Permission denied"
  25. return 0
  26. }
  27.  
  28. if {[catch {
  29. set mysql(handle) [::mysql::connect -host $mysql(host) -user $mysql(user) -password $mysql(password) -port $mysql(port) -db $mysql(db)]
  30. set query1 [::mysql::exec $mysql(handle) "DELETE FROM $mysql(rdb) WHERE $db(rm_string) = '$r_string'" -flatlist]
  31. mysqlclose $mysql(handle) } err]} { mysqlclose $mysql(handle)
  32. putlog $err }
  33.  
  34. echo $chan "(\00310 RDEL \003) \00310~\003 Successfully deleted $r_string from my RemindDB"
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement