Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public onSocketReceiveData(Socket:id, remote_clientid, data[], data_len)
- {
- new type[32], response[128];
- sscanf(data, "p<|>s[32]s[128]", type, response);
- printf("data : %s", data);
- if (!strcmp(type, "login")) {
- printf("Login : %s", response);
- new pname[MAX_PLAYER_NAME], ppassword[32];
- sscanf(response, "p<,>s[32]s[32]", pname, ppassword);
- new query[256], hashed_pass[65];
- printf("Login : %s %s", pname, ppassword);
- SHA256_PassHash(ppassword, "rgame", hashed_pass, 65);
- mysql_format(g_SQL, query, sizeof query, "SELECT * FROM accounts where username = '%e' and password = '%s' LIMIT 1", pname, hashed_pass);
- inline CheckAccount_Result()
- {
- if(cache_num_rows())
- {
- socket_sendto_remote_client(id, remote_clientid, "login_ok|Encrypt String");
- printf("Login success : %s %s", pname, ppassword);
- }
- else {
- socket_sendto_remote_client(id, remote_clientid, "login_failed|failed");
- printf("Login failed : %s %s", pname, ppassword);
- }
- }
- mysql_tquery_inline(g_SQL, query, using inline CheckAccount_Result, "");
- }
- else if(!strcmp(type, "connect"))
- {
- new pname[MAX_PLAYER_NAME], ptime;
- sscanf(response, "p<,>s[32]i", pname, ptime);
- printf("Connect : %s %d", pname, ptime);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement