Problem on johncms shoutbox/guestbook

1.07K
.
Please i need to add shoutbox to my mainmenu.php or how can i display the guestboox layout to mainmenu.php please help
.
JIN-K
try this
// form 

echo ' <div class="phdr"><div class="icon-chat"></div><a href="/guestbook/index.php">Shout box</a>';
if ($rights >= 3) {
echo '  <a href="/guestbook/index.php?act=clean">[Del]</a>';
}
echo '</div>';

if($user_id){
echo '<div class="gmenu">';
$refer = base64_encode($_SERVER['REQUEST_URI']);
$token = mt_rand(1000, 100000);
$_SESSION['token'] = $token;
echo '<div class="newsx"><form name="shoutbox" id="shoutbox" action="/guestbook/index.php?act=say" method="post">'.bbcode::auto_bb('shoutbox', 'msg').'
<textarea placeholder=" " id="msg" name="msg">
</textarea><input type="hidden" name="ref" value="'.$refer.'"/>
<input type="hidden" name="token" value="'.$token.'"><br />
<input type="submit" name="submit" value="Comment"></form></div></div>';
}

//display msg 


if (isset($_POST['msg'])) {
   $msg = isset($_POST['msg']) ? mb_substr(trim($_POST['msg']), 0, 5000) : '';
   $flood = functions::antiflood();
   if ($ban['1'] || $ban['13'])
       $error[] = $lng['access_forbidden'];
   if ($flood)
       $error = $lng['error_flood'] . ' ' . $flood . '&#160;' . $lng['seconds'];
   if (!$error) {
       $req = mysql_query("SELECT * FROM `guest` WHERE `user_id` = '$user_id' ORDER BY `time` DESC");
       $res = mysql_fetch_array($req);
       if ($res['text'] == $msg) {
           exit;
       }
   }
   if (!$error) {
   
   
    // Вставляем сообщение в базу

mysql_query("INSERT INTO `guest` SET
`adm` = '$admset',
`time` = '" . time() . "',
`user_id` = '$user_id',
`name` = '$from',
`text` = '" . mysql_real_escape_string($msg) . "',
`ip` = '" . core::$ip . "',
`browser` = '" . mysql_real_escape_string($agn) . "'
");
       if ($user_id) {
          $postguest = $datauser['postguest'] + 1;
          mysql_query("UPDATE `users` SET `postguest` = '$postguest', `lastpost` = '" . time() . "' WHERE `id` = '$user_id'");
       }
	   
   }
}
$total = mysql_result(mysql_query("SELECT COUNT(*) FROM `guest` WHERE `adm`='0'"), 0);
  if ($total) {
        $req = mysql_query("SELECT `guest`.*, `guest`.`id` AS `gid`, `users`.`lastdate`, `users`.`id`, `users`.`rights`, `users`.`name`
                    FROM `guest` LEFT JOIN `users` ON `guest`.`user_id` = `users`.`id`
                    WHERE `guest`.`adm`='0' ORDER BY `time` DESC LIMIT ".(!$is_mobile ? 6 : 6).""); 
echo '<div class="forumtxt">';
        while ($gres = mysql_fetch_assoc($req)) {
        $post = $gres['text'];
		$post = str_replace(':v', ':pacman:', $post);
        $post = functions::checkout($gres['text'], 1, 1);
        if ($set_user['smileys'])
          $post = functions::smileys($post, $gres['rights'] ? 1 : 0);
          $outputhtml .= (time() > $gres['lastdate'] + 600 ? ' 

<div class="list1"><img src="/images/offline.png" /> ' : ' 

<div class="list1"><img src="/images/online.png" /> ').'<a href="/users/'.$gres['name'].'_'.$gres['id'].'.html"><b>'. nick($gres['id']).'</b></a>: '.$post.'</div>';
          ++$i;
        }
      echo $outputhtml;

echo '</div>';
  }
.
Mark
.
Error on
$total = mysql_result(mysql_query("SELECT COUNT(*) FROM `guest` WHERE `adm`='0'"), 0);
.
# Gekikara048 (06.01.2017 / 17:56)
Error on
$total = mysql_result(mysql_query("SELECT COUNT(*) FROM `guest` WHERE `adm`='0'"), 0);
what errors?
.
were will i put the code please
.
# JIN-K (06.01.2017 / 16:08)
try this // form

echo ' <div class="phdr"><div class="icon-chat"></div><a href="/guestbook/index.php">Shout box</a>';
if ($rights >= 3) {
echo ' <a href="/guestbook/index.php?act=clean">[Del]</
Please were will i post the code and how do i make BOT work
.
Блиносвёрт ?
look here
http://johncms.com/forum/index ... 12334
.
I put the code in my mainmenu.php but not working
please explain well am newbies to php
$limit = 3; // The number of displayed posts
$gb = include 'gb_posts.php';

echo (!empty($limit) && $gb && $set['mod_guest'] ? '<div class="topmenu">'.
    'Recent Entries guest</div><div class="menu">'. $gb .'</div>' : '');
.
# JIN-K (06.01.2017 / 16:08)
try this // form

echo ' <div class="phdr"><div class="icon-chat"></div><a href="/guestbook/index.php">Shout box</a>';
if ($rights >= 3) {
echo ' <a href="/guestbook/index.php?act=clean">[Del]</
the code is error check it here http://winkwap.ga/guestbook/sb.php
Всего: 11