mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 18:32:03 +00:00
admin thing
This commit is contained in:
@@ -12,6 +12,7 @@ var/list/admin_datums = list()
|
||||
var/datum/feed_message/admincaster_feed_message = new /datum/feed_message //These two will act as holders.
|
||||
var/datum/feed_channel/admincaster_feed_channel = new /datum/feed_channel
|
||||
var/admincaster_signature //What you'll sign the newsfeeds as
|
||||
var/sessKey = 0
|
||||
|
||||
/datum/admins/New(initial_rank = "Temporary Admin", initial_rights = 0, ckey)
|
||||
if(!ckey)
|
||||
@@ -99,3 +100,23 @@ you will have to do something like if(client.rights & R_ADMIN) yourself.
|
||||
holder.disassociate()
|
||||
del(holder)
|
||||
return 1
|
||||
|
||||
/datum/admins/proc/checkSessionKey(var/recurse=0)
|
||||
if(recurse==5)
|
||||
return "\[BROKEN\]";
|
||||
var/DBQuery/query = dbcon.NewQuery("DELETE FROM admin_sessions WHERE expires < Now()")
|
||||
query.Execute()
|
||||
|
||||
query = dbcon.NewQuery("SELECT sessID FROM admin_sessions WHERE ckey = '[owner.ckey]' AND expires > Now()")
|
||||
query.Execute()
|
||||
|
||||
sessKey=0
|
||||
while(query.NextRow())
|
||||
sessKey = query.item[1]
|
||||
query=dbcon.NewQuery("UPDATE admin_sessions SET expires=DATE_ADD(NOW(), INTERVAL 2 HOUR) WHERE sessID='[sessKey]'")
|
||||
query.Execute()
|
||||
return sessKey
|
||||
|
||||
query=dbcon.NewQuery("INSERT INTO admin_sessions (sessID,ckey,expires) VALUES (UUID(), '[owner.ckey]', DATE_ADD(NOW(), INTERVAL 2 HOUR))")
|
||||
query.Execute()
|
||||
return checkSessionKey(recurse++)
|
||||
Reference in New Issue
Block a user