mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
Adds detecting newly made byond accounts (#16269)
* Adds age checking for byond accounts. * WIP. moved to regex. * Actually works now. * local vars * Changes to use sql. * Fixes * Removes unused var
This commit is contained in:
34
code/__HELPERS/bandetect.dm
Normal file
34
code/__HELPERS/bandetect.dm
Normal file
@@ -0,0 +1,34 @@
|
||||
#define YOUNG 4
|
||||
|
||||
|
||||
/client/proc/join_date_check(y,m,d)
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT DATEDIFF(Now(),'[y]-[m]-[d]')")
|
||||
|
||||
if(!query.Execute())
|
||||
world.log << "SQL ERROR doing datediff. Error : \[[query.ErrorMsg()]\]\n"
|
||||
return
|
||||
|
||||
if(query.NextRow())
|
||||
var/diff = text2num(query.item[1])
|
||||
if(diff < YOUNG)
|
||||
var/msg = "(IP: [address], ID: [computer_id]) is a new BYOND account made on [y]-[m]-[d]."
|
||||
if(diff < 0)
|
||||
msg += " They are also apparently from the future."
|
||||
message_admins("[key_name_admin(src)] [msg]")
|
||||
#undef YOUNG
|
||||
|
||||
|
||||
/client/proc/findJoinDate()
|
||||
var/http[] = world.Export("http://byond.com/members/[src.ckey]?format=text")
|
||||
if(!http)
|
||||
world.log << "Failed to connect to byond age check for [src.ckey]"
|
||||
|
||||
var/F = file2text(http["CONTENT"])
|
||||
if(F)
|
||||
var/regex/R = regex("joined = \"(\\d{4})-(\\d{2})-(\\d{2})\"")
|
||||
if(!R.Find(F))
|
||||
CRASH("Age check regex failed")
|
||||
var/y = R.group[1]
|
||||
var/m = R.group[2]
|
||||
var/d = R.group[3]
|
||||
join_date_check(y,m,d)
|
||||
@@ -25,7 +25,6 @@
|
||||
///////////////
|
||||
var/ambience_playing= null
|
||||
var/played = 0
|
||||
|
||||
////////////
|
||||
//SECURITY//
|
||||
////////////
|
||||
|
||||
@@ -185,6 +185,8 @@ var/next_external_rsc = 0
|
||||
else if (isnum(player_age) && player_age < config.notify_new_player_age)
|
||||
message_admins("New user: [key_name_admin(src)] just connected with an age of [player_age] day[(player_age==1?"":"s")]")
|
||||
|
||||
findJoinDate()
|
||||
|
||||
sync_client_with_db()
|
||||
|
||||
send_resources()
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#include "code\__HELPERS\510.dm"
|
||||
#include "code\__HELPERS\_logging.dm"
|
||||
#include "code\__HELPERS\_string_lists.dm"
|
||||
#include "code\__HELPERS\bandetect.dm"
|
||||
#include "code\__HELPERS\cmp.dm"
|
||||
#include "code\__HELPERS\files.dm"
|
||||
#include "code\__HELPERS\game.dm"
|
||||
|
||||
Reference in New Issue
Block a user