File size: 3.59Kb
<?
header('Cache-Control: no-store, no-cache, must-revalidate');
header ("Content-type:text/vnd.wap.wml; charset=utf-8");
$ref=rand(10000,1000000);
require("inc.php");
$link = @mysql_pconnect ($MySQL_Hostname, $MySQL_Username, $MySQL_Password)
or die ("<wml><card id=\"error\" title=\"error\">
<do type=\"prev\" label=\"Back\"><prev/></do><p align=\"center\"><small>Can not connect to MySQL</small></p>
</card></wml>");
@mysql_select_db($MySQLDatabasename) or die ("<wml><card id=\"error\" title=\"error\">
<do type=\"prev\" label=\"Back\"><prev/></do><p align=\"center\"><small>error select the database...</small></p>
</card></wml>");
$result = @mysql_query ("Select pass,user,fsize from users where id='".$id."' LIMIT 1;");
if (mysql_affected_rows() == 0) {
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml12.dtd\">";
echo "<wml>";
echo "<card id=\"error\" title=\"Ошибка\" ontimer=\"index.php?ref=$ref\"><timer value=\"15\"/>";
echo "<p align=\"center\"><small>";
echo "Юзер не найден!";
echo "</small></p></card></wml>";
exit;
}
$row = mysql_fetch_array ($result);
if ($ps !== $row["pass"]){
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml12.dtd\">";
echo "<wml>";
echo "<card id=\"error\" title=\"Ошибка\" ontimer=\"index.php?ref=$ref\"><timer value=\"15\"/>";
echo "<p align=\"center\"><small>";
echo "Не верное сочетание ника и пароля!";
echo "</small></p></card></wml>";
exit;
}
$cm = mysql_query ("select count(id) as num from news WHERE 1;");
$cmc = mysql_fetch_array($cm);
$news = $cmc["num"];
if($row['fsize'] == "small") { $fsize1 = "<small>"; $fsize2 = "</small>"; }
elseif($row['fsize'] == "big") { $fsize1 = "<big>"; $fsize2 = "</big>"; }
else { $fsize1 = ""; $fsize2 = ""; }
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml12.dtd\">\n";
echo "<wml>\n";
echo "<card title=\"Новости чата\">\n";
echo "<p align=\"left\">\n";
//echo $fsize1;
if(empty($page)) $page=0;
$query = @mysql_query("select * from `news`");
$num_of_rows=mysql_num_rows($query);
$total_mat_number=$num_of_rows;
$mat_per_page=5;
$total_pages=ceil($total_mat_number/$mat_per_page);
$print = mysql_query("select * from `news` order by id desc limit ".$page.",".($mat_per_page).";");
if (mysql_affected_rows() == 0) {
echo "Новостей нет(<br/>";
}
while($arr = @mysql_fetch_array($print)) {
echo "<b>".$arr['date']."</b><br/> ".$arr['content']."<br/>";
echo "<u>Разместил(а):</u><b> ".$arr['login']."</b><br/>";
echo "-----<br/>";}
for ($v=0; $v<$total_pages; $v++){
$page_number=$v*$mat_per_page;
if ($page_number!=$page) {
print "<a href=\"news.php?id=$id&ps=$ps&ref=$ref&page=$page_number\">[стр.".($v+1)."]</a><br/>";
} else {
print "<b>[стр.".($v+1)."]</b><br/>";
}
}
echo "<a href=\"enter.php?id=$id&ps=$ps&ref=$ref\">Прихожая</a><br/>";
//echo $fsize2;
?>
</p>
</card>
</wml>
<?
mysql_close($link);
?>