GM Check Script

Skilled Illusionist
Joined
Dec 26, 2010
Messages
387
Reaction score
156
Alright, since I remember one of my coders during caali times made this to protect anyone from gaining GM powers in game through SQL injections or something, I will now remake into MsSQL.

Caution: I'm making this RIGHT NOW. So I haven't tested it yet. Don't be pissed if I ruin your whole damn character tbl - Not my fault <3

1. Put this script into your config file.

PHP:
$getallgms = mssql_query("SELECT * FROM [CHARACTER_01_DBF].dbo.[CHARACTER_TBL] WHERE m_chAuthority != 'F' AND isblock != 'D'");


$gm_ids = array("m_szName", "m_szName", "m_szName", "m_szName");

while($fetch = mssql_fetch_array($getallgms))
{

if(!in_array($fetch['m_szName'], $gm_ids))
{
$update = mssql_query("UPDATE [CHARACTER_01_DBF].dbo.[CHARACTER_TBL] SET isblock='D' where m_szName='{$fetch['m_szName']}'");
}


Now, where the line says
Code:
$gm_ids = array("m_szName", "m_szName", "m_szName", "m_szName");
Put the GM's Name in the "".

What this does is if a character is GM, BUT ISN'T in the array on the script, it'll set isblock to equal D, which makes the GM inuseable.

kthx
-Apixen
 
Last edited:
Tbh. this protects nothing. Either you need to run it manually or you need to implent it into several queries your site usually runs (online count or w.e.) which will slow the site down to death. How about just make everybodies site resistable to SQL Injections. ;)
If your registered character count goes over the 100.000 good luck on implenting this into usual SQL queries the site run. ;)
 
Tbh. this protects nothing. Either you need to run it manually or you need to implent it into several queries your site usually runs (online count or w.e.) which will slow the site down to death. How about just make everybodies site resistable to SQL Injections. ;)
If your registered character count goes over the 100.000 good luck on implenting this into usual SQL queries the site run. ;)

Actually read the script, bro.


The query in the script only selects the GM Characters. Do you really think there's going to be over 200 GMs? No. Only a few, which makes this script good.

Kthx bai.
 
This script seems a bit... overrated, seeing as how if you follow proper procedures, your script could be secure without having to code your GM Names in.

SQL Injection is very easy to do, but even easier to prevent in my opinion. o.o;
 
The script is not overrated for that reason... it's overrated because it's pointless. The servers owners know who they promote, therefore a check script is not necessary.

+1 for effort though.
-1 for pointless.
 
Actually read the script, bro.


The query in the script only selects the GM Characters. Do you really think there's going to be over 200 GMs? No. Only a few, which makes this script good.

Kthx bai.

Run this query in a database with 150,000 character entries in. Good luck on having this speed all the time you execute this script ;)
 
what you should really do is create a new table and load the GM ids, names and online status. That way you don't bog down the database looking for them.

You can run a cron job or execute a stored procedure every 30min or whatever then store it in a new table for the website. Its very logical.

The table itself wouldn't be dependent on anything in the server.
 
what you should really do is create a new table and load the GM ids, names and online status. That way you don't bog down the database looking for them.

You can run a cron job or execute a stored procedure every 30min or whatever then store it in a new table for the website. Its very logical.

The table itself wouldn't be dependent on anything in the server.

Not necessary at all... SELECT m_idPlayer FROM CHARACTER_TBL WHERE m_chAuthority != 'F'

Takes less than a second(probably less than 1/1000ths of a second) in a character database with over 250k records.

Looking for GMs doesn't bog down the database...I could run that query 1,000x times a second and it wouldn't lag the database in the slightest. SELECT * FROM LOG_ITEM_TBL, on the other hand...with over 20million records...THAT bogs down the database.
 
I agree with you. I didn't think there was any slowdown myself because I've managed a lot of database driven websites with thousands of customers and never any slowdowns on the database.

I only mentioned that method because the person above me said the script would slowdown the server.

I don't even think it would slowdown if you had over a million accounts in the database. Wouldn't be as fast as a thousand but still wouldn't slow the game down.
 
I agree with you. I didn't think there was any slowdown myself because I've managed a lot of database driven websites with thousands of customers and never any slowdowns on the database.

I only mentioned that method because the person above me said the script would slowdown the server.

I don't even think it would slowdown if you had over a million accounts in the database. Wouldn't be as fast as a thousand but still wouldn't slow the game down.

Tbh, after looking at the script, he uses a *(SELECT ALL). It would be hugely more effective to "SELECT m_szName". Even though it wouldn't slow the gameserver down, it is a very inefficient/slow script. Also, the database will never effect Worldserver lag unless it lags for like 60 seconds straight(mssql would have to crash) and crashes the entire server.
 
Last edited:
Back