/* cmd_global_register.c - NeonServ v5.3
- * Copyright (C) 2011 Philipp Kreil (pk910)
+ * Copyright (C) 2011-2012 Philipp Kreil (pk910)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
struct UserNode *cuser = getUserByNick(argv[1]);
if(!cuser) {
cuser = createTempUser(argv[1]);
+ if(!cuser) {
+ reply(getTextBot(), user, "NS_USER_UNKNOWN", argv[1]);
+ return;
+ }
cuser->flags |= USERFLAG_ISTMPUSER;
}
if(cuser->flags & USERFLAG_ISAUTHED) {
userid = atoi(row[0]);
} else {
printf_mysql_query("INSERT INTO `users` (`user_user`) VALUES ('%s')", escape_string(auth));
- userid = (int) mysql_insert_id(mysql_conn);
+ userid = (int) mysql_insert_id(get_mysql_conn());
}
}
if(client->botid)
printf_mysql_query("UPDATE `channels` SET `channel_registered` = UNIX_TIMESTAMP(), `channel_registrator` = '%d' WHERE `channel_id` = '%d'", adminid, chanid);
} else {
printf_mysql_query("INSERT INTO `channels` (`channel_name`, `channel_registered`, `channel_registrator`) VALUES ('%s', UNIX_TIMESTAMP(), '%d')", escape_string(channel), adminid);
- chanid = (int) mysql_insert_id(mysql_conn);
+ chanid = (int) mysql_insert_id(get_mysql_conn());
}
struct ClientSocket *bot;
for(bot = getBots(SOCKET_FLAG_READY, NULL); bot; bot = getBots(SOCKET_FLAG_READY, bot)) {