<?php require('style/layout/header.php'); ?>
<div class="content_left">
<ul id="breadcrumbs">
<li><a href="index.php"><?php echo $lang['main_page']; ?></a></li>
<li><a href="myprofile.php"><?php echo $lang['user_area']; ?></a></li>
<li><a href="myposts.php" class="actual"><?php echo $lang['my_posts']; ?></a></li>
</ul>
</div>
<div class="content_right"><form method="post" id="search" action="search.php?search">
<input type="text" name="search" placeholder="<?php echo $lang['enter_search_term']; ?>..." class="searchfield">
<input type="hidden" name="submit" value="<?php echo $lang['search']; ?>" alt="<?php echo $lang['search']; ?>">
</form>
</div>
<div class="clear"></div>
<div id="headline"> </div>
<?php
if(!isset($_SESSION['signed_in'])) {
echo '<p class="false">' . $lang['only_for_registered'] . '</p>
<p>' . $lang['you_have_to'] . ' <a href="signin.php">' . $lang['small_signin'] . '</a>. ' . $lang['not_yet'] . ' <a href="signup.php">' . $lang['registered'] . '</a>?</p>';
}else{
echo '<h1>' . $lang['my_posts'] . '</h1>';
include_once('functions/bbcode.php');
include_once('functions/badwords.php');
$query = "SELECT post_id, post_by FROM posts WHERE post_by = " . (int)$_SESSION['user_id'] . "";
$result = mysql_query($query) OR die(mysql_error());
if(!$result) {
echo '<p class="false">' . $lang['no_available_posts'] . '</p>' . mysql_error();
}else{
if(intval(mysql_num_rows($result)) == 0) {
echo '<p class="false">' . $lang['no_available_posts'] . '</p>';
}else{
$allposts = mysql_query("SELECT post_id, post_by FROM posts WHERE post_by = " . (int)$_SESSION['user_id'] . "") OR die(mysql_error());
$totalposts = intval(mysql_num_rows($allposts));
if($totalposts > 0) {
echo '<p class="success">' . $lang['you_have_alread'] . ' ' . (int)$totalposts . ' ' . $lang['posts_created'] . '</p>';
}else{
echo '<p class="false">' . $lang['no_available_posts'] . '</p>';
}
$count = mysql_query("SELECT post_id, post_by FROM posts WHERE post_by = " . (int)$_SESSION['user_id'] . "");
include('framework/navigation.php');
$inquiry = "SELECT
posts.post_id,
posts.post_content,
posts.post_date,
posts.post_topic,
posts.post_by,
topics.topic_id,
topics.topic_subject,
topics.topic_cat,
categories.cat_id,
categories.cat_name,
users.user_id,
users.user_name
FROM
posts
LEFT JOIN
topics
ON
posts.post_topic = topics.topic_id
LEFT JOIN
categories
ON
topics.topic_cat = categories.cat_id
LEFT JOIN
users
ON
posts.post_by = users.user_id
WHERE
post_by = '" . (int)$_SESSION['user_id'] . "'
ORDER BY
post_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>' . (int)$total . '</strong> ' . $lang['posts_per_page'] . '</small></p>';
echo '<table width="100%" class="tables">
<tr>';
while($row = mysql_fetch_assoc($result)) {
echo '<tr>
<td width="15%"><strong>' . $lang['one_category'] . '</strong></td>
<td width="85%"><a href="category.php?id=' . (int)$row['cat_id'] . '">' . htmlentities($row['cat_name'], ENT_QUOTES) . ' </a></td>
</tr>
<tr>
<td width="15%"><strong>' . $lang['topic'] . '</strong></td>
<td width="85%"><a href="topic.php?id=' . (int)$row['topic_id'] . '">' . htmlentities($row['topic_subject'], ENT_QUOTES) . ' </a></td>
</tr>
<tr>
<td width="15%"><strong>' . $lang['on'] . '</strong></td>
<td width="85%">' . date('d.m.Y - H:i', strtotime($row['post_date'])) . '</td>
</tr>
<tr>
<td width="15%" valign="top"><strong>' . $lang['one_post'] . '</strong></td>
<td width="85%" valign="top">' . bbcode(badwords(stripslashes(nl2br($row['post_content'])))) . '</td>
</tr>';
}
echo '</table>
<div class="clear_blog"></div>';
echo '<div id="navigation">
<span class="pages">' . $lang['page'] . ' ' . $page . ' ' . $lang['of'] . ' ' . $allsites . '</span>';
echo $link_string;
echo '</div>
<div class="clear_navi"></div>';
}}}}
?>
<?php require('style/layout/footer.php'); ?>