game/modules_data/location/a_clanreg.php

291 lines
13 KiB
PHP

<?php
if (!defined('GAME')) {
die();
}
if ($u->room['file'] != 'a_clanreg') {
return;
}
function alignc($al)
{
if ($al == 1) {
$value = "(ñâåòëûé)";
} elseif ($al == 3) {
$value = "(òåìíûé)";
} elseif ($al == 7) {
$value = "(íåéòðàëüíûé)";
} else {
$value = "(ñåðûé)";
}
return $value;
}
$lzv = mysql_fetch_array(
mysql_query('SELECT * FROM `_clan` WHERE `uid` = "' . $u->info['id'] . '" AND `admin_time` = "0" LIMIT 1')
);
/*Çàÿâêà íà âñòóïëåíèå*/
if (isset($_POST['clan_enter'])) {
mysql_query('UPDATE `users` SET `clan_zv`= "' . $_POST['clan_enter'] . '" WHERE `id` = "' . $u->info['id'] . '" ');
}
/* Ðåãèñòðàöèÿ êëàíà */
if (isset($_POST['clan_name'])) {
$tr_money2 = 0;
if ($_POST['clan_align'] == 1) {
$tr_money2 = 50;
$_POST['clan_align'] = 1;
} elseif ($_POST['clan_align'] == 3) {
$tr_money2 = 50;
$_POST['clan_align'] = 3;
} elseif ($_POST['clan_align'] == 7) {
$tr_money2 = 50;
$_POST['clan_align'] = 7;
}
$clan_name = substr(htmlspecialchars($_POST['clan_name'], null, 'cp1251'), 0, 30);
$cnt = mysql_fetch_array(
mysql_query('SELECT * FROM `clan` WHERE `name` = "' . mysql_real_escape_string($clan_name) . '" LIMIT 1')
);
$upload = new Uploader($clan_name);
$upload->setMaxFileSize(.3);
$upload->setDimensions(24, 15);
$upload->setExtentions('gif');
$upload->setSavePath('clan_prw/');
if (isset($cnt['id'])) {
$re = 'Êëàí ñ íàçâàíèåì &quot;' . $cnt['name'] . '&quot; óæå çàðåãèñòðèðîâàí.';
} elseif (isset($lzv['id'])) {
$re = 'Âû óæå ïîäàëè çàÿâêó íà ðåãèñòðàöèþ êëàíà, îæèäàéòå îòâåòà îò àäìèíèñòðàöèè';
} elseif ($tr_money2 > $u->info['money2']) {
$re = 'Ó âàñ íå õâàòàåò äåíåã, òðåáóåòñÿ ' . $tr_money2 . 'åêð.';
} elseif ($u->info['clan'] > 0) {
$re = 'Âû ñîñòîèòå â îäíîì èç êëàíîâ, òðåáóåòñÿ ïîêèíóòü åãî';
} elseif ($u->info['align'] > 0) {
$re = 'Ïåðñîíàæè ñî ñêëîííîñòüþ íå ìîãóò ñîçäàâàòü êëàí, èçáàâüòåñü îò íå¸';
} else {
/* çàíîñèì äàííûå â áàçó */
if (!preg_match("/^[-a-zA-Z0-9]+$/", $clan_name)) {
$re = 'Â íàçâàíèè êëàíà ïðèñóòñòâóþò çàïðåùåííûå ñèìâîëû.';
} elseif ($file = $upload->saveimg()) {
if ($tr_money2 < 0) {
$tr_money2 = 0;
}
$u->info['money2'] -= $tr_money2;
mysql_query(
'UPDATE `users` SET `money2` = "' . $u->info['money2'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
);
mysql_query(
'INSERT INTO `_clan` (`uid`,`time`,`city`,`name`,`name2`,`site`,`img1`,`img2`,`info`,`money`,`align`) VALUES (
"' . $u->info['id'] . '","' . time() . '",
"' . $u->info['city'] . '",
"' . mysql_real_escape_string(htmlspecialchars($_POST['clan_name'], null, 'cp1251')) . '",
"' . mysql_real_escape_string(htmlspecialchars($_POST['clan_name'], null, 'cp1251')) . '",
"' . mysql_real_escape_string(htmlspecialchars($_POST['clan_site'], null, 'cp1251')) . '",
"' . mysql_real_escape_string(htmlspecialchars($file[1], null, 'cp1251')) . '",
"",
"",
"' . $tr_money2 . '",
"' . mysql_real_escape_string(htmlspecialchars($_POST['clan_align'], null, 'cp1251')) . '"
)'
);
$lzv = [
'id' => mysql_insert_id(),
'name' => htmlspecialchars($_POST['clan_name'], null, 'cp1251'),
'time' => time(),
];
$re = 'Âû óñïåøíî ïîäàëè çàÿâêó íà ðåãèñòðàöèþ êëàíà &quot;' . htmlspecialchars(
$_POST['clan_name'], null, 'cp1251'
) . '&quot;. (' . $tr_money2 . 'åêð.)';
} else {
$re = 'Ìàëåíüêèé çíà÷îê: ' . Uploader::$error;
}
}
}
?>
<style>
body {
background-color: #E2E2E2;
background-image: url(https://img.new-combats.com/i/misc/showitems/dungeon.jpg);
background-repeat: no-repeat;
background-position: top right;
}
</style>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<div style="padding-left:0px;" align="center">
<blockquote>
<h3>Çàÿâêà íà ðåãèñòðàöèþ êëàíà</h3>
</blockquote>
</div>
<?php
if ($re != '') {
echo '<font style="float:left" color="red"><b>' . $re . '</b></font>';
}
?>
</td>
<td width="200">
<div align="right">
<table cellspacing="0" cellpadding="0">
<tr>
<td width="100%">&nbsp;</td>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr align="right" valign="top">
<td><!-- -->
<?php echo $goLis; ?>
<!-- -->
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td nowrap="nowrap">
<table width="100%" border="0" cellpadding="0" cellspacing="1"
bgcolor="#DEDEDE">
<tr>
<td bgcolor="#D3D3D3"><img
src="https://img.new-combats.com/i/move/links.gif"
width="9" height="7"/></td>
<td bgcolor="#D3D3D3" nowrap="nowrap"><a
href="javascript:void(0)" id="greyText"
class="menutop"
onClick="location='main.php?loc=1.180.0.11&rnd=<?php echo $code; ?>';"
title="<?php thisInfRm(
'1.180.0.11', 1
); ?>">Ñòðàøèëêèíà óëèöà</a></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
<?php
if ($u->info['clan'] > 0) {
$clan = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $u->info['clan'] . '" LIMIT 1'));
?>
Âû óæå ñîñòîèòå â êëàíå <b><?= $clan['name'] ?></b> è íå ìîæåòå ïîäàòü çàÿâêó íà ðåãèñòðàöèþ íîâîãî êëàíà.<br><br>
<fieldset style="line-height:1.5em;border-color:#fff;">
<legend><h3>Êëàíîâûå âîéíû</h3></legend>
<?php
if ($u->info['clan_prava'] == 'glava') {
echo 'Íåò íè îäíîé âîéíû, íî âû ìîæåòå îáüÿâèòü å¸!';
} else {
echo 'Íåò íè îäíîé âîéíû, íî âàø ãëàâà êëàíà ìîæåò îáüÿâèòü å¸!';
}
?>
</fieldset>
<?php } else { ?>
<table width="100%" border="0" cellspacing="0" cellpadding="10">
<tr>
<td><p>Òðåáîâàíèÿ ê çíà÷êó: ðàçìåð (Øõ â ïèêñåëÿõ) 24õ15, ãðàôè÷åñêèé òèï GIF, ðàçìåð äî 30êá.</p>
<p>
Ñòîèìîñòü ðåãèñòðàöèè êëàíîâ:<br>
<img src="https://img.new-combats.com/i/align/align7.gif" width="12" height="15"> íåéòðàëüíûé - 50
åêð.<br>
<img src="https://img.new-combats.com/i/align/align1.gif" width="12" height="15"> ñâåòëûé - 50
åêð.<br>
<img src="https://img.new-combats.com/i/align/align3.gif" width="12" height="15"> ò¸ìíûé - 50
åêð.<br>
</p>
<p>
Çàÿâêà íà ðåãèñòðàöèþ ïîäàåò áóäóùèé ãëàâà êëàíà, ó êîòîðîãî äîëæíà áûòü ïðè ñåáå íåîáõîäèìàÿ ñóììà.
</p>
</td>
</tr>
<tr>
<td>
<form action="main.php?go_psh=1" method="post" enctype="multipart/form-data" name="form1" id="form1">
<fieldset style="line-height:1.5em;border-color:#fff;">
<legend><h3>Çàÿâêà íà ðåãèñòðàöèþ êëàíà</h3>
</legend>
<?php if (!isset($lzv['id'])) { ?>
Íàçâàíèå êëàíà (òîëüêî àíãëèéñêèå áóêâû èëè öèôðû, îäíî ñëîâî):
<input class="rd4" name="clan_name" type="text" value="" size="50" maxlength="50"/>
<br/>
Êëàí ñàéò (íåîáÿçàòåëüíî Ïðèìåð https://new-combats.com/):
<input class="rd4" name="clan_site" type="text" value="https://new-combats.com/" size="50"
maxlength="50"/>
<br/>
Çíà÷îê
<input type="file" name="clan_img1" id="clan_img1"/>
<br/>
Ñêëîííîñòü êëàíà
<select class="rd4" name="clan_align">
<option value="7">íåéòðàëüíûé (50 åêð.)</option>
<option value="3">òåìíûé (50 åêð.)</option>
<option value="1">ñâåòëûé (50 åêð.)</option>
</select>
<br/>
<input type="submit" name="button" id="button" class="btn" value="Ïîäàòü çàÿâêó"/>
<?php } else { ?>
<?= date(
'd.m.Y H:i', $lzv['time']
) ?> &nbsp; &nbsp; Âû óæå ïîäàëè çàÿâêó íà ðåãèñòðàöèþ êëàíà &quot;
<b><?= $lzv['name'] ?></b>&quot;. Îæèäàéòå îòâåòà îò Àäìèíèñòðàöèè.
<?php } ?>
</fieldset>
</form>
</td>
<td>
<form action="main.php?go_psh=1" method="post" enctype="multipart/form-data" name="form2" id="form1">
<fieldset style="line-height:1.5em;border-color:#fff;">
<legend><h3>Çàÿâêà íà âñòóïëåíèå â êëàí</h3> <!--ÒÓÒ--></legend>
<?php
$clnt = mysql_fetch_array(
mysql_query('SELECT `clan_zv` FROM `users` WHERE `id` = "' . $u->info['id'] . '" LIMIT 1')
);
if ($clnt['clan_zv'] != 0) {
$clnn = mysql_fetch_array(
mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $clnt['clan_zv'] . '" LIMIT 1')
);
echo 'Âû ïîäàëè çàÿâêó â êëàí ' . $clnn['name'] . ' ' . alignc(
$clnn['align']
) . ' ' . $tmpc . '<br>';
echo 'Îæèäàéòå ðàññìîòðåíèÿ âàøåé çàÿâêè. Åñëè ðåøåíèÿ äîëãî íåò ïðîñòî âûáèðèòå èç ñïèñêà äðóãîé êëàí.<br>';
}
?>
Âûáèðèòå êëàí:
<br>
<select class="rd4" name="clan_enter">
<?php
$sp = mysql_query('SELECT * FROM `clan` WHERE 1 ORDER BY `clan`.`exp` DESC');
while ($pl = mysql_fetch_array($sp)) {
echo '<option name="' . $pl['id'] . '" value="' . $pl['id'] . '">' . $pl['name'] . ' ' . alignc(
$pl['align']
) . '</option>';
}
?>
</select>
<br/><br/>
<input type="submit" name="button2" id="button" class="btn" value="Ïîäàòü çàÿâêó"/>
</fieldset>
</form>
</td>
</tr>
</table>
<p>Ïðèìå÷àíèå:</p>
<p>
Ïðè ïîäà÷å çàÿâêè ñ âàñ ñíèìàåòñÿ ñóììà íåîáõîäèìàÿ äëÿ ðåãèñòðàöèè êëàíà.<br>
 ñëó÷àè îòêàçà â ðåãèñòðàöèè êëàíà (ïî ëþáîé ïðè÷èíå), åâðîêðåäèòû âîçâðàùàþòñÿ ïåðñîíàæó.<br>
Àäìèíèñòðàöèÿ âïðàâå îòêàçàòü â ðåãèñòðàöèè áåç îáúÿñíåíèÿ ïðè÷èí.<br>
<b>Ïðè ðåãèñòðàöèè êëàíà, ãëàâà êëàíà â òå÷åíèè 60 äíåé íå èìååò ïðàâî ïåðåäàâàòü ñâî¸ ãëàâåíñòâî äðóãîìó
èãðîêó.</b>
</p>
<?php } ?>