<?
ob_start();
require'../sys/head.php';
require'../sys/conf.php';
require'../sys/sess.php';
require'../otsev.php';
if(!empty($_GET['make'])){$make = $_GET['make'];} else {$make= '';}
switch($make){
default:
$kl=mysql_fetch_array(mysql_query("SELECT id,name,logo FROM klan WHERE id='$re0[klan]'"));
echo'<a href="klan.php?der='.$key.'">Клан</a><br/>';
echo"<b>$kl[name]</b><br/>";echo"<b>$kl[logo]</b><br/>";
echo'<a href="klan4at.php?der='.$key.'">(Обновить)</a><br/>';
echo"<b>$_GET[f]</b><br/>";
echo'<FORM ACTION="klan4at.php?ch=1&der='.$key.'" METHOD="POST">';?>
Сообщение<br/>
<input type="text" name="mess" value="" size="25" ><br/>
<input type="submit"   value="Написать">
</FORM><br/>
<?
$sum = $re0[n4]; // число записей на странице
$result = mysql_query("SELECT count(id) as a from klan4at where klan='$re0[klan]'"); 
$arr = mysql_fetch_row($result);$rec = $arr[0];
if(!isset($_GET['str'])){$str = 0;}else
{$str = $_GET['str'];}$start = $str * $sum;
$r = mysql_query("SELECT * FROM klan4at where klan='$re0[klan]' order by `id` desc LIMIT $start, $sum");
$n = mysql_num_rows($r);for ($i = 0; $i < $n; $i++){
////////////////вывод
$m= mysql_fetch_array($r);	$a=$m["data"];$b=$m["strana"];$c=$m["text"];$b1=$b;$d=$m['id'];
if($re0[sklan]>0){$del="<a href=klan4at.php?make=33&w=$d&der=$key>[<b>-</b>]</a>";}else{$del="";}

echo "($a) ";



echo"$b";
echo'<a href="klan4at.php?der='.$key.'&send='.$b1.'&make=6">|&gt;&gt;</a><br/>';
echo"$c$del<br/>----<br/></b>";
}
if ($str > 0){$p = $str - 1;
echo "<a href=klan4at.php?der=$key&str=$p><b> <<< </b></a>";}
$str++;if($start + $n < $rec)echo"<b>||</b>";
echo "<a href=klan4at.php?der=$key&str=$str><b> >>> </b></a>"; 
$ob_str=round($rec/10);
echo"<br/>Страниц:(<b>$ob_str</b>)<br/>";
echo"<br/>Вы на:(<b>$str</b>)стр.<br/>";
echo'<FORM ACTION="klan4at.php?der='.$key.'&h=66" METHOD="POST">';?>
<br/>
<input type="text" maxlength="5" size="5" name="str" value="" >
<input type="submit"  value="Перейти">
</FORM><br/><?

$ch = $_GET['ch'];

if($ch=='1'){
$a=$_POST['mess'];

$b=$re1[strana];


$c=date("H");
$d=date("i");

////////////////////////////////////////////////


$b1 =$a;
/////////////////////////////////////////////////
if(!empty($b1)){
include'../sys/smiles.php';
$b3 =$b1;
$b3=smile($b3);
if(eregi("({CENS})",$b3)){
$b3="Рекламко";
}else{}
mysql_query("INSERT INTO klan4at (data,klan,strana,text) VALUES ('$c:$d','$re0[klan]','$b','$b3')");
header("Location: klan4at.php?der=$key");
}else{
header("Location: klan4at.php?der=$key");
}}else{}
if($_GET['h']==66){
$str=$_POST['str']-1;
header("Location: klan4at.php?der=$key&str=$str");
}else{}
break;
case 33:
qw("DELETE FROM klan4at WHERE id='$_GET[w]'");
header("Location: klan4at.php?der=$key");
break;
case 6:
$tem=$_GET['tema'];
$a=$_GET['send'];
echo'<FORM ACTION="klan4at.php?der='.$key.'&ch=1&a='.$a.'" METHOD="POST">';?>
Сообщение<br/> <INPUT TYPE='text' NAME='mess'VALUE="<?=$a;?>," size="35"><br>
<INPUT TYPE='submit'VALUE='Написать'>
</FORM><br/><?
echo'<a href="klan4at.php?der='.$key.'">ЧАТ Клана</a><br/>';
break;
}
echo'<br/><a href="../game.php?der='.$key.'">В страну</a><br/>';
echo'</div><div class="knews"><a href="../out.php?der='.$key.'">Выход</a><br/>';
require'../sys/foot.php';
?>