//we've got a valid auth now...
MYSQL_RES *res;
MYSQL_ROW row, row2;
- int userid;
+ int userid, adminid;
+ printf_mysql_query("SELECT `user_id` FROM `users` WHERE `user_user` = '%s'", escape_string(user->auth));
+ res = mysql_use();
+ if ((row = mysql_fetch_row(res)) != NULL)
+ adminid = atoi(row[0]);
+ else
+ adminid = 0;
printf_mysql_query("SELECT `user_id` FROM `users` WHERE `user_user` = '%s'", escape_string(auth));
res = mysql_use();
if ((row = mysql_fetch_row(res)) != NULL) {
res = mysql_use();
if ((row = mysql_fetch_row(res)) != NULL) {
chanid = atoi(row[0]);
+ 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`) VALUES ('%s')", escape_string(channel));
+ 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);
}
struct ClientSocket *bot;