Nur um es mal zu testen, entferne mal beim Registrieren und beim Login (also überall, wichtig!) das MD5, lass als das Passwort mal als Klartext speichern.
Klappt es dann mit dem Einloggen?
Spieler speichern nicht in Mysql?
- Markuslobicher
- Geschlossen
- Erledigt
Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!
Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
-
-
Code
Alles anzeigenif(dialogid==DIALOG_REGISTER) { if(response) { new name[MAX_PLAYER_NAME],query[128],passwort[35]; GetPlayerName(playerid,name,sizeof(name)); if(strlen(inputtext)>5) { //Registrierungsfunktion format(query,sizeof(query),"INSERT INTO user (username, passwort, level) VALUES ('%s', MD5('%s'), '1')",name,passwort); mysql_function_query(dbhandle,query,false,"","d",playerid); sInfo[playerid][level]=1; SetPlayerScore(playerid,sInfo[playerid][level]); } else { //Kleiner als 4 Zeichen SendClientMessage(playerid,helblau,"Dein Passwort muss mindestens 6 Zeichen lang sein."); ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Account Erstellung","Gebe bitte nun dein gewünschtes Passwort ein!","Erstellen","Abbrechen"); } } else { Kick(playerid); } }
was genau muss ich vom Register weg machen?
-
Jeweils das
MD5('%s')
zu
'%s'Auch beim Login.
-
@Jeffry und @German_ScripterHD
So oder?
Code
Alles anzeigenif(dialogid==DIALOG_LOGIN) { if(response && strlen(inputtext) > 0) { new name[MAX_PLAYER_NAME],query[256],passwort[35]; GetPlayerName(playerid,name,sizeof(name)); if(strlen(inputtext)>0) { mysql_escape_string(inputtext,passwort,dbhandle); format(query,sizeof(query),"INSERT INTO user (username, passwort, level) VALUES '%s'",name,passwort); mysql_function_query(dbhandle,query,true,"OnPasswordResponse","i",playerid); } else { //Keine Eingabe SendClientMessage(playerid,grün,"Gibt bitte dein Passwort ein."); ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Gibt bitte dein Passwort ein:","Anmelden","Abbrechen"); } } else { Kick(playerid); } } if(dialogid==DIALOG_REGISTER) { if(response) { new name[MAX_PLAYER_NAME],query[128],passwort[35]; GetPlayerName(playerid,name,sizeof(name)); if(strlen(inputtext)>5) { //Registrierungsfunktion format(query,sizeof(query),"INSERT INTO user (username, passwort, level) '%s'",name,passwort); mysql_function_query(dbhandle,query,false,"","d",playerid); sInfo[playerid][level]=1; SetPlayerScore(playerid,sInfo[playerid][level]); } else { //Kleiner als 4 Zeichen SendClientMessage(playerid,helblau,"Dein Passwort muss mindestens 6 Zeichen lang sein."); ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Account Erstellung","Gebe bitte nun dein gewünschtes Passwort ein!","Erstellen","Abbrechen"); } } else { Kick(playerid); } }
-
Nein.
Nur das
MD5('%s')
zu:
'%s'Nichts sonst.
MD5( und ) entfernen, mehr nicht.
-
Habe es jetzt so:
Code
Alles anzeigenif(dialogid==DIALOG_LOGIN) { if(response && strlen(inputtext) > 0) { new name[MAX_PLAYER_NAME],query[256],passwort[35]; GetPlayerName(playerid,name,sizeof(name)); if(strlen(inputtext)>0) { mysql_escape_string(inputtext,passwort,dbhandle); format(query,sizeof(query),"INSERT INTO user (username, passwort, level) VALUES ('%s', '%s', '1')",name,passwort); mysql_function_query(dbhandle,query,true,"OnPasswordResponse","i",playerid); } else { //Keine Eingabe SendClientMessage(playerid,grün,"Gibt bitte dein Passwort ein."); ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Gibt bitte dein Passwort ein:","Anmelden","Abbrechen"); } } else { Kick(playerid); } } if(dialogid==DIALOG_REGISTER) { if(response) { new name[MAX_PLAYER_NAME],query[128],passwort[35]; GetPlayerName(playerid,name,sizeof(name)); if(strlen(inputtext)>5) { //Registrierungsfunktion format(query,sizeof(query),"INSERT INTO user (username, passwort, level) VALUES ('%s', '1')",name,passwort); mysql_function_query(dbhandle,query,false,"","d",playerid); sInfo[playerid][level]=1; SetPlayerScore(playerid,sInfo[playerid][level]); } else { //Kleiner als 4 Zeichen SendClientMessage(playerid,helblau,"Dein Passwort muss mindestens 6 Zeichen lang sein."); ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Account Erstellung","Gebe bitte nun dein gewünschtes Passwort ein!","Erstellen","Abbrechen"); } } else { Kick(playerid); } }
-
Warum ersetzt du beim Login das SELECT jedes mal mit einem INSERT? Das macht doch keinen Sinn.
Nur beim LOGIN:
format(query,sizeof(query),"INSERT INTO user (username, passwort, level) VALUES ('%s', '%s', '1')",name,passwort);
zu:
format(query,sizeof(query),"SELECT * FROM user WHERE username='%s' AND passwort='%s'",name,passwort); -
Beitrag von Markuslobicher ()
Dieser Beitrag wurde vom Autor aus folgendem Grund gelöscht: Fehler noch drin (). -
@Jeffry
So sieht mein Code AusLogin/Register:
Code
Alles anzeigenif(dialogid==DIALOG_LOGIN) { if(response && strlen(inputtext) > 0) { new name[MAX_PLAYER_NAME],query[256],passwort[35]; GetPlayerName(playerid,name,sizeof(name)); if(strlen(inputtext)>0) { mysql_escape_string(inputtext,passwort,dbhandle); format(query,sizeof(query),"SELECT * FROM user WHERE username='%s' AND passwort='%s'",name,passwort); mysql_function_query(dbhandle,query,true,"OnPasswordResponse","i",playerid); } else { //Keine Eingabe SendClientMessage(playerid,grün,"Gibt bitte dein Passwort ein."); ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Gibt bitte dein Passwort ein:","Anmelden","Abbrechen"); } } else { Kick(playerid); } } if(dialogid==DIALOG_REGISTER) { if(response) { new name[MAX_PLAYER_NAME],query[128],passwort[35]; GetPlayerName(playerid,name,sizeof(name)); if(strlen(inputtext)>5) { //Registrierungsfunktion format(query,sizeof(query),"INSERT INTO user (username, passwort, level) VALUES ('%s', MD5('%s'), '1')",name,passwort); mysql_function_query(dbhandle,query,false,"","d",playerid); sInfo[playerid][level]=1; SetPlayerScore(playerid,sInfo[playerid][level]); } else { //Kleiner als 4 Zeichen SendClientMessage(playerid,helblau,"Dein Passwort muss mindestens 6 Zeichen lang sein."); ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Account Erstellung","Gebe bitte nun dein gewünschtes Passwort ein!","Erstellen","Abbrechen"); } } else { Kick(playerid); } }
MYSQL-Log beim Registrieren:Code
Alles anzeigen[22:04:41] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [22:04:41] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [22:04:41] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [22:04:41] [DEBUG] CMySQLConnection::Connect - connection was successful [22:04:41] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [22:04:41] [DEBUG] CMySQLConnection::Connect - connection was successful [22:04:41] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [22:04:41] [DEBUG] CMySQLConnection::Connect - connection was successful [22:04:41] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [22:05:13] [DEBUG] mysql_tquery - connection: 1, query: "SELECT id FROM user WHERE username='test' ", callback: "OnUserCheck", format: "i" [22:05:13] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - starting query execution [22:05:13] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - query was successfully executed within 0.319 milliseconds [22:05:13] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [22:05:13] [DEBUG] Calling callback "OnUserCheck".. [22:05:13] [DEBUG] cache_get_data - connection: 1 [22:05:13] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [22:05:20] [DEBUG] mysql_tquery - connection: 1, query: "INSERT INTO user (username, passwort, level) VALUES ('test', MD5", callback: "(null)", format: "d" [22:05:20] [DEBUG] CMySQLQuery::Execute[] - starting query execution [22:05:20] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 0.704 milliseconds [22:05:20] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving [22:05:28] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM autos WHERE besitzer='0'", callback: "OnPlayerCarsLoad", format: "i" [22:05:28] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - starting query execution [22:05:28] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - query was successfully executed within 0.85 milliseconds [22:05:28] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [22:05:28] [DEBUG] Calling callback "OnPlayerCarsLoad".. [22:05:28] [DEBUG] cache_get_data - connection: 1 [22:05:28] [DEBUG] cache_get_field_content_int - row: 0, field_name: "model", connection: 1 [22:05:28] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "model", data: "415" [22:05:28] [DEBUG] cache_get_field_content_int - row: 0, field_name: "besitzer", connection: 1 [22:05:28] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "besitzer", data: "0" [22:05:28] [DEBUG] cache_get_field_content_float - row: 0, field_name: "x", connection: 1 [22:05:28] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "x", data: "1280" [22:05:28] [DEBUG] cache_get_field_content_float - row: 0, field_name: "y", connection: 1 [22:05:28] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "y", data: "-1662" [22:05:28] [DEBUG] cache_get_field_content_float - row: 0, field_name: "z", connection: 1 [22:05:28] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "z", data: "19" [22:05:28] [DEBUG] cache_get_field_content_float - row: 0, field_name: "r", connection: 1 [22:05:28] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "r", data: "180" [22:05:28] [DEBUG] cache_get_field_content_int - row: 0, field_name: "id", connection: 1 [22:05:28] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "id", data: "130" [22:05:28] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
Loginprozess nach dem erneuten verbiden:
SQL
Alles anzeigen[22:07:54] [DEBUG] mysql_tquery - connection: 1, query: "SELECT id FROM user WHERE username='test' ", callback: "OnUserCheck", format: "i" [22:07:54] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - starting query execution [22:07:54] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - query was successfully executed within 0.226 milliseconds [22:07:54] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [22:07:54] [DEBUG] Calling callback "OnUserCheck".. [22:07:54] [DEBUG] cache_get_data - connection: 1 [22:07:54] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [22:08:01] [DEBUG] mysql_escape_string - source: "test123", connection: 1, max_len: 35 [22:08:01] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM user WHERE username='test' AND passwort='test123'", callback: "OnPasswordResponse", format: "i" [22:08:01] [DEBUG] CMySQLQuery::Execute[OnPasswordResponse] - starting query execution [22:08:01] [DEBUG] CMySQLQuery::Execute[OnPasswordResponse] - query was successfully executed within 0.626 milliseconds [22:08:01] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [22:08:01] [DEBUG] Calling callback "OnPasswordResponse".. [22:08:01] [DEBUG] cache_get_data - connection: 1 [22:08:01] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [22:08:12] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE user SET level='1',money='0',alevel='0',fraktion='0',rang", callback: "(null)", format: "(null)" [22:08:12] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM autos WHERE besitzer='0'", callback: "OnPlayerCarsLoad", format: "i" [22:08:12] [DEBUG] CMySQLQuery::Execute[] - starting query execution [22:08:12] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 0.206 milliseconds [22:08:12] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving [22:08:12] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - starting query execution [22:08:12] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - query was successfully executed within 0.36 milliseconds [22:08:12] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [22:08:12] [DEBUG] Calling callback "OnPlayerCarsLoad".. [22:08:12] [DEBUG] cache_get_data - connection: 1 [22:08:12] [DEBUG] cache_get_field_content_int - row: 0, field_name: "model", connection: 1 [22:08:12] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "model", data: "415" [22:08:12] [DEBUG] cache_get_field_content_int - row: 0, field_name: "besitzer", connection: 1 [22:08:12] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "besitzer", data: "0" [22:08:12] [DEBUG] cache_get_field_content_float - row: 0, field_name: "x", connection: 1 [22:08:12] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "x", data: "1280" [22:08:12] [DEBUG] cache_get_field_content_float - row: 0, field_name: "y", connection: 1 [22:08:12] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "y", data: "-1662" [22:08:12] [DEBUG] cache_get_field_content_float - row: 0, field_name: "z", connection: 1 [22:08:12] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "z", data: "19" [22:08:12] [DEBUG] cache_get_field_content_float - row: 0, field_name: "r", connection: 1 [22:08:12] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "r", data: "180" [22:08:12] [DEBUG] cache_get_field_content_int - row: 0, field_name: "id", connection: 1 [22:08:12] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "id", data: "130" [22:08:12] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
-
Beim DIALOG_REGISTER, nur dort, nirgends anders (1 mal!):
format(query,sizeof(query),"INSERT INTO user (username, passwort, level) VALUES ('%s', MD5('%s'), '1')",name,passwort);
zu:
format(query,sizeof(query),"INSERT INTO user (username, passwort, level) VALUES ('%s', '%s', '1')",name,passwort); -
-
So habe es so gemacht wie du es gesagt hast @Jeffry
Passwort wird nicht in der MySqL Tabelle abgespeichert Password. Nach dem man sich Registriert hat.
Mysql-Log:
SQL
Alles anzeigen[22:21:51] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [22:21:51] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [22:21:51] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [22:21:51] [DEBUG] CMySQLConnection::Connect - connection was successful [22:21:51] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [22:21:51] [DEBUG] CMySQLConnection::Connect - connection was successful [22:21:51] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [22:21:51] [DEBUG] CMySQLConnection::Connect - connection was successful [22:21:51] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [22:22:22] [DEBUG] mysql_tquery - connection: 1, query: "SELECT id FROM user WHERE username='test' ", callback: "OnUserCheck", format: "i" [22:22:22] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - starting query execution [22:22:22] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - query was successfully executed within 0.540 milliseconds [22:22:22] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [22:22:22] [DEBUG] Calling callback "OnUserCheck".. [22:22:22] [DEBUG] cache_get_data - connection: 1 [22:22:22] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [22:22:30] [DEBUG] mysql_tquery - connection: 1, query: "INSERT INTO user (username, passwort, level) VALUES ('test', '',", callback: "(null)", format: "d" [22:22:30] [DEBUG] CMySQLQuery::Execute[] - starting query execution [22:22:30] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 1.181 milliseconds [22:22:30] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving [22:22:37] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM autos WHERE besitzer='0'", callback: "OnPlayerCarsLoad", format: "i" [22:22:37] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - starting query execution [22:22:37] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - query was successfully executed within 0.68 milliseconds [22:22:37] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [22:22:37] [DEBUG] Calling callback "OnPlayerCarsLoad".. [22:22:37] [DEBUG] cache_get_data - connection: 1 [22:22:37] [DEBUG] cache_get_field_content_int - row: 0, field_name: "model", connection: 1 [22:22:37] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "model", data: "415" [22:22:37] [DEBUG] cache_get_field_content_int - row: 0, field_name: "besitzer", connection: 1 [22:22:37] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "besitzer", data: "0" [22:22:37] [DEBUG] cache_get_field_content_float - row: 0, field_name: "x", connection: 1 [22:22:37] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "x", data: "1280" [22:22:37] [DEBUG] cache_get_field_content_float - row: 0, field_name: "y", connection: 1 [22:22:37] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "y", data: "-1662" [22:22:37] [DEBUG] cache_get_field_content_float - row: 0, field_name: "z", connection: 1 [22:22:37] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "z", data: "19" [22:22:37] [DEBUG] cache_get_field_content_float - row: 0, field_name: "r", connection: 1 [22:22:37] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "r", data: "180" [22:22:37] [DEBUG] cache_get_field_content_int - row: 0, field_name: "id", connection: 1 [22:22:37] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "id", data: "130" [22:22:37] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [22:23:22] [DEBUG] mysql_tquery - connection: 1, query: "SELECT id FROM user WHERE username='test' ", callback: "OnUserCheck", format: "i" [22:23:22] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - starting query execution [22:23:22] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - query was successfully executed within 0.373 milliseconds [22:23:22] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [22:23:22] [DEBUG] Calling callback "OnUserCheck".. [22:23:22] [DEBUG] cache_get_data - connection: 1 [22:23:22] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [22:23:28] [DEBUG] mysql_escape_string - source: "tst123", connection: 1, max_len: 35 [22:23:28] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM user WHERE username='test' AND passwort=MD5('tst12", callback: "OnPasswordResponse", format: "i" [22:23:28] [DEBUG] CMySQLQuery::Execute[OnPasswordResponse] - starting query execution [22:23:28] [DEBUG] CMySQLQuery::Execute[OnPasswordResponse] - query was successfully executed within 0.681 milliseconds [22:23:28] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [22:23:28] [DEBUG] Calling callback "OnPasswordResponse".. [22:23:28] [DEBUG] cache_get_data - connection: 1 [22:23:28] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [22:23:30] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE user SET level='1',money='0',alevel='0',fraktion='0',rang", callback: "(null)", format: "(null)" [22:23:30] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM autos WHERE besitzer='0'", callback: "OnPlayerCarsLoad", format: "i" [22:23:30] [DEBUG] CMySQLQuery::Execute[] - starting query execution [22:23:30] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 0.378 milliseconds [22:23:30] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving [22:23:30] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - starting query execution [22:23:30] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - query was successfully executed within 0.62 milliseconds [22:23:30] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [22:23:30] [DEBUG] Calling callback "OnPlayerCarsLoad".. [22:23:30] [DEBUG] cache_get_data - connection: 1 [22:23:30] [DEBUG] cache_get_field_content_int - row: 0, field_name: "model", connection: 1 [22:23:30] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "model", data: "415" [22:23:30] [DEBUG] cache_get_field_content_int - row: 0, field_name: "besitzer", connection: 1 [22:23:30] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "besitzer", data: "0" [22:23:30] [DEBUG] cache_get_field_content_float - row: 0, field_name: "x", connection: 1 [22:23:30] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "x", data: "1280" [22:23:30] [DEBUG] cache_get_field_content_float - row: 0, field_name: "y", connection: 1 [22:23:30] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "y", data: "-1662" [22:23:30] [DEBUG] cache_get_field_content_float - row: 0, field_name: "z", connection: 1 [22:23:30] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "z", data: "19" [22:23:30] [DEBUG] cache_get_field_content_float - row: 0, field_name: "r", connection: 1 [22:23:30] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "r", data: "180" [22:23:30] [DEBUG] cache_get_field_content_int - row: 0, field_name: "id", connection: 1 [22:23:30] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "id", data: "130" [22:23:30] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
Login/Register:
Code
Alles anzeigenif(dialogid==DIALOG_LOGIN) { if(response) { new name[MAX_PLAYER_NAME],query[128],passwort[35]; GetPlayerName(playerid,name,sizeof(name)); if(strlen(inputtext)>0) { mysql_escape_string(inputtext,passwort,dbhandle); format(query,sizeof(query),"SELECT * FROM user WHERE username='%s' AND passwort=MD5('%s')",name,passwort); mysql_function_query(dbhandle,query,true,"OnPasswordResponse","i",playerid); } else { //Keine Eingabe SendClientMessage(playerid,grün,"Gibt bitte dein Passwort ein."); ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Gibt bitte dein Passwort ein:","Anmelden","Abbrechen"); } } else { Kick(playerid); } } if(dialogid==DIALOG_REGISTER) { if(response) { new name[MAX_PLAYER_NAME],query[128],passwort[35]; GetPlayerName(playerid,name,sizeof(name)); if(strlen(inputtext)>5) { //Registrierungsfunktion format(query,sizeof(query),"INSERT INTO user (username, passwort, level) VALUES ('%s', '%s', '1')",name,passwort); mysql_function_query(dbhandle,query,false,"","d",playerid); sInfo[playerid][level]=1; SetPlayerScore(playerid,sInfo[playerid][level]); } else { //Kleiner als 4 Zeichen SendClientMessage(playerid,helblau,"Dein Passwort muss mindestens 6 Zeichen lang sein."); ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Account Erstellung","Gebe bitte nun dein gewünschtes Passwort ein!","Erstellen","Abbrechen"); } } else { Kick(playerid); } }
-
Du hast beim DIALOG_REGISTER vor dem format das
mysql_escape_string(inputtext,passwort,dbhandle);
gelöscht, füge das wieder ein. -
So habe es nun so gemacht wie du @Jeffry
So sieht alles nun aus:
Dennoch kann ich mich nicht einloggen mit dem Passwort
Login/Register:
Code
Alles anzeigenif(dialogid==DIALOG_LOGIN) { if(response) { new name[MAX_PLAYER_NAME],query[128],passwort[35]; GetPlayerName(playerid,name,sizeof(name)); if(strlen(inputtext)>0) { mysql_escape_string(inputtext,passwort,dbhandle); format(query,sizeof(query),"SELECT * FROM user WHERE username='%s' AND passwort=MD5('%s')",name,passwort); mysql_function_query(dbhandle,query,true,"OnPasswordResponse","i",playerid); } else { //Keine Eingabe SendClientMessage(playerid,grün,"Gibt bitte dein Passwort ein."); ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Gibt bitte dein Passwort ein:","Anmelden","Abbrechen"); } } else { Kick(playerid); } } if(dialogid==DIALOG_REGISTER) { if(response) { new name[MAX_PLAYER_NAME],query[128],passwort[35]; GetPlayerName(playerid,name,sizeof(name)); if(strlen(inputtext)>5) { //Registrierungsfunktion mysql_escape_string(inputtext,passwort,dbhandle); format(query,sizeof(query),"INSERT INTO user (username, passwort, level) VALUES ('%s', '%s', '1')",name,passwort); mysql_function_query(dbhandle,query,false,"","d",playerid); sInfo[playerid][level]=1; SetPlayerScore(playerid,sInfo[playerid][level]); } else { //Kleiner als 4 Zeichen SendClientMessage(playerid,helblau,"Dein Passwort muss mindestens 6 Zeichen lang sein."); ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Account Erstellung","Gebe bitte nun dein gewünschtes Passwort ein!","Erstellen","Abbrechen"); } } else { Kick(playerid); } }
Mysql-log:(Beim Registrieren):
Code
Alles anzeigen[22:43:02] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [22:43:02] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [22:43:02] [DEBUG] CMySQLConnection::Connect - connection was successful [22:43:02] [DEBUG] CMySQLConnection::Connect - connection was successful [22:43:02] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [22:43:02] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [22:43:02] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [22:43:02] [DEBUG] CMySQLConnection::Connect - connection was successful [22:43:02] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [22:44:40] [DEBUG] mysql_tquery - connection: 1, query: "SELECT id FROM user WHERE username='test' ", callback: "OnUserCheck", format: "i" [22:44:40] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - starting query execution [22:44:40] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - query was successfully executed within 0.259 milliseconds [22:44:40] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [22:44:40] [DEBUG] Calling callback "OnUserCheck".. [22:44:40] [DEBUG] cache_get_data - connection: 1 [22:44:40] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [22:44:48] [DEBUG] mysql_escape_string - source: "test123", connection: 1, max_len: 35 [22:44:48] [DEBUG] mysql_tquery - connection: 1, query: "INSERT INTO user (username, passwort, level) VALUES ('test', 'te", callback: "(null)", format: "d" [22:44:48] [DEBUG] CMySQLQuery::Execute[] - starting query execution [22:44:48] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 0.721 milliseconds [22:44:48] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving [22:44:54] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM autos WHERE besitzer='0'", callback: "OnPlayerCarsLoad", format: "i" [22:44:54] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - starting query execution [22:44:54] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - query was successfully executed within 0.65 milliseconds [22:44:54] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [22:44:54] [DEBUG] Calling callback "OnPlayerCarsLoad".. [22:44:54] [DEBUG] cache_get_data - connection: 1 [22:44:54] [DEBUG] cache_get_field_content_int - row: 0, field_name: "model", connection: 1 [22:44:54] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "model", data: "415" [22:44:54] [DEBUG] cache_get_field_content_int - row: 0, field_name: "besitzer", connection: 1 [22:44:54] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "besitzer", data: "0" [22:44:54] [DEBUG] cache_get_field_content_float - row: 0, field_name: "x", connection: 1 [22:44:54] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "x", data: "1280" [22:44:54] [DEBUG] cache_get_field_content_float - row: 0, field_name: "y", connection: 1 [22:44:54] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "y", data: "-1662" [22:44:54] [DEBUG] cache_get_field_content_float - row: 0, field_name: "z", connection: 1 [22:44:54] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "z", data: "19" [22:44:54] [DEBUG] cache_get_field_content_float - row: 0, field_name: "r", connection: 1 [22:44:54] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "r", data: "180" [22:44:54] [DEBUG] cache_get_field_content_int - row: 0, field_name: "id", connection: 1 [22:44:54] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "id", data: "130" [22:44:54] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
Beim erneuten Login:Code
Alles anzeigen[22:46:22] [DEBUG] mysql_tquery - connection: 1, query: "SELECT id FROM user WHERE username='test' ", callback: "OnUserCheck", format: "i" [22:46:22] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - starting query execution [22:46:22] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - query was successfully executed within 0.318 milliseconds [22:46:22] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [22:46:22] [DEBUG] Calling callback "OnUserCheck".. [22:46:22] [DEBUG] cache_get_data - connection: 1 [22:46:22] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [22:46:32] [DEBUG] mysql_escape_string - source: "test123", connection: 1, max_len: 35 [22:46:32] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM user WHERE username='test' AND passwort=MD5('test1", callback: "OnPasswordResponse", format: "i" [22:46:32] [DEBUG] CMySQLQuery::Execute[OnPasswordResponse] - starting query execution [22:46:32] [DEBUG] CMySQLQuery::Execute[OnPasswordResponse] - query was successfully executed within 0.278 milliseconds [22:46:32] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [22:46:32] [DEBUG] Calling callback "OnPasswordResponse".. [22:46:32] [DEBUG] cache_get_data - connection: 1 [22:46:32] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
-
Jetzt hast du das MD5 da wieder stehen...
Nur beim DIALOG_LOGIN:
format(query,sizeof(query),"SELECT * FROM user WHERE username='%s' AND passwort=MD5('%s')",name,passwort);
Zu
format(query,sizeof(query),"SELECT * FROM user WHERE username='%s' AND passwort='%s'",name,passwort); -
Ich möchte es ja so haben das die Passworter verschlüsselt sind
So habe ich es jetzt:
Pawncode:Code: Login/Register
Alles anzeigenif(dialogid==DIALOG_LOGIN) { if(response) { new name[MAX_PLAYER_NAME],query[128],passwort[35]; GetPlayerName(playerid,name,sizeof(name)); if(strlen(inputtext)>0) { mysql_escape_string(inputtext,passwort,dbhandle); format(query,sizeof(query),"SELECT * FROM user WHERE username='%s' AND passwort='%s'",name,passwort); mysql_function_query(dbhandle,query,true,"OnPasswordResponse","i",playerid); } else { //Keine Eingabe SendClientMessage(playerid,grün,"Gibt bitte dein Passwort ein."); ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Gibt bitte dein Passwort ein:","Anmelden","Abbrechen"); } } else { Kick(playerid); } } if(dialogid==DIALOG_REGISTER) { if(response) { new name[MAX_PLAYER_NAME],query[128],passwort[35]; GetPlayerName(playerid,name,sizeof(name)); if(strlen(inputtext)>5) { //Registrierungsfunktion mysql_escape_string(inputtext,passwort,dbhandle); format(query,sizeof(query),"INSERT INTO user (username, passwort, level) VALUES ('%s', '%s', '1')",name,passwort); mysql_function_query(dbhandle,query,false,"","d",playerid); sInfo[playerid][level]=1; SetPlayerScore(playerid,sInfo[playerid][level]); } else { //Kleiner als 4 Zeichen SendClientMessage(playerid,helblau,"Dein Passwort muss mindestens 6 Zeichen lang sein."); ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Account Erstellung","Gebe bitte nun dein gewünschtes Passwort ein!","Erstellen","Abbrechen"); } } else { Kick(playerid); } }
MYSQL-Log beim Registerieren:
SQL: Mysql-Log Registrieren
Alles anzeigen[00:22:14] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [00:22:14] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [00:22:14] [DEBUG] CMySQLConnection::Connect - connection was successful [00:22:14] [DEBUG] CMySQLConnection::Connect - connection was successful [00:22:14] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [00:22:14] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [00:22:14] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [00:22:14] [DEBUG] CMySQLConnection::Connect - connection was successful [00:22:14] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [00:23:14] [DEBUG] mysql_tquery - connection: 1, query: "SELECT id FROM user WHERE username='Testspieler' ", callback: "OnUserCheck", format: "i" [00:23:14] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - starting query execution [00:23:14] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - query was successfully executed within 0.291 milliseconds [00:23:14] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [00:23:14] [DEBUG] Calling callback "OnUserCheck".. [00:23:14] [DEBUG] cache_get_data - connection: 1 [00:23:14] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [00:23:24] [DEBUG] mysql_escape_string - source: "spieler", connection: 1, max_len: 35 [00:23:24] [DEBUG] mysql_tquery - connection: 1, query: "INSERT INTO user (username, passwort, level) VALUES ('Testspiele", callback: "(null)", format: "d" [00:23:24] [DEBUG] CMySQLQuery::Execute[] - starting query execution [00:23:24] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 4.213 milliseconds [00:23:24] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving [00:23:28] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM autos WHERE besitzer='0'", callback: "OnPlayerCarsLoad", format: "i" [00:23:28] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - starting query execution [00:23:28] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - query was successfully executed within 0.72 milliseconds [00:23:28] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [00:23:28] [DEBUG] Calling callback "OnPlayerCarsLoad".. [00:23:28] [DEBUG] cache_get_data - connection: 1 [00:23:28] [DEBUG] cache_get_field_content_int - row: 0, field_name: "model", connection: 1 [00:23:28] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "model", data: "415" [00:23:28] [DEBUG] cache_get_field_content_int - row: 0, field_name: "besitzer", connection: 1 [00:23:28] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "besitzer", data: "0" [00:23:28] [DEBUG] cache_get_field_content_float - row: 0, field_name: "x", connection: 1 [00:23:28] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "x", data: "1280" [00:23:28] [DEBUG] cache_get_field_content_float - row: 0, field_name: "y", connection: 1 [00:23:28] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "y", data: "-1662" [00:23:28] [DEBUG] cache_get_field_content_float - row: 0, field_name: "z", connection: 1 [00:23:28] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "z", data: "19" [00:23:28] [DEBUG] cache_get_field_content_float - row: 0, field_name: "r", connection: 1 [00:23:28] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "r", data: "180" [00:23:28] [DEBUG] cache_get_field_content_int - row: 0, field_name: "id", connection: 1 [00:23:28] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "id", data: "130" [00:23:28] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
Neuer einlogg:
Code: Neuer einlogg
Alles anzeigen[00:26:03] [DEBUG] mysql_tquery - connection: 1, query: "SELECT id FROM user WHERE username='Testspieler' ", callback: "OnUserCheck", format: "i" [00:26:03] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - starting query execution [00:26:03] [DEBUG] CMySQLQuery::Execute[OnUserCheck] - query was successfully executed within 0.278 milliseconds [00:26:03] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [00:26:03] [DEBUG] Calling callback "OnUserCheck".. [00:26:03] [DEBUG] cache_get_data - connection: 1 [00:26:03] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [00:26:10] [DEBUG] mysql_escape_string - source: "spieler", connection: 1, max_len: 35 [00:26:10] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM user WHERE username='Testspieler' AND passwort='sp", callback: "OnPasswordResponse", format: "i" [00:26:10] [DEBUG] CMySQLQuery::Execute[OnPasswordResponse] - starting query execution [00:26:10] [DEBUG] CMySQLQuery::Execute[OnPasswordResponse] - query was successfully executed within 0.317 milliseconds [00:26:10] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [00:26:10] [DEBUG] Calling callback "OnPasswordResponse".. [00:26:10] [DEBUG] cache_get_data - connection: 1 [00:26:10] [DEBUG] cache_get_field_content_int - row: 0, field_name: "id", connection: 1 [00:26:10] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "id", data: "52" [00:26:10] [DEBUG] cache_get_field_content_int - row: 0, field_name: "level", connection: 1 [00:26:10] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "level", data: "1" [00:26:10] [DEBUG] cache_get_field_content_int - row: 0, field_name: "money", connection: 1 [00:26:10] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "money", data: "0" [00:26:10] [DEBUG] cache_get_field_content_int - row: 0, field_name: "alevel", connection: 1 [00:26:10] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "alevel", data: "7" [00:26:10] [DEBUG] cache_get_field_content_int - row: 0, field_name: "fraktion", connection: 1 [00:26:10] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "fraktion", data: "0" [00:26:10] [DEBUG] cache_get_field_content_int - row: 0, field_name: "rang", connection: 1 [00:26:10] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "rang", data: "0" [00:26:10] [DEBUG] cache_get_field_content_int - row: 0, field_name: "spawnchange", connection: 1 [00:26:10] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "spawnchange", data: "0" [00:26:10] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM autos WHERE besitzer='52'", callback: "OnPlayerCarsLoad", format: "i" [00:26:10] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [00:26:10] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - starting query execution [00:26:10] [DEBUG] CMySQLQuery::Execute[OnPlayerCarsLoad] - query was successfully executed within 0.460 milliseconds [00:26:10] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [00:26:10] [DEBUG] Calling callback "OnPlayerCarsLoad".. [00:26:10] [DEBUG] cache_get_data - connection: 1 [00:26:10] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [00:26:27] [DEBUG] mysql_tquery - connection: 1, query: "INSERT INTO autos(besitzer,model,x,y,z,r) VALUES('52','411','346", callback: "carSavedToDB", format: "i" [00:26:27] [DEBUG] CMySQLQuery::Execute[carSavedToDB] - starting query execution [00:26:27] [DEBUG] CMySQLQuery::Execute[carSavedToDB] - query was successfully executed within 1.806 milliseconds [00:26:27] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [00:26:27] [DEBUG] Calling callback "carSavedToDB".. [00:26:27] [DEBUG] cache_insert_id - connection: 1 [00:26:27] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
-
Laut Log funktioniert das ja jetzt so.
Dann versuche es jetzt bitte so:
if(dialogid==DIALOG_LOGIN)
{
if(response)
{
new name[MAX_PLAYER_NAME],query[256],passwort[35];
GetPlayerName(playerid,name,sizeof(name));
if(strlen(inputtext)>0)
{
mysql_escape_string(inputtext,passwort,dbhandle);
format(query,sizeof(query),"SELECT * FROM user WHERE username='%s' AND passwort=MD5('%s')",name,passwort);
mysql_function_query(dbhandle,query,true,"OnPasswordResponse","i",playerid);
}
else
{
//Keine Eingabe
SendClientMessage(playerid,grün,"Gibt bitte dein Passwort ein.");
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Gibt bitte dein Passwort ein:","Anmelden","Abbrechen");
}
}
else
{
Kick(playerid);
}
}
if(dialogid==DIALOG_REGISTER)
{
if(response)
{
new name[MAX_PLAYER_NAME],query[256],passwort[35];
GetPlayerName(playerid,name,sizeof(name));
if(strlen(inputtext)>5)
{
//Registrierungsfunktion
mysql_escape_string(inputtext,passwort,dbhandle);
format(query,sizeof(query),"INSERT INTO user (username, passwort, level) VALUES ('%s', MD5('%s'), '1')",name,passwort);
mysql_function_query(dbhandle,query,false,"","d",playerid);
sInfo[playerid][level]=1;
SetPlayerScore(playerid,sInfo[playerid][level]);
}
else
{
//Kleiner als 4 Zeichen
SendClientMessage(playerid,helblau,"Dein Passwort muss mindestens 6 Zeichen lang sein.");
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Account Erstellung","Gebe bitte nun dein gewünschtes Passwort ein!","Erstellen","Abbrechen");
}
}
else
{
Kick(playerid);
}
}Kopiere und ersetze den Code bitte genau so.
-
-
breadfish.de
Hat das Thema geschlossen.