<?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="blog.php">Blog</a></li>
<li><a href="blog_search.php" class="actual"><?php echo $lang['blog_search']; ?></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
echo '<h1>' . $lang['article_search'] . '</h1>';
if(isset($_POST['submit'])) {
$error = FALSE;
if(empty($_POST['search'])) {
$error = TRUE;
echo '<p class="false">' . $lang['enter_search_term'] . '</p>
<p><a href="blog_search.php">' . $lang['goto_search'] . '</a></p>';
}
if(!$error) {
$text = htmlentities($_POST['search']);
$query = "SELECT
*
FROM
blog
WHERE
title LIKE '%$text%' OR post LIKE '%$text%' OR author LIKE '%$text%'
ORDER BY
blog_id DESC
LIMIT
10";
$result = mysql_query($query) OR die(mysql_error());
if($result) {
echo '<p><small><u>' . intval(mysql_num_rows($result)) . '</u> ' . $lang['matches_found'] . ':</small></p>';
while($row = mysql_fetch_assoc($result)) {
$view = 'blog_result.php?id=' . (int)$row['blog_id'];
echo '<span class="blue">ID:</span> ' . (int)$row['blog_id'] . '<br>
<span class="blue">' . $lang['author'] . ':</span> ' . htmlentities($row['author'], ENT_QUOTES) . '<br>
<span class="blue">' . $lang['title'] . ':</span> <a href="' . $view . '">' . htmlentities($row['title'], ENT_QUOTES) . '</a><br>
<span class="blue">' . $lang['on'] . ':</span> <em>' . date('d.m.Y - H:i', strtotime($row['date'])) . '</em><br>';
}
echo '<p><a href="blog_search.php">' . $lang['search_again'] . '?</a></p>';
}else{
echo '<p>' . $lang['no_matches'] . ' - <a href="blog_search.php">' . $lang['search_again'] . '?</a></p>';
}
}
}else{
echo '<form id="search" action="blog_search.php?search" method="post">
<input type="text" name="search" size="30" class="textfields">
<input type="submit" name="submit" value="' . $lang['search'] . '" alt="' . $lang['search'] . '" class="buttons"><br>
<small>' . $lang['enter_search_term'] . '</small>
</form>';
$inquiry = mysql_query("SELECT blog_id FROM blog");
$total = intval(mysql_num_rows($inquiry));
$inquiry2 = mysql_query("SELECT com_id FROM comments");
$total2 = intval(mysql_num_rows($inquiry2));
echo '<p class="right"><u>' . (int)$total . ' ' . $lang['article_with'] . ' ' . (int)$total2 . ' ' . $lang['article_comments'] . '</u></p>';
}
?>
<?php require('style/layout/footer.php'); ?>