<?php
echo '<h1 class="p_space">' . $lang['my_posts'] . '</h1>';
$query = "SELECT id, author FROM discussions WHERE author = " . (int)$_SESSION['id'] . "";
$result = mysql_query($query) OR die(mysql_error());
if(!$result) {
echo '' . $lang['no_posts_written'] . '' . mysql_error();
}else{
if(intval(mysql_num_rows($result)) == 0) {
echo $lang['no_posts_written'];
}else{
$allposts = mysql_query("SELECT id, author FROM discussions WHERE author = " . (int)$_SESSION['id'] . "");
$totalposts = intval(mysql_num_rows($allposts));
if($totalposts > 0) {
echo '<p class="success">' . $lang['you_have_already'] . ' ' . $totalposts . ' ' . $lang['posts_written'] . '</p>';
}else{
echo '<p class="false">' . $lang['no_posts_written'] . '</p>';
}
$path = "management.php?site=myposts";
$query = mysql_query("SELECT id, author FROM discussions WHERE author = " . (int)$_SESSION['id'] . "");
$total = mysql_num_rows($query);
$allsites = ceil($total / $entries);
include('framework/functions/browse.php');
$inquiry = "SELECT
discussions.id,
discussions.content,
discussions.date,
discussions.topic,
discussions.author,
topics.id,
topics.subject,
members.id,
members.name
FROM
discussions
LEFT JOIN
topics
ON
discussions.topic = topics.id
LEFT JOIN
members
ON
discussions.author = members.id
WHERE
discussions.author = '" . (int)$_SESSION['id'] . "'
ORDER BY
discussions.id DESC
LIMIT
$start,$entries";
$result = mysql_query($inquiry) OR die(mysql_error());
$total = intval(mysql_num_rows($result));
if($result) {
echo '<p><small><strong>' . $total . '</strong> ' . $lang['posts_on_site'] . '</small></p>';
while($row = mysql_fetch_assoc($result)) {
include_once('framework/filter.php');
include_once('framework/functions/badwords.php');
echo '<table width="100%" class="tables">
<tr>
<td width="15%"><span class="blue_span">' . $lang['topics'] . '</span></td>
<td width="85%"><a href="topic.php?id=' . (int)$row['id'] . '">' . htmlentities($row['subject'], ENT_QUOTES) . ' </a></td>
</tr>
<tr>
<td width="15%"><span class="blue_span">' . $lang['date'] . '</span></td>
<td width="85%">' . date('d.m.Y - H:i', strtotime($row['date'])) . '</td>
</tr>
<tr>
<td width="15%" valign="top"><span class="blue_span">' . $lang['one_post'] . '</span></td>
<td width="85%" valign="top">' . mysql_filter(filter_html(badwords(stripslashes(nl2br($row['content']))))) . '</td>
</tr>
</table>';
echo '<div id="search_line"></div>';
}
echo '<span class="pages">Seite ' . $page . ' von ' . $allsites . '</span>';
echo $link_string;
}}}
?>