diff --git a/botthread.c b/botthread.c index 089ccf6..73dbc1c 100644 --- a/botthread.c +++ b/botthread.c @@ -33,21 +33,26 @@ tmp = strtok_r(cmdData," ",&tok_last); tmp2 = strtok_r(NULL,"\n",&tok_last); if ((tmp != 0x0) & (tmp2 != 0x0)) { - sprintf(output,"SELECT username FROM users WHERE username = '%s' AND password = '%s'",tmp,tmp2); + sprintf(output,"SELECT username,gid FROM users WHERE username = '%s' AND password = '%s'",tmp,tmp2); res = dbQuery(output); if (res == 0x0) { sSendData(userConnection,"MSG:TUveD:STATUS:Sorry I'm Having MySQL Troubles.\n"); } else if (mysql_num_rows(res) == 1) { sSendData(userConnection,"MSG:TUveD:%s:You have successfully logged in.\n",chan); - sprintf(output,"EMOTE:%s:STATUS:Is now an Evil Overlord!\n",userConnection->userInfo.username); - tuveSendAllInUsersChans(userConnection,output); - userConnection->userInfo.modes[USER_OVERLORD] = 1; + row = mysql_fetch_row(res); + sprintf(output,"INSERT INTO active (gid,uid,userid) VALUES(%s,%s,%lld)",row[1],row[2],userConnection->userInfo.uid); + dbQuery(output); + if (atoi(row[1]) == 1) { + sprintf(output,"EMOTE:%s:STATUS:Is now an Evil Overlord!\n",userConnection->userInfo.username); + tuveSendAllInUsersChans(userConnection,output); + userConnection->userInfo.modes[USER_OVERLORD] = 1; + } } else { - sSendData(userConnection,"MSG:TUveD:%s:You have failed login. Your connection will now be terminated!\n",chan); - tuveDelUserChans(userConnection,"This Mother Fucker Tried To Login With The Wrong Password!"); - userConnection->userInfo.status = -1; + sSendData(userConnection,"MSG:TUveD:%s:You have failed login.\n",chan); + //tuveDelUserChans(userConnection,"This Mother Fucker Tried To Login With The Wrong Password!"); + //userConnection->userInfo.status = -1; } } } /* End login */