Attachments share code

Započeo trinty-less, Jul 14, 2023, 21:47:06 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Problem(error/warning): ovako uradio sam attachments share code, ali kad kreiram code i ocu da unesem pise da code ne postoji Vaš odgovor
Deo skripte: [pawn]CMD:sharecode(playerid, params[]) {
    if(isnull(params)) return SendClientMessage(playerid, NS_YELLOW, "[SHARE CODE] {ffffff}/sharecode [Unesi/Kreiraj]");
    else if(!strcmp(params, "kreiraj", true)) {
         new chars[16], xLength = random(1) + 8;
        format(chars, sizeof(chars), "");
        Loop(x, xLength) {
            format(chars, sizeof(chars), "%s%s", chars, xCharacters[random(sizeof(xCharacters))][0]);
        }
        va_SendClientMessage(playerid, NS_YELLOW, "[SHARE CODE] {FFFFFF}Uspesno ste kreirali attachments share code ('%s').", chars);
    }
    else if(!strcmp(params, "unesi", true)) return Dialog_Show(playerid, ShareCode, DIALOG_STYLE_INPUT, "Attachments Share Code", "Unesi Attachments Share Code", "Unesi", "Izlaz");
    return 1;
}

Dialog:ShareCode(playerid, listitem, response, inputtext[])
{
    if(!response) return 1;
    if(response) {
        new query[144];
        mysql_format(SQL, query, sizeof query, "SELECT * FROM attach WHERE ShareCode = '%s' LIMIT 5", inputtext);
        mysql_tquery(SQL, query, "ShareCode", "i", playerid);
    }
   
    return 1;
}

forward ShareCode(playerid, listitem);
public ShareCode(playerid, listitem) {
   
    if(!cache_num_rows()) return SendClientMessage(playerid, NS_SEL, "* Uneti Share code ne postoji u databazi!");

    for(new i = 0; i < cache_num_rows(); i++)
    {

    cache_get_value_name(i, "CreatorName", oInfo[playerid][CreatorName], 24);
    cache_get_value_name(i, "ShareCode", oInfo[playerid][sharecode], 16);
   
    SetPlayerAttachedObject(playerid, inindex, inmodel, i);
    oInfo[playerid][index1] = inindex;
     oInfo[playerid][modelid1] = inmodel;
      oInfo[playerid][bone1] = listitem+1;
    oInfo[playerid][used1] = true;
   
    va_SendClientMessage(i, NS_YELLOW, "[SHARE CODE] Uneo si share code ciji je kreator '%s'", PlayerName[playerid]);
    }
    return 1;
}[/pawn]
Debug iz server_log(ukoliko je u pitanju crashanje servera - crashdetect log): [pawn]Vaš odgovor[/pawn]
Slika/video ingame problema(obavezno ako je ingame problem): https://imgur.com/a/ltF8DTg

Kada kreiras kod unesi ga u bazu.
Ne koristi %s u SQL queryjima ukoliko korisnik ima kontrolu nad onim sto unosis. Koristi %e.
Citaj: https://www.w3schools.com/sql/sql_injection.asp

Citat: // xunder poslato Jul 14, 2023, 23:37:15 POSLE PODNE
Kada kreiras kod unesi ga u bazu.
Ne koristi %s u SQL queryjima ukoliko korisnik ima kontrolu nad onim sto unosis. Koristi %e.
Citaj: https://www.w3schools.com/sql/sql_injection.asp

to sam uradio mozes mi reci kako da stavim kad ukuca sharecode da kopira tolko objekata kolko je kreator koda imo i da mu stavi tolko slotova zauzeto

Citat: realmynato poslato Jul 15, 2023, 07:59:16 PRE PODNE
to sam uradio mozes mi reci kako da stavim kad ukuca sharecode da kopira tolko objekata kolko je kreator koda imo i da mu stavi tolko slotova zauzeto
Selektuj iz baze de je sharcode isti sa unesenim i onda samo insertuj to i loadujes mu attach