Jump to content

How To Make Limit Guild Messages


Recommended Posts

Hey,

 

I shared a check for you, i think is the best way to block the attacks from the guild comments, because someone can make a bot and write a lot of comments in our guild_comment table.

This is the best solution for me, because anyways nobody can see more than 12 comments in the comment guild window, and if someone write a new comment a comment will hide,

so looks much more better to can write maximum 12 comments, and delete one for can write another.

 

guild.cpp

Spoiler

In AddComment function under:

    if (str.length() > GUILD_COMMENT_MAX_LEN)
        return;

Add this:

// AddComment - Attack Fix
    char szQuery[1024];
    snprintf(szQuery, sizeof(szQuery), "SELECT COUNT(*) FROM guild_comment WHERE guild_id = %d", m_data.guild_id);
    std::unique_ptr<SQLMsg> commentCount(DBManager::instance().DirectQuery(szQuery));

    MYSQL_ROW GetResult = mysql_fetch_row(commentCount->Get()->pSQLResult);

    BYTE Comments = 0;

    str_to_number(Comments, GetResult[0]);

    if (Comments >= GUILD_COMMENT_LIMIT)
    {
        ch->ChatPacket(CHAT_TYPE_INFO, "You have reach the limit of 12 comments. Delete a comment for continue.");
        return;
    }
    // End

guild.h

Spoiler

Search for:

    GUILD_CREATE_ITEM_VNUM            = 70101,

 

Add bellow:

// AddComment - Limit
    GUILD_COMMENT_LIMIT                = 12,

 

Good Luck.

 

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

It`s not a good idea, bcs this modification uses mysql query request in every checking time.

So if anybody attacks the server by send guild comment by spam bot , the mysql server will get so mutch request and that will causes slowdown on the mysql server, and that can make some problem during server running, for example the login will be very slow and etc.

I don`t recommend this.

There are another better ways to fix this problem.

Link to comment
Share on other sites

3 hours ago, attila1995 said:

It`s not a good idea, bcs this modification uses mysql query request in every checking time.

So if anybody attacks the server by send guild comment by spam bot , the mysql server will get so mutch request and that will causes slowdown on the mysql server, and that can make some problem during server running, for example the login will be very slow and etc.

I don`t recommend this.

There are another better ways to fix this problem.

A pulse is also good idea then, but the first solution is the same when u click delete without a message exists in the guild window, is the same request, so there is a lot ways to attack somehow :)

 

Link to comment
Share on other sites

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.