Date saving to mysql and writing to enum
#1

PHP код:
        new year, month, day;
        
getdate(year,month,day);
        
format(verslas[ apID[playerid] ][ vData ], 21,"%02d/%02d/%d", day, month, year);
        
verslas[ apID[playerid] ][ vPelnas ] -= money;
        
format(verslas[ apID[playerid] ][ vThief ], MAX_PLAYER_NAME, "%s", getPlayerName(playerid));
        
verslas[ apID[playerid] ][ vSPelnas ] += money;
        
format(g_szBuffer, sizeof g_szBuffer, "UPDATE "MySQL_BUSINESS_TABLE" SET Pelnas = '%i', Pavogta = '%i', Vagis = '%s', lastData = '%i' WHERE ID = '%i'", verslas[ apID[playerid] ][ vPelnas ],verslas[ apID[playerid] ][ vSPelnas ],verslas[ apID[playerid] ][ vThief ],verslas[ apID[playerid] ][ vData ], apID[playerid])  ;
        
sql_query(sql, g_szBuffer, QUERY_THREADED); 
Sorry that code is in Lithuania speach. But vData doesn't saves as it should be. In enum it's : vData[21]
Reply
#2

Change
pawn Код:
lastData = '%i'
to
pawn Код:
lastData = '%s'
Also escape your inputs to prevent SQLi
Reply
#3

Fixed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)