File size: 857B
<?php
include 'inc/db.php';
include 'inc/1.php';
echo "<div class='t2'>Поиск в форуме</div>";
if (!$_POST['text']){
echo "<div class='input'><form action='?' method='POST'>Искать: <input type='text' name='text'><br><input type='submit' value='Искать'></form></div>";
include_once 'inc/foot.php';
exit;
}
$text=mysql_real_escape_string($_POST['text']);
$q=mysql_query("SELECT `name`, `id`, `msg`, `user`, `time` FROM `forum` ORDER BY `time` DESC");
$b=1;
while ($f=mysql_fetch_assoc($q)){
if (preg_match("/$text/i", $f['name']) || preg_match("/$text/i", $f['msg'])){
$p=($b%2);
echo "<div class='p$p'>";
$name=out($f['name']);
$time=vremja($f['time']);
$ank=gus($f['user']);
echo "<a href='theme.php?id=$f[id]'>$name</a> ($ank[name])<br>[$time]";
echo "</div>";
$b++;
}
}
include_once 'inc/foot.php';
?>