Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AccountInfo MySQLGunzDB::GetAccountInfo (const std::string& user, const std::string& password)
- {
- AccountInfo accountInfo;
- try
- {
- mysqlpp::Query query = gunzconn.query();
- query << "SELECT aid,ugradeid,pgradeid FROM account WHERE username=" << mysqlpp::quote << user.c_str() << " AND password=md5(" << mysqlpp::quote << password.c_str() << ") LIMIT 1";
- mysqlpp::UseQueryResult res = query.use();
- mysqlpp::Row row = res.fetch_row();
- if (!row)
- {
- accountInfo.AccountId = -1;
- return accountInfo;
- }
- accountInfo.AccountId = row["aid"];
- accountInfo.AccountAccess = row["ugradeid"];
- accountInfo.AccountPremium = row["ugradeid"];
- accountInfo.AccountName = user;
- logger->info(boost::format("Account Id: %1%. Access: %2%. Premium: %3%. Name: %4%.") % accountInfo.AccountId % (boost::uint32_t)accountInfo.AccountAccess % (boost::uint32_t)accountInfo.AccountPremium % accountInfo.AccountName);
- return accountInfo;
- }
- catch (mysqlpp::Exception& ex)
- {
- logger->error (boost::format("Error getting account information: %1%") % ex.what());
- }
- accountInfo.AccountId = -1;
- return accountInfo;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement