mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2025-12-27 10:41:42 +00:00
git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3917 316c924e-a436-60f5-8080-3fe189b3f50e
76 lines
2.0 KiB
Plaintext
76 lines
2.0 KiB
Plaintext
|
|
obj/admins/proc/DB_ban_record(var/bantype, var/mob/banned_mob, var/duration = -1, var/reason, var/job = "", var/rounds = 0)
|
|
var/user = sqlfdbklogin
|
|
var/pass = sqlfdbkpass
|
|
var/db = sqlfdbkdb
|
|
var/address = sqladdress
|
|
var/port = sqlport
|
|
|
|
var/DBConnection/dbcon = new()
|
|
|
|
dbcon.Connect("dbi:mysql:[db]:[address]:[port]","[user]","[pass]")
|
|
if(!dbcon.IsConnected())
|
|
return
|
|
|
|
var/serverip = "[world.internet_address]:[world.port]"
|
|
var/bantype_pass = 0
|
|
var/bantype_str
|
|
switch(bantype)
|
|
if(BANTYPE_PERMA)
|
|
bantype_str = "PERMABAN"
|
|
duration = -1
|
|
bantype_pass = 1
|
|
if(BANTYPE_TEMP)
|
|
bantype_str = "TEMPBAN"
|
|
bantype_pass = 1
|
|
if(BANTYPE_JOB_PERMA)
|
|
bantype_str = "JOB_PERMABAN"
|
|
duration = -1
|
|
bantype_pass = 1
|
|
if(BANTYPE_JOB_TEMP)
|
|
bantype_str = "JOB_TEMPBAN"
|
|
bantype_pass = 1
|
|
if( !bantype_pass ) return
|
|
if( !istext(reason) ) return
|
|
if( !isnum(duration) ) return
|
|
|
|
var/ckey
|
|
var/computerid
|
|
var/ip
|
|
|
|
if(ismob(banned_mob))
|
|
ckey = banned_mob.ckey
|
|
if(banned_mob.client)
|
|
computerid = banned_mob.client.computer_id
|
|
ip = banned_mob.client.address
|
|
|
|
var/a_ckey
|
|
var/a_computerid
|
|
var/a_ip
|
|
|
|
if(src.owner && istype(src.owner, /client))
|
|
a_ckey = src.owner:ckey
|
|
a_computerid = src.owner:computer_id
|
|
a_ip = src.owner:address
|
|
|
|
var/list/client/clients = get_all_clients()
|
|
var/who
|
|
for(var/client/C in clients)
|
|
if(!who)
|
|
who = "[C]"
|
|
else
|
|
who += ", [C]"
|
|
|
|
var/list/client/admin_clients = get_all_admin_clients()
|
|
var/adminwho
|
|
for(var/client/C in admin_clients)
|
|
if(!adminwho)
|
|
adminwho = "[C]"
|
|
else
|
|
adminwho += ", [C]"
|
|
|
|
var/sql = "INSERT INTO erro_ban VALUES (null, Now(), '[serverip]', '[bantype_str]', '[reason]', '[job]', [(duration)?"[duration]":"0"], [(rounds)?"[rounds]":"0"], Now() + INTERVAL [(duration>0) ? duration : 0] MINUTE, '[ckey]', '[computerid]', '[ip]', '[a_ckey]', '[a_computerid]', '[a_ip]', '[who]', '[adminwho]', '', null, null, null, null, null)"
|
|
var/DBQuery/query_insert = dbcon.NewQuery(sql)
|
|
query_insert.Execute()
|
|
|
|
dbcon.Disconnect() |