Ban Script

From S23Wiki
Jump to: navigation, search
set file /usr/local/lib/mysqltcl-2.40/libmysqltcl2.40
load ${file}[info sharedlibextension]

bind pub - !wikiban wikiban 
# please add FLAG and variables passed

proc wikiban {nick host hand chan args} {
set db [mysqlconnect -host localhost -user wikiuser -password $PASSWORD -db wikidb]
mysqlsel $db {INSERT INTO `ipblocks` (ipb_address,ipb_by,ipb_reason,ipb_timestamp,ipb_expiry) VALUES ('$IP',$IRC_USER_ID,'$REASON','$CURRENT_TIME','$EXPIRY_TIME');}

# $IP and $REASON should be arguments from IRC user ,after trigger
# $IRC_USER_ID can be hardcoded, lets just setup a user for that
# $CURRENT_TIME needs to be created by this script 
# $EXPIRY_TIME needs to be calculated by this script $CURRENT_TIME+23 days or also supplied as argument
# DATE FORMAT in Mediawiki is like YYYYMMDDHHMMSS (20051003141052)

putquick "privmsg $chan :Ok, placed ban on $IP expiring at $EXPIRY_TIME_HUMAN_READABLE)"
# We need $EXPIRY_TIME in human readable form here to pass back to channel

mysqlclose $db
}

This page is still under construction.