Code: Select all
#Adding Routine
proc add:pub {nick uhost handle channel arg} {
	global mysql net
	set arg [rls:filter $arg]
	set table $mysql(release_table)
	set sql(conn) [mysqlconnect -host $mysql(host) -user $mysql(user) -password $mysql(pass)]
	mysqluse $sql(conn) $mysql(data)
	mysqlexec $sql(conn) "INSERT INTO '$table' ( 'id' , 'release_data' , 'release_date' ) VALUES ( '', $arg' , NOW( ))"
	mysqlclose $sql(conn)
	pustserv "NOTICE $nick :Release has been added"
	putcmdlog "<<$nick>> !$handle! Added a new Release to the database."
}
#Deleting Routine
bind pub - !del del:pub
proc del:pub {nick uhost handle channel arg} {
	global mysql net
	set table $mysql(release_table)
	set id ""
	set sql(conn) [mysqlconnect -host $mysql(host) -user $mysql(user) -password $mysql(pass)]
	mysqluse $sql(conn) $mysq(data)
	if {[string is integer $arg]} {
		set id [lindex [lindex [mysqlsel $sql(conn) "SELECT * FROM `$table` ORDER BY id ASC LIMIT [expr $arg -1],1;" -list] 0] 0]
		} elseif {[lindex $arg 0] == "-id" && [string is integer [lindex $arg 1]]} {
			set id [lindex $arg 1]
		}
		if {$id != ""} { set result [mysqlexec $sql(conn) "DELETE FROM `$table` WHERE `id` = '$id'"] }
		mysqlclose $sql(conn)
		if {$result != 0} {
			putserv "PRIVMSG $channel :Release has been deleted"
			putcmdlog "<<$nick>> !$handle! Deleted a Release in $channel."
		} else {putserv "PRIVMSG $channel :No such Release in database"}
	}Code: Select all
proc rls_show {nick uhost hand chan arg} {
	global mysql net
	set sql(conn) [mysqlconnect -host $mysql(host) -user $mysql(user) -password $mysql(pass)]
	mysqluse $sql(conn)
	mysqlsel $mysql(data) "SELECT id, release_data, release_date FROM $mysql(table)" -list
	putserv "PRIVMSG $nick :The Following is the 10 Newest Releases by \002blah\002"
	putserv "PRIVMSG $nick :Title:$release_data Date:$release_date"
	putserv "PRIVMSG $nick :TO search for more releases use !new #, or !new all"