What code to show guestbook in head.php like mchat for 6.2.0
What code to show guestbook in head.php like mchat for 6.2.0
First make file like showchat.php in incfiles folder and input code
<?
{
global $realtime;
global $user_id;
$req = mysql_query("SELECT `guest`.*, `users`.`name`, `users`.`rights`, `users`.`lastdate`, `users`.`sex`, `users`.`status`, `users`.`datereg`, `users`.`ip` , `users`.`browser` FROM `guest` LEFT JOIN `users` ON `guest`.`user_id` = `users`.`id` WHERE `guest`.`adm`='0' ORDER BY `time` DESC LIMIT 2;");
while ($res = mysql_fetch_array($req)) {
echo ceil(ceil($i / 2) - ($i / 2)) == 0 ? '<div class="list1">' : '<div class="list2">';
global $set_user, $realtime, $user_id, $admp, $home;
$ontime = $res['lastdate'] + 300;
if (time() > $ontime) {
echo '<span style="color:red;"><b>•</b></span> ';
} else {
echo '<span style="color:#00c700;"><b>•</b></span> ';
}
if (!empty($user_id) && ($user_id != $res['user_id'])) {
echo '<a href="' . $set['homeurl'] . '/users/profile.php?user=' . $res['user_id'] . '"><b>'.$res['name'] .'</b></a>';
} else {
echo '<b>' . $res['name'] . '</b> ';
}
$ontime = $res['lastdate'] + 300;
if (time() > $ontime) {
echo ': ';
} else {
echo ': ';
}
if (!empty($res['status']))
$text = htmlentities($res['text'], ENT_QUOTES, 'UTF-8');
$text = bbcode::tags($text);
$text = str_replace("\r\n", " ", $text);
if ($res['user_id']) {
$text = functions::checkout(mb_substr(wordwrap($res['text'], 30, " ", true), 0, 100), 1, 1);
if ($set_user['smileys'])
$text = functions::smileys($text, $res['rights'] >= 1 ? 1 : 0);
}
echo $text;
if (mb_strlen($res['text']) > 100)
echo ' ... <a href="' . $set['homeurl'] . '/guestbook/">(More)</a>';
echo '</div>';
++$i;
}
}
?>require('showchat.php');