Размер файла: 1.97Kb
<?php
session_start();
include('wap_common.php');
wapheader();
$viewtopic = $HTTP_GET_VARS['topic'];
start_card("id","Thread View");
$sql="SELECT a1.post_id, a1.topic_id as topic, a1.forum_id as forum, a1.poster_id as poster, a1.post_time as time, a2.post_id, a2.post_subject, a2.post_text AS text FROM " . $TABLE_PREFIX . "posts a1, " . $TABLE_PREFIX . "posts_text a2 WHERE a1.topic_id ='" . $viewtopic . "' AND a1.post_id = a2.post_id LIMIT " . $NUM_THREAD_ITEMS;
$result = $db->sql_query($sql);
while($row = $db->sql_fetchrow($result)){
$forum=$row['forum'];
$sql2="SELECT username, user_id FROM " . $TABLE_PREFIX . "users WHERE user_id = '" . $row['poster'] . "'";
$result2= $db->sql_query($sql2);
$row2 = $db->sql_fetchrow($result2);
$sql3 = "SELECT topic_views as views FROM " . $TABLE_PREFIX . "topics WHERE topic_id = '" . $row['topic'] ."'";
$result3 = $db->sql_query($sql3);
$row3 = $db->sql_fetchrow($result3);
$numviews=0;
$numviews = ++$row3['views'];
$sql3= "UPDATE " . $TABLE_PREFIX . "topics SET topic_views = " . $numviews . " WHERE topic_id = '" . $topic . "'";
if(!$db->sql_query($sql3)) die("Error with database");
print("<p><img src=\"arrow.wbmp\" alt=\"image\" />");
print($row['text'] . "</p>");
print("<p>Posted By " . $row2['username'] . " On " . date("d-m-y @ H:i:s", $row['time']) . "</p>");
}
print("<do type=\"accept\" label=\"Post Reply\">");
print("<go href=\"wap_post.php\" method=\"post\">");
print("<postfield name=\"topic\" value=\"$viewtopic\" />");
print("<postfield name=\"forum\" value=\"$forum\" />");
print("<postfield name=\"op\" value=\"reply\" />");
print("</go>");
print("</do>");
//print("<p><a href=\"wap_post.php?topic=" . $viewtopic . "&forum=" . $forum . "&op=reply\">Post Reply</a></p>");
//print("<p><a href=\"wap_view_posts.php?topic=" . $row['topic_id'] . "\">" . $row['topic_title'] . "</a></p>");
end_card();
print("</wml>");
?>