<?php
$title="Мафия";
require"../system/config.php";
require"../system/func.php";
require"../system/head.php";
require"../system/error.php";
echo"<div class='sep'><div class=\"i\">$title</div> ";
$act=prov($_GET['act']);
switch($act){
default:
$us=mysql_query("SELECT * FROM mafusers WHERE id_user = '$user[id_user]' LIMIT 1");
$usr=mysql_fetch_assoc($us);
$id = $usr['id_user'];
for ($i=1;$i<=3;$i++)
{
$rmaf = "maf".$i;
$tm = time()-300;
mysql_query("select * from $rmaf WHERE id > '".$tm."' group by usid order by id desc");
$sm[$i] = mysql_affected_rows();
}
if ($user['login'] == $usr['user'])
{
echo "<center><img src='maf.gif'></center>";
echo "<b>Клоны в мафии запрещены!</b><br/>\n";
echo "<a href=\"rules.php\">Правила игры</a><br/>\n";
echo "<a href=\"top10.php\">Авторитеты<br/></a>\n";
echo "-------<br/>\n";
echo "<b>Куда направимся?</b><br/>\n";
echo "<a href=\"maf.php?rm=1\">Русская мафия($sm[1])</a><br/>\n";
echo "<a href=\"maf.php?rm=2\">Мафия Сан-Франциско($sm[2])</a><br/>\n";
echo "<a href=\"maf.php?rm=3\">Японская мафия($sm[3])<br/></a>\n";
echo "-------<br/>\n";
echo "<a href=\"change.php\">Настройки игры</a><br/>\n";
echo "-------<br/>\n";
}
else
{
echo "<form method='post' action='index.php?act=add'>";
echo "Кличка (потом изменить нельзя):";
echo "<input type='text' name='login' value='$user[login]' /><br/>";
echo "<input type='submit' name='ok' value='Дальше' /><br/>";
echo "</form>";
}
echo "";
break;
case'add':
$us=mysql_query("SELECT * FROM mafusers WHERE id_user = '$user[id_user]' LIMIT 1");
$usr=mysql_fetch_assoc($us);
$id = $usr['id_user'];
$usr=mysql_fetch_array(mysql_query("SELECT * FROM mafusers WHERE id_user = '$user[id_user]' AND user = '$user[login]' LIMIT 1"));
if ($user['login']!=$usr['user'])
{
$kl=mysql_real_escape_string($_POST['login']);
$nk=trim($user['login']);
$st='Пользователь';
$id=$user['id_user'];
$tim=date();
$rec="INSERT INTO `mafusers` (`user`, `id_user`, `name`, `posts`, `status`, `avr`, `max`,
`level`, `creditsingame`, `credits`, `ignor`, `kik`, `whokik`, `whykik`, `user_ip`, `user_soft`,
`inv`, `say`, `img`, `translit`, `visit`, `onl`, `room`, `date`) VALUES
('$nk', '$id', '$kl', '', '$st', '0', '10', '0', '', '', '', '0', '', '', '', '', '', '1', '', '0', '', '', '', '$tim')";
if (mysql_query($rec))
{
header("location: index.php");
}
else echo mysql_error();
}
else{
}
break;
}
require"../system/foot.php";
?>