<?
require "conf.php";
$conn=mysql_connect(my_host, my_user, my_password);
mysql_select_db(my_db, $conn);
header("Content-Type: text/vnd.wap.wml");
header("Cache-Control: no-cache");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>
<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
if(isset($HTTP_GET_VARS['UIN']))
{
$UIN=$HTTP_GET_VARS['UIN'];
}
else
{
$UIN="Guest";
}
$UINmd5=$UIN;
if(isset($HTTP_GET_VARS['pass']))
{
$pass=$HTTP_GET_VARS['pass'];
}
else
{
$pass="Guest";
}
$sql=("select `pass` from `index` where id='$UIN'");
$res=mysql_query($sql);
$row=mysql_fetch_object($res);
$themes=10;
if ($pass!=$row->pass)
{
$UIN="Guest";
}
$sql1=("select `id` from `rating` where room='1'");
$result1=mysql_query($sql1);
$n1=0;
$n2=0;
$n3=0;
$n4=0;
$n6=0;
$n7=0;
$n8=0;
$n9=0;
$n10=0;
$n11=0;
$n12=0;
$n13=0;
$n14=0;
while ($row1=mysql_fetch_object($result1))
{
$n1=$n1+1;
}
$sql2=("select `id` from `rating` where room='2'");
$result2=mysql_query($sql2);
while ($row2=mysql_fetch_object($result2))
{
$n2=$n2+1;
}
$sql3=("select `id` from `rating` where room='3'");
$result3=mysql_query($sql3);
while ($row3=mysql_fetch_object($result3))
{
$n3=$n3+1;
}
$sql4=("select `id` from `rating` where room='4'");
$result4=mysql_query($sql4);
while ($row4=mysql_fetch_object($result4))
{
$n4=$n4+1;
}
$sql5=("select `id` from `rating` where room='5'");
$result5=mysql_query($sql5);
while ($row5=mysql_fetch_object($result5))
{
$n5=$n5+1;
}
$sql6=("select `id` from `rating` where room='6'");
$result6=mysql_query($sql6);
while ($row6=mysql_fetch_object($result6))
{
$n6=$n6+1;
}
$sql7="select id from rating where room='7'";
$result7=mysql_query($sql7);
while ($row7=mysql_fetch_object($result7))
{
$n7=$n7+1;
}
if ($room==1)
{
$nameroom="O Ceти";
$n=$n1;
}
if ($room==2)
{
$nameroom="Texничecкий Paздeл";
$n=$n2;
}
if ($room==3)
{
$nameroom="Kyплю/Пpoдaм";
$n=$n3;
}
if ($room==4)
{
$nameroom="Peклaмa";
$n=$n4;
}
if ($room==5)
{
$nameroom="Boпpocы и Пpeдлoжeния";
$n=$n5;
}
if ($room==7)
{
$nameroom="Oбщeниe";
$n=$n7;
}
if ($room > 7)
{
echo "<wml>
<card ontimer=\"index.php?UIN=$UINmd5&pass=$pass\" title=\"xxx\">
<timer value=\"10\"/>
<p>
Taкoй кoмнaты нe cyщecтвyeт
</p>
</card>
</wml>";
}
else
{
echo "<wml>
<card id=\"forum\" title=\"$nameroom($n)\">
<p>";
?>
<?
if ($UIN!="Guest")
{
echo "
<a href=\"addtem.php?UIN=$UINmd5&pass=$pass&room=$room\">Добавить тему</a><br/><br/>";
}
if(isset($HTTP_GET_VARS['next_row']))
{
$next_row=$HTTP_GET_VARS['next_row'];
}
else
{
$next_row=0;
}
$sql=("select * from `rating` where room='$room' order by id desc limit $next_row, $themes ");
$result=mysql_query($sql);
while ($row5=mysql_fetch_object($result))
{
$sql3=("select * from `topic` where id='$row5->ident'");
$result3=mysql_query($sql3);
$row3=mysql_fetch_object($result3);
$id=$row3->id;
$prosm=$row3->prosm;
$name=$row3->name;
if ($setting_trans==1)
{
$message=$row3->message;
$message=ereg_replace("h","?", $message);
$message=ereg_replace("a","?", $message);
$message=ereg_replace("b","?", $message);
$message=ereg_replace("v","?", $message);
$message=ereg_replace("g","?", $message);
$message=ereg_replace("d","?", $message);
$message=ereg_replace("e","?", $message);
$message=ereg_replace("z","?", $message);
$message=ereg_replace("?","?", $message);
$message=ereg_replace("i","?", $message);
$message=ereg_replace("j","?", $message);
$message=ereg_replace("k","?", $message);
$message=ereg_replace("l","?", $message);
$message=ereg_replace("m","?", $message);
$message=ereg_replace("n","?", $message);
$message=ereg_replace("o","?", $message);
$message=ereg_replace("p","?", $message);
$message=ereg_replace("r","?", $message);
$message=ereg_replace("s","?", $message);
$message=ereg_replace("t","?", $message);
$message=ereg_replace("u","?", $message);
$message=ereg_replace("f","?", $message);
$message=ereg_replace("c","?", $message);
$message=ereg_replace("?","?", $message);
$message=ereg_replace("?","?", $message);
$message=ereg_replace("y?","?", $message);
$message=ereg_replace("x","?", $message);
$message=ereg_replace("y?","?", $message);
$message=ereg_replace("y?","?", $message);
$message=ereg_replace("q","?", $message);
$message=ereg_replace("?","?", $message);
$message=ereg_replace("$$","z", $message);
$message=ereg_replace("Q","?", $message);
$message=ereg_replace("H","?", $message);
$message=ereg_replace("A","?", $message);
$message=ereg_replace("B","?", $message);
$message=ereg_replace("V","?", $message);
$message=ereg_replace("G","?", $message);
$message=ereg_replace("D","?", $message);
$message=ereg_replace("E","?", $message);
$message=ereg_replace("Z","?", $message);
$message=ereg_replace("?","?", $message);
$message=ereg_replace("I","?", $message);
$message=ereg_replace("J","?", $message);
$message=ereg_replace("K","?", $message);
$message=ereg_replace("L","?", $message);
$message=ereg_replace("M","?", $message);
$message=ereg_replace("N","?", $message);
$message=ereg_replace("O","?", $message);
$message=ereg_replace("P","?", $message);
$message=ereg_replace("R","?", $message);
$message=ereg_replace("S","?", $message);
$message=ereg_replace("T","?", $message);
$message=ereg_replace("U","?", $message);
$message=ereg_replace("F","?", $message);
$message=ereg_replace("C","?", $message);
$message=ereg_replace("?","?", $message);
$message=ereg_replace("?","?", $message);
$message=ereg_replace("Y?","?", $message);
$message=ereg_replace("X","?", $message);
$message=ereg_replace("Y?","?", $message);
$message=ereg_replace("Y?","?", $message);
$message=ereg_replace("?","?", $message);
$message=str_replace("$", " backs", $message);
$message=htmlspecialchars($message);
$message=eregi_replace("$$","xx", $message);
$row3->message=$message;
}
$sql2=("select `id` from `forum` where topic='$id'");
$result2=mysql_query($sql2);
$n=0;
while ($row2=mysql_fetch_object($result2))
{
$n=$n+1;
}
$message=$row3->message;
$row3->message=$message;
$row3->message=translate($row3->message);
$sql22=("select `site` from `index` where id='$UIN'");
$adres=strtok($row3->date," ");
$site="http://$adres";
echo "<a href=\"readmess.php?UIN=$UINmd5&pass=$pass&topic=$id&user=$site&room=$room\">";
echo "";
echo "
$row3->date [$n/$prosm]</a><br/>
$row3->message<br/>
<br/>";
}
echo "
<a href=\"forum.php?UIN=$UINmd5&pass=$pass&next_row=".($next_row+10)."&room=$room\" >
$xДальше</a><br/>";
if ($next_row > 0){
echo"
<a href=\"forum.php?UIN=$UINmd5&pass=$pass&next_row=".($next_row-10)."&room=$room\">
Haзaд</a><br/>";}
echo "<a href=\"index.php?UIN=$UINmd5&pass=$pass\">Фopyм</a><br/>
<a href=\"../apanel.php?id=$UINmd5&pass=$pass\">B Пaнeль</a><br/>";
$dpoint=".";
$dpoint2=":";
$time2 =date(d);
$time2 .=$dpoint;
$time2 .=date(m);
$time2 .=$dpoint;
$time2 .=date(y);
$time2.= " - ";
$time2 .=date(H);
$time2.=$dpoint2;
$time2.=date(i);
$time2.=$dpoint2;
$time2 .=date(s);
echo "</p>
</card>
</wml>";
}
?>