Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
79 lines
2.0 KiB
C++
79 lines
2.0 KiB
C++
#include "stdafx.h"
|
|
|
|
#include "AuthDB.h"
|
|
#include "../Parser/ServerInfo.h"
|
|
#include <Log/ServerLog.h>
|
|
#include <Network/Protocol/Ryl_AdminMgrProtocol.h>
|
|
|
|
|
|
unsigned long CAuthDB::GetUIDFromAccount(char* szAccountName)
|
|
{
|
|
const char* szNation = CServerInfo::GetInstance().GetValue("NATION");
|
|
if (NULL == szNation)
|
|
{
|
|
ERRLOG0(g_Log, "국가 타입을 얻는데 실패했습니다.");
|
|
return 0;
|
|
}
|
|
|
|
char szQuery[MAX_QUERY_LENGTH];
|
|
if (0 == strcmp("KOREA", szNation))
|
|
{
|
|
_snprintf(szQuery, MAX_QUERY_LENGTH,
|
|
"SELECT uid, strID FROM TblRylUserInfo WHERE strID = '%s'", szAccountName);
|
|
}
|
|
else
|
|
{
|
|
_snprintf(szQuery, MAX_QUERY_LENGTH,
|
|
"EXEC dbo.sp_SearchUserAccount NULL, '%s'", szAccountName);
|
|
}
|
|
|
|
unsigned long dwUID = 0;
|
|
|
|
const int nBufferSize = sizeof(int) + PktAdminMgr::MAX_ACCOUNT;
|
|
char szBuffer[nBufferSize];
|
|
ZeroMemory(szBuffer, nBufferSize);
|
|
|
|
if (false == ExecuteQueryGetData(szQuery, szBuffer))
|
|
{
|
|
ERRLOG2(g_Log, "UID를 얻는데 실패했습니다. Account: %s, Err: %s", szAccountName, GetErrorString());
|
|
return 0;
|
|
}
|
|
|
|
memcpy(&dwUID, szBuffer, sizeof(unsigned int));
|
|
return dwUID;
|
|
}
|
|
|
|
bool CAuthDB::GetAccountFromUID(unsigned long dwUID, void* lpGetData)
|
|
{
|
|
const char* szNation = CServerInfo::GetInstance().GetValue("NATION");
|
|
if (NULL == szNation)
|
|
{
|
|
ERRLOG0(g_Log, "국가 타입을 얻는데 실패했습니다.");
|
|
return 0;
|
|
}
|
|
|
|
char szQuery[MAX_QUERY_LENGTH];
|
|
if (0 == strcmp("KOREA", szNation))
|
|
{
|
|
_snprintf(szQuery, MAX_QUERY_LENGTH,
|
|
"SELECT uid, strID FROM TblRylUserInfo WHERE uid = %u", dwUID);
|
|
}
|
|
else
|
|
{
|
|
_snprintf(szQuery, MAX_QUERY_LENGTH,
|
|
"EXEC dbo.sp_SearchUserAccount %u, NULL", dwUID);
|
|
}
|
|
|
|
const int nBufferSize = sizeof(int) + PktAdminMgr::MAX_ACCOUNT;
|
|
char szBuffer[nBufferSize];
|
|
ZeroMemory(szBuffer, nBufferSize);
|
|
|
|
if (true == ExecuteQueryGetData(szQuery, szBuffer))
|
|
{
|
|
memcpy(lpGetData, szBuffer + sizeof(int), PktAdminMgr::MAX_ACCOUNT);
|
|
return true;
|
|
}
|
|
|
|
ERRLOG2(g_Log, "Account를 얻는데 실패했습니다. UID: %u, Err: %s", dwUID, GetErrorString());
|
|
return false;
|
|
} |