public static function saveUnauthorizedAccess($checksum, $accountId) { if (isset($checksum) && isset($accountId)) { $db = db::getInstance(); $stmt = $db->prepare('SELECT count(tblAPIUnauthorizedAccess_accessId) AS counter FROM tblAPIUnauthorizedAccess WHERE tblAPIUnauthorizedAccess_accountId = :aid'); $stmt->bind_param('aid', $accountId); $stmt->execute(); $result = $stmt->fetch_assoc(); $stmt2 = $db->prepare('INSERT INTO tblAPIUnauthorizedAccess SET tblAPIUnauthorizedAccess_checksum = :csum, tblAPIUnauthorizedAccess_accountId = :accId'); $stmt2->bind_param('csum', $checksum); $stmt2->bind_param('accId', $accountId); $stmt2->execute(); if ($result['counter'] >= 1) { Account::killSession(); Account::banAccount($accountId); return 'banned'; } } }