Server crashes when logging in (MySQL)
#1

When I login using MySQL and the wamp server, it crashes and closes my server. It does not happen when I register, but when I type my password and hit enter, it shuts down.

Pawn codes
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 15000)
    {
        if(response)
        {
            if(!strlen(inputtext) || strlen(inputtext) > 100)
            {
                SendClientMessage(playerid, 0xFF0000, "You must insert a password between 1-100 characters!");
                ShowPlayerDialog(playerid, 15000, DIALOG_STYLE_INPUT, "Register","Your user is {FF0000}not{FFFFFF} registered! Please {0000FF}register{FFFFFF} with a password below!\n {FF0000}ERROR:Please enter a password between 1-100 characters!","Register","Cancel");
            }
            else if(strlen(inputtext) > 0 && strlen(inputtext) < 100)
            {
                new escpass[100];
                mysql_real_escape_string(inputtext, escpass);
                MySQL_Register(playerid, escpass);
            }
        }
        if(!response)
        {
                SendClientMessage(playerid, 0xFF0000, "You must register before you spawn!");
                ShowPlayerDialog(playerid, 15000, DIALOG_STYLE_INPUT, "Register","Your user is {FF0000}not{FFFFFF} registered! Please {0000FF}register{FFFFFF} with a password below!\n {FF0000}ERROR:Please enter a password !","Register","Cancel");
        }
    }
    if(dialogid == 15500)
    {
        if(!response)
        {
                SendClientMessage(playerid, 0xFF0000, "You must login before you spawn!");
                ShowPlayerDialog(playerid, 15500, DIALOG_STYLE_INPUT, "Login","Your user is {FF0000}registered{FFFFFF}! Please {0000FF}login{FFFFFF} with your password below!\n{FF0000} You must login before you spawn!","Login","Cancel");
        }
        if(response)
        {
            new query[200], pname[24], escapepass[100];
            GetPlayerName(playerid, pname, 24);
            mysql_real_escape_string(inputtext, escapepass);
            format(query, sizeof(query), "SELECT `user` FROM playerdata WHERE user = '%s' AND password = '%s'", pname, escapepass);
            mysql_query(query);
            mysql_store_result();
            new numrows = mysql_num_rows();
            if(numrows == 1) MySQL_Login(playerid);
            if(!numrows)
            {
                ShowPlayerDialog(playerid, 15500, DIALOG_STYLE_INPUT, "Login","Your user is {FF0000}registered{FFFFFF}! Please {0000FF}login{FFFFFF} with your password below!\n{FF0000} The password you typed was incorrect!","Login","Cancel"); //Shows our login dialog :).
                SendClientMessage(playerid, 0xFF0000, "Incorrect password!");
            }
            mysql_free_result();
        }
    }
    return 1;
}

stock MySQL_Login(playerid)
{
    new query[300], pname[24], savingstring[20];
    GetPlayerName(playerid, pname, 24);
    format(query, sizeof(query), "SELECT * FROM playerdata WHERE user = '%s'", pname);
    mysql_query(query);
    mysql_store_result();
    while(mysql_fetch_row_format(query,"|"))
    {
        mysql_fetch_field_row(savingstring, "score"); SetPlayerScore(playerid, strval(savingstring));
        mysql_fetch_field_row(savingstring, "money"); MoneyGiven[playerid] = strval(savingstring);
    }
    mysql_free_result();
    SendClientMessage(playerid, -1, "You have been logged in!");
    Logged[playerid] = 1;
    return 1;
}
MySQL Debug
Код:
[00:57:29]  

[00:57:29] ---------------------------

[00:57:29] MySQL Debugging activated (03/16/15)

[00:57:29] ---------------------------

[00:57:29]  

[00:57:29] >> mysql_connect( )

[00:57:29] CMySQLHandler::CMySQLHandler() - constructor called.

[00:57:29] CMySQLHandler::CMySQLHandler() - Connecting to "127.0.0.1" | DB: "samp" | Username: "root" ...

[00:57:29] CMySQLHandler::Connect() - Connection was successful.

[00:57:29] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.

[00:58:00] >> mysql_query( Connection handle: 1 )

[00:58:00] CMySQLHandler::Query(SELECT user FROM `playerdata` WHERE user = 'willcnr09' LIMIT 1) - Successfully executed.

[00:58:00] >> mysql_store_result( Connection handle: 1 )

[00:58:00] CMySQLHandler::StoreResult() - Result was stored.

[00:58:00] >> mysql_num_rows( Connection handle: 1 )

[00:58:00] CMySQLHandler::NumRows() - Returned 1 row(s)

[00:58:00] >> mysql_free_result( Connection handle: 1 )

[00:58:00] CMySQLHandler::FreeResult() - Result was successfully free'd.

[00:58:03] >> mysql_real_escape_string( Connection handle: 1 )

[00:58:03] CMySQLHandler::EscapeString(cowismoo); - Escaped 8 characters to cowismoo.

[00:58:03] >> mysql_query( Connection handle: 1 )

[00:58:03] CMySQLHandler::Query(SELECT `user` FROM playerdata WHERE user = 'willcnr09' AND password = 'cowismoo') - Successfully executed.

[00:58:03] >> mysql_store_result( Connection handle: 1 )

[00:58:03] CMySQLHandler::StoreResult() - Result was stored.

[00:58:03] >> mysql_num_rows( Connection handle: 1 )

[00:58:03] CMySQLHandler::NumRows() - Returned 1 row(s)

[00:58:03] >> mysql_query( Connection handle: 1 )

[00:58:03] CMySQLHandler::Query(SELECT * FROM playerdata WHERE user = 'willcnr09') - Successfully executed.

[00:58:03] >> mysql_store_result( Connection handle: 1 )

[00:58:03] CMySQLHandler::StoreResult() - Result was stored.

[00:58:03] >> mysql_fetch_row_format( Connection handle: 1 )

[00:58:03] CMySQLHandler::FetchRow() - Return: willcnr09|cowismoo|0|0|192.168.1.9

[00:58:03] >> mysql_fetch_field_row( Connection handle: 1 )
Crash Info
Код:
--------------------------

SA-MP Server: 0.3z



Exception At Address: 0x7182B9F0 Module: (MSVCR90.dll)



Registers:

EAX: 0x035F6028	EBX: 0x02E0C87C	ECX: 0x00000000	EDX: 0x025BED80

ESI: 0x0018F7C8	EDI: 0x003A6868	EBP: 0x0018F78C	ESP: 0x0018F780

EFLAGS: 0x00010246



Stack:

+0000: 0x6F255DB4   0x00000000   0x003A6868   0x0018F7C0

+0010: 0x0054952E   0x00000000   0x39B4697C   0x0018F7C8

+0020: 0x02E0C87C   0x025BED80   0x6F2572AA   0x00000001

+0030: 0x00000000   0x0018F824   0x00549FFD   0x00000000

+0040: 0x0018F830   0x005467D3   0x00549EDB   0x726F6373

+0050: 0x00180065   0x005467AF   0x0018F7FC   0x00000005

+0060: 0x0000000F   0x39B4668C   0x00000000   0x0018F7C8

+0070: 0x353A3030   0x00000000   0x0018F7C8   0x025BED80

+0080: 0x726F6373   0x00590065   0x00549F3C   0xFFFFFFFF

+0090: 0x00000005   0x0000000F   0x39B4668C   0x025BED80

+00A0: 0x00000000   0x0018FB4C   0x0054A150   0x00000000

+00B0: 0x02E14090   0x004010B6   0x003A6868   0x02E1D668

+00C0: 0x02E14208   0x00402B63   0x003A6868   0x00000023

+00D0: 0x0018F868   0x02E1D668   0x0018FB5C   0x003A6868

+00E0: 0x00000000   0x00000000   0x00000001   0x00009460

+00F0: 0x00009460   0x00009F14   0x00005F3C   0x000099D0

+0100: 0x00005F3C   0x02E0C87C   0x02E14208   0x00000000

+0110: 0x02E0BFD8   0x0000798C   0x0046DE11   0x003A6868

+0120: 0x0018F8E8   0x00000000   0x003A6868   0x00000000

+0130: 0x003A6868   0x00003C8C   0x003A6868   0x00000001



--------------------------



Loaded Modules:

samp-server.exe	A: 0x00400000 - 0x004F5000	(C:\Users\Sarah\Desktop\gta sa\Server\samp-server.exe)

ntdll.dll	A: 0x77160000 - 0x772E0000	(C:\Windows\SysWOW64\ntdll.dll)

kernel32.dll	A: 0x74EB0000 - 0x74FC0000	(C:\Windows\syswow64\kernel32.dll)

KERNELBASE.dll	A: 0x752F0000 - 0x75337000	(C:\Windows\syswow64\KERNELBASE.dll)

SHELL32.dll	A: 0x76040000 - 0x76C8A000	(C:\Windows\syswow64\SHELL32.dll)

msvcrt.dll	A: 0x75C80000 - 0x75D2C000	(C:\Windows\syswow64\msvcrt.dll)

SHLWAPI.dll	A: 0x75C20000 - 0x75C77000	(C:\Windows\syswow64\SHLWAPI.dll)

GDI32.dll	A: 0x753B0000 - 0x75440000	(C:\Windows\syswow64\GDI32.dll)

USER32.dll	A: 0x75EE0000 - 0x75FE0000	(C:\Windows\syswow64\USER32.dll)

ADVAPI32.dll	A: 0x76CA0000 - 0x76D40000	(C:\Windows\syswow64\ADVAPI32.dll)

sechost.dll	A: 0x74E90000 - 0x74EA9000	(C:\Windows\SysWOW64\sechost.dll)

RPCRT4.dll	A: 0x74FC0000 - 0x750B0000	(C:\Windows\syswow64\RPCRT4.dll)

SspiCli.dll	A: 0x74AF0000 - 0x74B50000	(C:\Windows\syswow64\SspiCli.dll)

CRYPTBASE.dll	A: 0x74AE0000 - 0x74AEC000	(C:\Windows\syswow64\CRYPTBASE.dll)

LPK.dll	A: 0x75C10000 - 0x75C1A000	(C:\Windows\syswow64\LPK.dll)

USP10.dll	A: 0x75600000 - 0x7569D000	(C:\Windows\syswow64\USP10.dll)

WSOCK32.dll	A: 0x74960000 - 0x74967000	(C:\Windows\system32\WSOCK32.dll)

WS2_32.dll	A: 0x74C20000 - 0x74C55000	(C:\Windows\syswow64\WS2_32.dll)

NSI.dll	A: 0x755F0000 - 0x755F6000	(C:\Windows\syswow64\NSI.dll)

WINMM.dll	A: 0x715D0000 - 0x71602000	(C:\Windows\system32\WINMM.dll)

IMM32.DLL	A: 0x758A0000 - 0x75900000	(C:\Windows\system32\IMM32.DLL)

MSCTF.dll	A: 0x74B50000 - 0x74C1C000	(C:\Windows\syswow64\MSCTF.dll)

sscanf.DLL	A: 0x10000000 - 0x1000D000	(C:\Users\Sarah\Desktop\gta sa\Server\plugins\sscanf.DLL)

MSVCR100.dll	A: 0x6C580000 - 0x6C63D000	(C:\Windows\system32\MSVCR100.dll)

mysql.DLL	A: 0x00540000 - 0x00553000	(C:\Users\Sarah\Desktop\gta sa\Server\plugins\mysql.DLL)

LIBMYSQL.dll	A: 0x66C90000 - 0x6719C000	(C:\Users\Sarah\Desktop\gta sa\Server\LIBMYSQL.dll)

Secur32.dll	A: 0x70D80000 - 0x70D88000	(C:\Windows\system32\Secur32.dll)

MSVCR90.dll	A: 0x717F0000 - 0x71893000	(C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4940_none_50916076bcb9a742\MSVCR90.dll)

MSVCP90.dll	A: 0x6F250000 - 0x6F2DE000	(C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4940_none_50916076bcb9a742\MSVCP90.dll)

NLAapi.dll	A: 0x74520000 - 0x74530000	(C:\Windows\system32\NLAapi.dll)

napinsp.dll	A: 0x743C0000 - 0x743D0000	(C:\Windows\system32\napinsp.dll)

pnrpnsp.dll	A: 0x74390000 - 0x743A2000	(C:\Windows\system32\pnrpnsp.dll)

mswsock.dll	A: 0x70F60000 - 0x70F9C000	(C:\Windows\System32\mswsock.dll)

DNSAPI.dll	A: 0x730E0000 - 0x73124000	(C:\Windows\system32\DNSAPI.dll)

winrnr.dll	A: 0x743B0000 - 0x743B8000	(C:\Windows\System32\winrnr.dll)

WLIDNSP.DLL	A: 0x74360000 - 0x74387000	(C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live\WLIDNSP.DLL)

PSAPI.DLL	A: 0x75350000 - 0x75355000	(C:\Windows\syswow64\PSAPI.DLL)

rasadhlp.dll	A: 0x74350000 - 0x74356000	(C:\Windows\system32\rasadhlp.dll)

wshtcpip.dll	A: 0x70F50000 - 0x70F55000	(C:\Windows\System32\wshtcpip.dll)

IPHLPAPI.DLL	A: 0x73240000 - 0x7325C000	(C:\Windows\system32\IPHLPAPI.DLL)

WINNSI.DLL	A: 0x748E0000 - 0x748E7000	(C:\Windows\system32\WINNSI.DLL)



--------------------------

SA-MP Server: 0.3z



Exception At Address: 0x771943E0 Module: (ntdll.dll)



Registers:

EAX: 0x02DCF4C0	EBX: 0x02E0C7F8	ECX: 0x00000000	EDX: 0x00000000

ESI: 0x02DCF4B8	EDI: 0x00240000	EBP: 0x0018ECFC	ESP: 0x0018ECD4

EFLAGS: 0x00010246



Stack:

+0000: 0x00240000   0x02E0C7F8   0x00000000   0x34323133

+0010: 0x00000000   0x0018ECC8   0x646E6957   0x00000000

+0020: 0x771D71F5   0x24B6A536   0x0018EDF4   0x771935B7

+0030: 0x00240000   0x02E0C7F8   0x0018EDC4   0x00000000

+0040: 0x53B698E2   0x00000000   0x00240000   0x02E0C800

+0050: 0x7830202D   0x42333437   0x30303038   0x3A432809

+0060: 0x6E69575C   0x73776F64   0x7379535C   0x336D6574

+0070: 0x69775C32   0x00240000   0x00244D58   0x0A0D0D29

+0080: 0x44494C57   0x2E50534E   0x094C4C44   0x30203A41

+0090: 0x33343778   0x30303036   0x202D2030   0x34377830

+00A0: 0x00000003   0x28093030   0x505C3A43   0x72676F72

+00B0: 0x46206D61   0x73656C69   0x38782820   0x435C2936

+00C0: 0x6F6D6D6F   0x6946206E   0x5C73656C   0x7263694D

+00D0: 0x666F736F   0x00000000   0x64657261   0x6E69575C

+00E0: 0x73776F64   0x76694C20   0x4C575C65   0x534E4449

+00F0: 0x00007961   0x00000000   0x0100500A   0x442E4950

+0100: 0x41094C4C   0x0101203A   0x0018ED14   0x0018E89C

+0110: 0x0018EE54   0x771D71F5   0x24B6BD66   0x00000000

+0120: 0x0018EE14   0x771934A2   0x02E0C7F8   0x02E0C800

+0130: 0x02E0C800   0x004B85C8   0x0018FCB0   0x02E0C7F8



--------------------------



Loaded Modules:

samp-server.exe	A: 0x00400000 - 0x004F5000	(C:\Users\Sarah\Desktop\gta sa\Server\samp-server.exe)

ntdll.dll	A: 0x77160000 - 0x772E0000	(C:\Windows\SysWOW64\ntdll.dll)

kernel32.dll	A: 0x74EB0000 - 0x74FC0000	(C:\Windows\syswow64\kernel32.dll)

KERNELBASE.dll	A: 0x752F0000 - 0x75337000	(C:\Windows\syswow64\KERNELBASE.dll)

SHELL32.dll	A: 0x76040000 - 0x76C8A000	(C:\Windows\syswow64\SHELL32.dll)

msvcrt.dll	A: 0x75C80000 - 0x75D2C000	(C:\Windows\syswow64\msvcrt.dll)

SHLWAPI.dll	A: 0x75C20000 - 0x75C77000	(C:\Windows\syswow64\SHLWAPI.dll)

GDI32.dll	A: 0x753B0000 - 0x75440000	(C:\Windows\syswow64\GDI32.dll)

USER32.dll	A: 0x75EE0000 - 0x75FE0000	(C:\Windows\syswow64\USER32.dll)

ADVAPI32.dll	A: 0x76CA0000 - 0x76D40000	(C:\Windows\syswow64\ADVAPI32.dll)

sechost.dll	A: 0x74E90000 - 0x74EA9000	(C:\Windows\SysWOW64\sechost.dll)

RPCRT4.dll	A: 0x74FC0000 - 0x750B0000	(C:\Windows\syswow64\RPCRT4.dll)

SspiCli.dll	A: 0x74AF0000 - 0x74B50000	(C:\Windows\syswow64\SspiCli.dll)

CRYPTBASE.dll	A: 0x74AE0000 - 0x74AEC000	(C:\Windows\syswow64\CRYPTBASE.dll)

LPK.dll	A: 0x75C10000 - 0x75C1A000	(C:\Windows\syswow64\LPK.dll)

USP10.dll	A: 0x75600000 - 0x7569D000	(C:\Windows\syswow64\USP10.dll)

WSOCK32.dll	A: 0x74960000 - 0x74967000	(C:\Windows\system32\WSOCK32.dll)

WS2_32.dll	A: 0x74C20000 - 0x74C55000	(C:\Windows\syswow64\WS2_32.dll)

NSI.dll	A: 0x755F0000 - 0x755F6000	(C:\Windows\syswow64\NSI.dll)

WINMM.dll	A: 0x715D0000 - 0x71602000	(C:\Windows\system32\WINMM.dll)

IMM32.DLL	A: 0x758A0000 - 0x75900000	(C:\Windows\system32\IMM32.DLL)

MSCTF.dll	A: 0x74B50000 - 0x74C1C000	(C:\Windows\syswow64\MSCTF.dll)

sscanf.DLL	A: 0x10000000 - 0x1000D000	(C:\Users\Sarah\Desktop\gta sa\Server\plugins\sscanf.DLL)

MSVCR100.dll	A: 0x6C580000 - 0x6C63D000	(C:\Windows\system32\MSVCR100.dll)

mysql.DLL	A: 0x00540000 - 0x00553000	(C:\Users\Sarah\Desktop\gta sa\Server\plugins\mysql.DLL)

LIBMYSQL.dll	A: 0x66C90000 - 0x6719C000	(C:\Users\Sarah\Desktop\gta sa\Server\LIBMYSQL.dll)

Secur32.dll	A: 0x70D80000 - 0x70D88000	(C:\Windows\system32\Secur32.dll)

MSVCR90.dll	A: 0x717F0000 - 0x71893000	(C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4940_none_50916076bcb9a742\MSVCR90.dll)

MSVCP90.dll	A: 0x6F250000 - 0x6F2DE000	(C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4940_none_50916076bcb9a742\MSVCP90.dll)

NLAapi.dll	A: 0x74520000 - 0x74530000	(C:\Windows\system32\NLAapi.dll)

napinsp.dll	A: 0x743C0000 - 0x743D0000	(C:\Windows\system32\napinsp.dll)

pnrpnsp.dll	A: 0x74390000 - 0x743A2000	(C:\Windows\system32\pnrpnsp.dll)

mswsock.dll	A: 0x70F60000 - 0x70F9C000	(C:\Windows\System32\mswsock.dll)

DNSAPI.dll	A: 0x730E0000 - 0x73124000	(C:\Windows\system32\DNSAPI.dll)

winrnr.dll	A: 0x743B0000 - 0x743B8000	(C:\Windows\System32\winrnr.dll)

WLIDNSP.DLL	A: 0x74360000 - 0x74387000	(C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live\WLIDNSP.DLL)

PSAPI.DLL	A: 0x75350000 - 0x75355000	(C:\Windows\syswow64\PSAPI.DLL)

rasadhlp.dll	A: 0x74350000 - 0x74356000	(C:\Windows\system32\rasadhlp.dll)

wshtcpip.dll	A: 0x70F50000 - 0x70F55000	(C:\Windows\System32\wshtcpip.dll)

IPHLPAPI.DLL	A: 0x73240000 - 0x7325C000	(C:\Windows\system32\IPHLPAPI.DLL)

WINNSI.DLL	A: 0x748E0000 - 0x748E7000	(C:\Windows\system32\WINNSI.DLL)
Reply
#2

Which mysql plugin are you using?
Reply
#3

So it crashes your game with those error codes?

It could be that the coords are wrong, not to do with the login itself. Are you sure you have "SetSpawnInfo" under OnGameModeInit(I believe it's SetSpawnInfo).

Change the coords to another place(LS,LV,SF) and try again.
Reply
#4

PHP код:
if(dialogid == 15500)
    {
        if(!
response)
        {
                
SendClientMessage(playerid0xFF0000"You must login before you spawn!");
                
ShowPlayerDialog(playerid15500DIALOG_STYLE_INPUT"Login","Your user is {FF0000}registered{FFFFFF}! Please {0000FF}login{FFFFFF} with your password below!\n{FF0000} You must login before you spawn!","Login","Cancel");
        }
        if(
response)
        {
            new 
query[200], pname[24], escapepass[100];
            
GetPlayerName(playeridpname24);
            
mysql_real_escape_string(inputtextescapepass);
            
format(querysizeof(query), "SELECT `user` FROM playerdata WHERE user = '%s' AND password = '%s'"pnameescapepass);
            
mysql_query(query);
            
mysql_store_result();
            new 
numrows mysql_num_rows();
            if(
numrows == 1MySQL_Login(playerid);
            if(!
numrows)
            {
                
ShowPlayerDialog(playerid15500DIALOG_STYLE_INPUT"Login","Your user is {FF0000}registered{FFFFFF}! Please {0000FF}login{FFFFFF} with your password below!\n{FF0000} The password you typed was incorrect!","Login","Cancel"); //Shows our login dialog :).
                
SendClientMessage(playerid0xFF0000"Incorrect password!");
            }
            
mysql_free_result();//THIS!! Should be before MySQL_Login(playerid);
        
}
    } 
Reply
#5

I'm using BlueG's MySQL R6 and I tried what Matess said and it didn't solve the problem. Also it isn't the spawn locations because when I join and register and spawn it works fine. It's only a problem when I try to login.
Reply
#6

So try to locate exact code, for example try comment this:

PHP код:
/*while(mysql_fetch_row_format(query,"|"))
    {
        mysql_fetch_field_row(savingstring, "score"); SetPlayerScore(playerid, strval(savingstring));
        mysql_fetch_field_row(savingstring, "money"); MoneyGiven[playerid] = strval(savingstring);
    }*/ 
Reply
#7

Well Matess, its that simple. It was those lines that caused it. So how would I fix that?
Reply
#8

Upgrade to r39-3.
Reply
#9

I don't know how to use thread scripts or anything about them If you got a tutorial on how to use them somewhere I'd love to give it a try.
Reply
#10

I am not sure if "while" is necessary because you are loading only these two items. Maybe there is problem only with one of them so try it. I hope that you have these columns in phpmyadmin.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)