|
@@ -238,6 +238,39 @@ int fwdb::CheckAuth(std::string strusername, std::string strpassword ,std::strin
|
|
|
return nrtn;
|
|
|
}
|
|
|
|
|
|
+int fwdb::QueryUser(std::string strusername,std::string & strvalidtime, std::string &strerrorcode)
|
|
|
+{
|
|
|
+ mmutexdb.lock();
|
|
|
+ QSqlQuery query(mdatabase);
|
|
|
+ char strsen[1000];
|
|
|
+
|
|
|
+
|
|
|
+ snprintf(strsen,1000,"select * from accountdata where((accountdata.username = \"%s\"))",
|
|
|
+ strusername.data());
|
|
|
+ query.exec(strsen);
|
|
|
+ if(!query.exec(strsen))
|
|
|
+ {
|
|
|
+ std::cout<<query.lastError().text().toLatin1().data()<<std::endl;
|
|
|
+ strerrorcode = "SQL Error.";
|
|
|
+ mmutexdb.unlock();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if(query.next())
|
|
|
+ {
|
|
|
+ strerrorcode = "User Exist.";
|
|
|
+ strvalidtime = query.value("uservalidtime").toString().toStdString();
|
|
|
+ mmutexdb.unlock();
|
|
|
+ return 1;
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ strerrorcode = "No this user.";
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
int fwdb::AddUser(std::string strusername, std::string strpassword, std::string &strerrorcode)
|
|
|
{
|
|
|
// int nrtn = 0;
|