query('SELECT * FROM `reg_klan` LIMIT 1');
$cl_reg_curr = db::c()->query('SELECT * FROM `reg_klan` LIMIT 1')->fetch_assoc();
// Clan adder : add clan
if ($_POST['clan_reg'] == 'add_clan') {
$ser_cl_rights = array();
$ser_cl_rights[$cl_reg_curr['owner']][0] = 1;
$ser_cl_rights[$cl_reg_curr['owner']][1] = 1;
$cl_rights = serialize($ser_cl_rights);
// $add_clan = mysql_query('
// INSERT INTO `clans` (`short`, `name`, `descr`, `glava`, `vozm`, `align`, `homepage`)
// VALUES ("'.$cl_reg_curr['abr'].'", "'.$cl_reg_curr['name'].'", "'.$cl_reg_curr['descr'].'",
// "'.$cl_reg_curr['owner'].'", "'.$cl_rights.'", "'.$cl_reg_curr['align'].'", "'.$cl_reg_curr['http'].'")
// ');
$add_clan = db::c()->query('INSERT INTO `clans` (`short`, `name`, `descr`, `glava`, `vozm`, `align`) VALUES ("?s","?s","?s","?s","?s",?i)',
$cl_reg_curr['abbr'], $cl_reg_curr['name'], $cl_reg_curr['descr'], $cl_reg_curr['owner'], $cl_rights, $cl_reg_curr['align']);
if ($add_clan) {
echo("
Заявка на клан " . $cl_reg_curr['name'] . " подтверждена успешно!
");
// $cl_reg_tmp=mysql_fetch_assoc(mysql_query("select * from clans where name='".$cl_reg_curr['name']."'"));
// mysql_query("delete from reg_klan where id='".$cl_reg_curr['id']."'");
// $clan_msg_rec_q = $db->query('SELECT FROM `users` WHERE `id` = ?i', $cl_reg_curr['owner']);
// $clan_msg_rec=mysql_fetch_assoc(mysql_query("SELECT * FROM USERS where id='".$cl_reg_curr['owner']."'"));
// mysql_query("update users set align='".$cl_reg_curr['align']."',klan='".$cl_reg_tmp['id']."',status='
Глава клана' where id='".$cl_reg_curr['owner']."'");
db::c()->query('DELETE FROM `reg_klan` WHERE `id` = ?i', $cl_reg_curr['id']);
$cl_reg_tmp = db::c()->query('SELECT `id` FROM `clans` WHERE `name` = "?s"', $cl_reg_curr['name'])->fetch_assoc();
$clan_msg_rec = db::c()->query('SELECT FROM `users` WHERE `id` = ?i', $cl_reg_curr['owner'])->fetch_assoc();
db::c()->query('UPDATE `users` SET `align` = ?i, `klan` = ?i, `status` = "?s" WHERE `id` = ?i', $cl_reg_curr['align'], $cl_reg_tmp['id'], "
Глава клана", $cl_reg_curr['owner']);
$_POST['grn'] = $clan_msg_rec['login'];
$_POST['gr'] = "Ваша заявка на создание клана " . $cl_reg_curr['name'] . " принята!";
} else echo("Ошибка подтверждения регистрации!");
} elseif ($_POST['clan_reg'] == 'not_add_clan') { /* Clan ader : don't add clan*/
echo("
Заявка на клан " . $cl_reg_curr['name'] . " отклонена!
");
// mysql_query("delete from reg_klan where id='".$cl_reg_curr['id']."'");
// $clan_msg_rec=mysql_fetch_assoc(mysql_query("SELECT * FROM USERS where id='".$cl_reg_curr['owner']."'"));
db::c()->query('DELETE FROM `reg_klan` WHERE `id` = ?i', $cl_reg_curr['id']);
// $clan_msg_rec_q = $db->query('SELECT FROM `users` WHERE `id` = ?i', $cl_reg_curr['owner']);
$clan_msg_rec = db::c()->query('SELECT FROM `users` WHERE `id` = ?i', $cl_reg_curr['owner'])->fetch_assoc();
$_POST['grn'] = $clan_msg_rec['login'];
$_POST['gr'] = "Ваша заявка на создание клана " . $cl_reg_curr['name'] . " отклонена!";
// Moneyback
$clan_moneyback = 1200;
// switch($cl_reg_curr['align']) {
// case 2:$clan_moneyback=1200;break;
// case 3:$clan_moneyback=1200;break;
// case 6:$clan_moneyback=1200;break;
// };
// $temp=mysql_query("UPDATE `users` set `money` = money+'$clan_moneyback' WHERE `id` = '".$cl_reg_curr['owner']."' LIMIT 1;");
$temp = db::c()->query('UPDATE `users` SET `money` = `money` + ?i WHERE `id` = ?i LIMIT 1', $clan_moneyback, $cl_reg_curr['owner']);
// if(!($temp)) echo(mysql_error()); /*В теории сейчас в класс вшит обработчик ошибок.*/
}
// $clan_q_base=mysql_query("select * from reg_klan");
// $clan_q=mysql_num_rows($clan_q_base);
$clan_q = db::c()->query('SELECT * FROM `reg_klan`')->getNumRows();
// Clan adder
if ($clan_q) {
echo("
Заявок в очереди на рассмотрение: $clan_q
");
// $clan_msg_rec=mysql_fetch_assoc(mysql_query("SELECT * FROM USERS where id='".$cl_reg_curr['owner']."'"));
// if ($_POST['clan_reg']) mysql_query("delete from reg_klan where id='".$cl_reg_curr['id']."'");
$clan_msg_rec = db::c()->query('SELECT * FROM `users` WHERE `id` = ?i', $cl_reg_curr['owner'])->fetch_assoc();
if ($_POST['clan_reg']) db::c()->query('DELETE FROM `reg_klan` WHERE `id` = ?i', $cl_reg_curr['id']);
echo("
Текущая заявка:
");
echo "
Прислал | Название | Краткое название | Сайт | Направленность | Описание | Дата/Время подачи |
";
echo "{$cl_reg_curr['owner']} aka {$clan_msg_rec['login']} | {$cl_reg_curr['name']} | {$cl_reg_curr['abr']} | {$cl_reg_curr['http']} | {$cl_reg_curr['align']} | {$cl_reg_curr['descr']} | {$cl_reg_curr['date']} |
";
echo "
";
echo("
Подтвердить
Отменить
");
} else echo("Заявки на регистрацию кланов отсутствуют");
?>