Jump to content
  • 0

Anti-injections


Zeca

Question

4 answers to this question

Recommended Posts

  • 0

Adauga la inceputul gm-ului

static const antisqlinjection[][] =
{
    "'",
    "#",
    "`",
    "%s",
    "%d",
    "%f",
    "%h",
    "h%"
};

 

adauga la public OnDialogResponse

 

if(strfind(inputtext, "%", true) != -1)
    { 
        SendClientMessage(playerid, COLOR_GENANNOUNCE, "SERVER: Invalid dialog input. You can't use %%.");
        ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, "Invalid dialog input", "Invalid dialog input", "OK", "Exit");
        return 1;
    }
    for(new i; i < sizeof(antisqlinjection); i++)
    {
        if(strfind(inputtext, antisqlinjection, true) != -1)
        {
            SCM(playerid, -1, "Nu sunt permise asemenea caractere.");
            return 1;
        }
    }

 

iar ca public si forward

 

forward CheckCharacters(string[]);
public CheckCharacters(string[])
{
    for(new i; i < sizeof(antisqlinjection); i++)
    {
        if(strfind(string, antisqlinjection, true) != -1)
        {
            return 1;
        }
    }
    return 0;
}

 

  • Upvote 1
Link to comment
Share on other sites

  • 0

Sau poti pur si simplu sa cauti caracterul `%` in inputtext la OnDialogResponse si sa-l elimini daca e gasit sau sa returnezi un mesaj..

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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. For more details you can also review our Terms of Use and Privacy Policy.