Forum code for lava

Started on the old forum in February 2010 · view the original in the archive · old links redirect here

3 replies · 1,097 views · started 16 years ago · 15 min read

riderz Lead · 975 posts #1

here are the codes needed to add a forum to ur site if there are stuff missing just post it here

//////////////////////////////////////////////// core.php ////////////////////////////////////////////////

////////////////////////////////////////////Can access forum

function canaccess($uid, $fid)
{
  $fex = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_forums WHERE id='".$fid."'"));
  if($fex[0]==0)
  {
    return false;
  }
  $persc = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_acc WHERE fid='".$fid."'"));
  if($persc[0]==0)
  {
    $clid = mysql_fetch_array(mysql_query("SELECT clubid FROM ibwf_forums WHERE id='".$fid."'"));
    if($clid[0]==0)
    {
      return true;
    }else{
      if(ismod($uid))
      {
        return true;
      }else{
        $ismm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE uid='".$uid."' AND clid='".$clid[0]."'"));
        if($ismm[0]>0)
        {
          return true;
        }else{
          return false;
        }
      }
    }

  }else{
    $gid = mysql_fetch_array(mysql_query("SELECT gid FROM ibwf_acc WHERE fid='".$fid."'"));
    $gid = $gid[0];
    $ginfo = mysql_fetch_array(mysql_query("SELECT autoass, mage, userst, posts, plusses FROM ibwf_groups WHERE id='".$gid."'"));
    if($ginfo[0]=="1")
    {
      $uperms = mysql_fetch_array(mysql_query("SELECT birthday, perm, posts, plusses FROM ibwf_users WHERE id='".$uid."'"));
if($ginfo[2]==5)
      {

        if(iscoder($uid))
        {
            return true;
        }else{
          return false;
        }
      }
 if($ginfo[2]==4)
      {

        if(isheadadmin($uid))
        {
            return true;
        }else{
          return false;
        }
      } if($ginfo[2]==3)
      {

        if(isowner($uid))
        {
            return true;
        }else{
          return false;
        }
      }
      if($ginfo[2]==2)
      {

        if(isadmin($uid))
        {
            return true;
        }else{
          return false;
        }
      }

      if($ginfo[2]==1)
      {

        if(ismod($uid))
        {
            return true;
        }else{
          return false;
        }
      }
      if($uperms[1]>$ginfo[2])
      {
        return true;
      }
      $acc = true;
      if(getage($uperms[0])< $ginfo[1])
      {
        $acc =  false;
      }
      if($uperms[2]<$ginfo[3])
      {
        $acc =  false;
      }
      if($uperms[3]<$ginfo[4])
      {
        $acc =  false;
      }

    }
  }
  return $acc;
}
////////////////get number of pinned topics in forum

function getpinned($fid)
{
  $nop = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$fid."' AND pinned ='1'"));
  return $nop[0];
}
////////////////////////////////////////////Get forum name

function getfname($fid)
{
  $fname = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_forums WHERE id='".$fid."'"));
  return $fname[0];
}
///////////////////////////////////////////Get Forum ID

function getfid($topicid)
{
  $fid = mysql_fetch_array(mysql_query("SELECT fid FROM ibwf_topics WHERE id='".$topicid."'"));
  return $fid[0];
}
 //////////////////////////////////parse bbcode

function getbbcode($text, $sid="")
{
 $text = preg_replace("/\[forum\=(.*?)\](.*?)\[\/forum\]/is","<a href=\"index.php?action=viewfrm&tid=$1&sid=$sid\">$2</a>",$text);
    }

////////////////////////////////////////////////////// GENPROC.PHP //////////////////////////////////////////////////////

if($action=="newtopic")
{
  $fid = $_POST["fid"];
  $ntitle = $_POST["ntitle"];
  $tpctxt = $_POST["tpctxt"];
  if(!canaccess(getuid_sid($sid), $fid))
    {
  $pstyle = gettheme($sid);
      echo xhtmlhead("$stitle",$pstyle);
      echo "<p align=\"center\">";
      echo "You Don't Have A Permission To View The Contents Of This Forum<br/><br/>";
      echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>";
      echo "</p>";
  echo xhtmlfoot();
      exit();
    }
  addonline(getuid_sid($sid),"Created New Topic","");
  $pstyle = gettheme($sid);
      echo xhtmlhead("$stitle",$pstyle);
      echo "<p align=\"center\">";
      $crdate = (time() - $timeadjust) + $timeadjust;
      //$uid = getuid_sid($sid);
      $texst = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE name LIKE '".$ntitle."' AND fid='".$fid."'"));
      if($texst[0]==0)
      {
        $res = false;

        $ltopic = mysql_fetch_array(mysql_query("SELECT crdate FROM ibwf_topics WHERE authorid='".$uid."' ORDER BY crdate DESC LIMIT 1"));
        global $topic_af;
        $antiflood = (time() - $timeadjust)-$ltopic[0] + $timeadjust;
        if($antiflood>$topic_af)
{
  if((trim($ntitle)!="")||(trim($tpctxt)!=""))
      {
      $res = mysql_query("INSERT INTO ibwf_topics SET name='".$ntitle."', fid='".$fid."', authorid='".$uid."', text='".$tpctxt."', crdate='".$crdate."', lastpost='".$crdate."'");
     }
       if($res)
      {
        $usts = mysql_fetch_array(mysql_query("SELECT posts, plusses FROM ibwf_users WHERE id='".$uid."'"));
        $ups = $usts[0]+1;
        $upl = $usts[1]+1;
        mysql_query("UPDATE ibwf_users SET posts='".$ups."', plusses='".$upl."' WHERE id='".$uid."'");
        $tnm = htmlspecialchars($ntitle);
        echo "<img src=\"images/ok.gif\" alt=\"O\"/>Topic <b>$tnm</b> Created Successfully";
        $tid = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_topics WHERE name='".$ntitle."' AND fid='".$fid."'"));
        echo "<br/><br/><a href=\"index.php?action=viewtpc&sid=$sid&tid=$tid[0]\">";
echo "View Topic</a>";
      }else{
        echo "<img src=\"images/notok.gif\" alt=\"X\"/>Error Creating New Thread";
      }
      }else{
        $af = $topic_af -$antiflood;
        echo "<img src=\"images/notok.gif\" alt=\"X\"/>Antiflood Control: $af";
      }
      }else{
        echo "<img src=\"images/notok.gif\" alt=\"X\"/>Topic Name already Exist";
      }

      $fname = getfname($fid);
      echo "<br/><br/><a href=\"index.php?action=viewfrm&sid=$sid&fid=$fid\">";
echo "$fname</a><br/>";
          $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
    $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
    echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
      echo "</p>";
  echo xhtmlfoot();
}
else if($action=="rtpc")
{
  $tid = $_GET["tid"];
  addonline(getuid_sid($sid),"Reporting Topic","");
$pstyle = gettheme($sid);
      echo xhtmlhead("$stitle",$pstyle);
  echo "<p align=\"center\">";
  $pinfo = mysql_fetch_array(mysql_query("SELECT reported FROM ibwf_topics WHERE id='".$tid."'"));
          if($pinfo[0]=="0")
          {
          $str = mysql_query("UPDATE ibwf_topics SET reported='1' WHERE id='".$tid."' ");
          if($str)
          {
            echo "<img src=\"images/ok.gif\" alt=\"O\"/>Topic reported to mods successfully";
          }else{
            echo "<img src=\"images/notok.gif\" alt=\"X\"/>Can't report topic at the moment";
          }
          }else{
            echo "<img src=\"images/notok.gif\" alt=\"X\"/>This Topic is already reported";
          }
          echo "<br/><br/>";
      $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
    $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
    echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
  echo xhtmlfoot();

}
else if($action=="post")
{
    $tid = $_POST["tid"];
    $tfid = mysql_fetch_array(mysql_query("SELECT fid FROM ibwf_topics WHERE id='".$tid."'"));
if(!canaccess(getuid_sid($sid), $tfid[0]))
    {
  $pstyle = gettheme($sid);
      echo xhtmlhead("$stitle",$pstyle);
      echo "<p align=\"center\">";
      echo "You Don't Have A Permission To View The Contents Of This Forum<br/><br/>";
      echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>";
      echo "</p>";
      echo "</card>";
      echo "</wml>";
      exit();
    }
  $reptxt = $_POST["reptxt"];
  $qut = $_POST["qut"];
  addonline(getuid_sid($sid),"Posted A reply","");
  $pstyle = gettheme($sid);
      echo xhtmlhead("$stitle",$pstyle);
      echo "<p align=\"center\">";
      $crdate = (time() - $timeadjust) + $timeadjust;
      $fid = getfid($tid);
      //$uid = getuid_sid($sid);
      $res = false;
      $closed = mysql_fetch_array(mysql_query("SELECT closed FROM ibwf_topics WHERE id='".$tid."'"));

      if(($closed[0]!='1')||(ismod($uid)))
      {

        $lpost = mysql_fetch_array(mysql_query("SELECT dtpost FROM ibwf_posts WHERE uid='".$uid."' ORDER BY dtpost DESC LIMIT 1"));
        global $post_af;
        $antiflood = (time() - $timeadjust)-$lpost[0] + $timeadjust;
        if($antiflood>$post_af)
{
  if(trim($reptxt)!="")
      {
      $res = mysql_query("INSERT INTO ibwf_posts SET text='".$reptxt."', tid='".$tid."', uid='".$uid."', dtpost='".$crdate."', quote='".$qut."'");
}
      if($res)
      {
        $usts = mysql_fetch_array(mysql_query("SELECT posts, plusses FROM ibwf_users WHERE id='".$uid."'"));
        $ups = $usts[0]+1;
        $upl = $usts[1]+1;
        mysql_query("UPDATE ibwf_users SET posts='".$ups."', plusses='".$upl."' WHERE id='".$uid."'");
        mysql_query("UPDATE ibwf_topics SET lastpost='".$crdate."' WHERE id='".$tid."'");
        echo "<img src=\"images/ok.gif\" alt=\"O\"/>Message Posted Successfully";
        echo "<br/><br/><a href=\"index.php?action=viewtpc&sid=$sid&tid=$tid&go=last\">";
echo "View Topic</a>";
      }else{
        echo "<img src=\"images/notok.gif\" alt=\"X\"/>Error Posting Message";
      }
      }else{
$af = $post_af -$antiflood;
        echo "<img src=\"images/notok.gif\" alt=\"X\"/>Antiflood Control: $af";
      }
      }else{
        echo "<img src=\"images/notok.gif\" alt=\"X\"/>Topic is closed for posting";
      }

      $fname = getfname($fid);
      echo "<br/><br/><a href=\"index.php?action=viewfrm&sid=$sid&fid=$fid\">";
echo "$fname</a><br/>";
          $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
    $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
    echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
      echo "</p>";
  echo xhtmlfoot();

}

//////////////////////////////////////////////////////// INDEX.PHP ////////////////////////////////////////////////////////

 $var = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online WHERE place='Forum Index'"));
  $var1 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online WHERE place='Viewing Forum Category'"));
  $var2 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online WHERE place='Viewing Forum Topic'"));
  $var3 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online WHERE place='Viewing Forum'"));
  $var4 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online WHERE place='Creating new topic'"));
  $var5 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online WHERE place='Posting reply'"));
  $var6 = $var[0]+$var1[0]+$var2[0]+$var3[0]+$var4[0]+$var5[0];
  echo "4 <a accesskey=\"4\" href=\"index.php?action=forumindx&sid=$sid\">$iconforum $lang24 ($var6)</a><br/>";
  
  //////////////////////////////////View category

else if($action=="viewcat")
{

  $cid = cleanQuery($_GET["cid"]);
  addonline(getuid_sid($sid),"Viewing Forum Category","index.php?action=viewcat&cid=$cid");
  $cinfo = mysql_fetch_array(mysql_query("SELECT name from ibwf_fcats WHERE id='".$cid."'"));
 $pstyle = gettheme($sid);
    echo xhtmlhead($cinfo[0],$pstyle);
  echo "<body>";
  echo "<div align=\"center\">";
  echo "<b><i>$cinfo[0]</i></b></div>";
  echo "<p align=\"center\">";
  echo "<i>This Forum Category Moderate By: </i>";
    $mod = "SELECT DISTINCT name FROM ibwf_modr WHERE forum='".$cid."' ORDER BY name";
                 $itm = mysql_query($mod);
                 echo mysql_error();
                  if(mysql_num_rows($itm)>0)
                     {
                  while ($it = mysql_fetch_array($itm))
                     {

				$who = $it[0];
				$user = getnick_uid($who);
    $vulnk = "<a href=\"index.php?action=viewuser&sid=$sid&who=$who\">$user</a>";
    echo "<i>$vulnk,</i>";
}}
  echo "</p>";
  $umsg = getunreadpm(getuid_sid($sid));
  if($umsg>0)
  {
  echo "<p align=\"center\">";
  echo "<br/><a href=\"inbox.php?action=main&sid=$sid\">$umsg New Inbox!</a>";
  echo "</p>";
  }
  $forums = mysql_query("SELECT id, name FROM ibwf_forums WHERE cid='".$cid."' AND clubid='0' ORDER BY position, id, name");
  echo "<p>";
  while($forum = mysql_fetch_array($forums))
  {
  $notp = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$forum[0]."'"));
  $nops = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts a INNER JOIN ibwf_topics b ON a.tid = b.id WHERE b.fid='".$forum[0]."'"));
  $iml = "<img src=\"../images/1.gif\" alt=\"*\"/>";
  echo "<a href=\"index.php?action=viewfrm&sid=$sid&fid=$forum[0]\">$iml$forum[1]($notp[0]/$nops[0])</a><br/>";
  $lpt = mysql_fetch_array(mysql_query("SELECT id, name FROM ibwf_topics WHERE fid='".$forum[0]."' ORDER BY lastpost DESC LIMIT 0,1"));
  $nops = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE tid='".$lpt[0]."'"));
  if($nops[0]==0)
  {
  $pinfo = mysql_fetch_array(mysql_query("SELECT authorid FROM ibwf_topics WHERE id='".$lpt[0]."'"));
  $tluid = $pinfo[0];
  }else{
  $pinfo = mysql_fetch_array(mysql_query("SELECT  uid  FROM ibwf_posts WHERE tid='".$lpt[0]."' ORDER BY dtpost DESC LIMIT 0, 1"));
  $tluid = $pinfo[0];
  }
  $tlnm = htmlspecialchars($lpt[1]);
  $tlnick = getnick_uid($tluid);
  $tpclnk = "<a href=\"index.php?action=viewtpc&sid=$sid&tid=$lpt[0]&go=last\">$tlnm</a>";
  $vulnk = "<a href=\"index.php?action=viewuser&sid=$sid&who=$tluid\">$tlnick</a>";
  if($pinfo[0]>0)
  {
  echo "Last Post: $tpclnk<br/>By: $vulnk<br/>";
  }
  }
  echo "</p>";
  echo "<p align=\"center\">";
  $var3 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online WHERE place='Viewing Forum Category'"));
  echo "<br/><i>$var3[0] User(s) Currently Browsing Here</i><br/><br/>";

  echo forumlink($sid);
  echo "<a href=\"index.php?action=main&sid=$sid\">© $stitle</a>";
  echo "</p>";
  echo "</body>";
    echo xhtmlfoot();
exit();
}

//////////////////////////////////View Topic155

else if($action=="viewtpc")
{
  $tid = cleanQuery($_GET["tid"]);
  $go = cleanQuery($_GET["go"]);
  addonline(getuid_sid($sid),"Viewing Forum Topic","index.php?action=viewtpc&tid=$tid");
  $tfid = mysql_fetch_array(mysql_query("SELECT fid FROM ibwf_topics WHERE id='".$tid."'"));
  if(!canaccess(getuid_sid($sid), $tfid[0]))
    {
  $pstyle = gettheme($sid);
    echo xhtmlhead("$stitle",$pstyle);
    echo "<body>";
      echo "<p align=\"center\">";
      echo "You Don't Have A Permission To View The Contents Of This Forum<br/><br/>";
      echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>";
      echo "</p>";
      echo "</body>";
      echo "</html>";
      exit();
    }

    $tinfo = mysql_fetch_array(mysql_query("SELECT name, text, authorid, crdate, views, fid, pollid from ibwf_topics WHERE id='".$tid."'"));
    $tnm = htmlspecialchars($tinfo[0]);
    $pstyle = gettheme($sid);
    echo xhtmlhead("$stitle",$pstyle);
    echo "<body>";

    echo "<div align=\"center\">";
    $umsg = getunreadpm(getuid_sid($sid));
    if($umsg>0)
    {
    echo "<a href=\"inbox.php?action=main&sid=$sid\">$umsg New Inbox!</a><br/>";
    }
    $num_pages = getnumpages($tid);
    if($page==""||$page<1)$page=1;
    if($go!="")$page=getpage_go($go,$tid);
    $posts_per_page = 5;
    if($page>$num_pages)$page=$num_pages;
    $limit_start = $posts_per_page *($page-1);
    echo "<a href=\"index.php?action=post&sid=$sid&tid=$tid\">Post reply</a>";
    $lastlink = "<a href=\"index.php?action=$action&tid=$tid&sid=$sid&go=last\">Last Page</a>";
    $firstlink = "<a href=\"index.php?action=$action&tid=$tid&sid=$sid&page=1\">First Page</a> ";
    $golink = "";
    if($page>1)
    {
      $golink = $firstlink;
    }
    if($page<$num_pages)
    {
      $golink .= $lastlink;
    }
    if($golink !="")
    {
      echo "<br/>$golink";
    }
    $vws = $tinfo[4]+1;
    $rpls = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE tid='".$tid."'"));
    echo "<br/>Replies: $rpls[0] - Views: $vws<br/>";
    echo "</div>";
    echo "<div>";
    echo "<br/>";
    ///fm here

    if($page==1)
    {
      $posts_per_page=4;
      mysql_query("UPDATE ibwf_topics SET views='".$vws."' WHERE  id='".$tid."'");
      $ttext = mysql_fetch_array(mysql_query("SELECT authorid, text, crdate, pollid FROM ibwf_topics WHERE id='".$tid."'"));
      $unick = getnick_uid($ttext[0]);
      if(isonline($ttext[0]))
    {
      $iml = "<img src=\"../images/onl.gif\" alt=\"+\"/>";
    }else{
        $iml = "<img src=\"../images/ofl.gif\" alt=\"-\"/>";
    }
    $for = "<br/>".forat($ttext[0])."";
    $usl = "<br/>Topic Author: <a href=\"index.php?action=viewuser&sid=$sid&who=$ttext[0]\">$iml$unick</a>$for";
    $topt = "<a href=\"index.php?action=tpcopt&sid=$sid&tid=$tid\">*</a>";
    if($go==$tid)
    {
      $fli = "<img src=\"../images/flag.gif\" alt=\"!\"/>";
    }else{
      $fli ="";
    }
    $pst = parsemsg($ttext[1],$sid);
    echo "» $fli$pst $topt$usl<br/>";
  $unop = mysql_fetch_array(mysql_query("SELECT posts FROM ibwf_users WHERE id='".$ttext[0]."'"));
  $unol = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE uid='".$ttext[0]."'"));
  $plink = "<a href=\"lists.php?action=uposts&sid=$sid&who=$ttext[0]\">$unol[0]</a>";
    echo "Forum Post $plink/$unop[0]<br/>";
    $dtot = date("d-m-y - H:i:s",$ttext[2]);
    echo $dtot;
    echo "<br/>";
    echo "<hr width=\"100%\"/>";
    if($ttext[3]>0)
    {
      echo "<a href=\"index.php?action=viewtpl&sid=$sid&who=$tid\">POLL</a><br/>";
    }
  }
  if($page>1)
  {
    $limit_start--;
  }
  $sql = "SELECT id, text, uid, dtpost, quote FROM ibwf_posts WHERE tid='".$tid."' ORDER BY dtpost LIMIT $limit_start, $posts_per_page";
  $posts = mysql_query($sql);
  while($post = mysql_fetch_array($posts))
  {
    $unick = getnick_uid($post[2]);
    if(isonline($post[2]))
    {
      $iml = "<img src=\"../images/onl.gif\" alt=\"+\"/>";
    }else{
        $iml = "<img src=\"../images/ofl.gif\" alt=\"-\"/>";
    }
  $que = mysql_fetch_array(mysql_query("SELECT text, uid, dtpost FROM ibwf_posts WHERE id='".$post[4]."'"));
        $nick = getnick_uid($que[1]);
    $dto = date("d-m-y - H:i:s",$que[2]);
    $as = parsemsg($que[0], $sid);
    $quo = "<i>[$nick Wrote:$as<br/>$dto]</i><br/>";
    $for = "<br/>".forat($post[2])."";
    $usl = "<br/>Post BY: <a href=\"index.php?action=viewuser&sid=$sid&who=$post[2]\">$iml$unick</a>$for";
    $pst = parsemsg($post[1], $sid);
    $topt = "<a href=\"index.php?action=pstopt&sid=$sid&pid=$post[0]&page=$page&fid=$tinfo[5]\">*</a>";
    if($post[4]>0)
    {
        $qtl = "<small><i><a href=\"index.php?action=viewtpc&sid=$sid&tid=$tid&pst=\">(quote:p=blaze,d=16-04-2006)</a></i></small>";
    }
    if($go==$post[0])
    {
      $fli = "<img src=\"../images/flag.gif\" alt=\"!\"/>";
    }else{
      $fli ="";
    }
    if($post[4]==0)
    {
    echo "» $fli$pst $topt$usl<br/>";
    }else{
    echo "» $quo » $fli$pst $topt$usl<br/>";
    }
  $unop = mysql_fetch_array(mysql_query("SELECT posts FROM ibwf_users WHERE id='".$post[2]."'"));
  $unol = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE uid='".$post[2]."'"));
  $plink = "<a href=\"lists.php?action=uposts&sid=$sid&who=$post[2]\">$unol[0]</a>";

    echo "Forum Post $plink/$unop[0]<br/>";
    $dtot = date("d-m-y - H:i:s",$post[3]);
    echo $dtot;
    echo "<br/>";
    echo "<hr width=\"100%\"/>";
  }
    ///to here
    echo "<p align=\"center\">";
    if($page>1)
    {
      $ppage = $page-1;
      echo "<a href=\"index.php?action=viewtpc&page=$ppage&sid=$sid&tid=$tid\">«PREV</a> ";
    }
    if($page<$num_pages)
    {
      $npage = $page+1;
      echo "<a href=\"index.php?action=viewtpc&page=$npage&sid=$sid&tid=$tid\">Next»</a>";
    }
    echo "<br/>$page/$num_pages<br/>";
    if($num_pages>2)
    {
      $rets = "<form action=\"index.php\" method=\"get\">";
	$rets .= "Jump<input name=\"page\" style=\"-wap-input-format: '*N'\" size=\"2\"/>";
	$rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>";
	$rets .= "<input type=\"hidden\" name=\"tid\" value=\"$tid\"/>";
	$rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";
	$rets .= "<input type=\"Submit\" value=\"Go\" Name=\"Submit\"/></form>";

        echo $rets;
    }
  echo "</div>";
  echo "<div align=\"center\">";
  echo "<a href=\"index.php?action=post&sid=$sid&tid=$tid\">Post reply</a><br/>";

  $var3 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online WHERE place='Viewing Forum Topic'"));
  echo "<br/><i>$var3[0] User(s) Currently Browsing Here</i><br/><br/>";

  $fid = $tinfo[5];
  $fname = getfname($fid);
  $cid = mysql_fetch_array(mysql_query("SELECT cid FROM ibwf_forums WHERE id='".$fid."'"));
  $cinfo = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_fcats WHERE id='".$cid[0]."'"));
  $cname = $cinfo[0];
  $cid = mysql_fetch_array(mysql_query("SELECT cid FROM ibwf_forums WHERE id='".$fid."'"));
  $fname = htmlspecialchars($fname);
  echo "<a href=\"index.php?action=viewfrm&sid=$sid&fid=$fid\">Back To $fname</a><br/>";
  if($cid[0]>0)
  {
  $cinfo = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_fcats WHERE id='".$cid[0]."'"));
  $cname = htmlspecialchars($cinfo[0]);
  echo "<a href=\"index.php?action=viewcat&sid=$sid&cid=$cid[0]\">$cname</a><br/>";
  echo forumlink($sid);
  }else{
  $cid = mysql_fetch_array(mysql_query("SELECT clubid FROM ibwf_forums WHERE id='".$fid."'"));
  $cinfo = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_clubs WHERE id='".$cid[0]."'"));
  $cname = htmlspecialchars($cinfo[0]);
  echo "<a href=\"index.php?action=gocl&sid=$sid&clid=$cid[0]\">$cname Club</a><br/>";
  }
  echo "<a href=\"index.php?action=main&sid=$sid\">© $stitle</a>";
  echo "</div>";
    echo "</body>";
exit();
}
//////////////////////////////////View Forum

else if($action=="viewfrm")
{

    $fid = cleanQuery($_GET["fid"]);
	$view = cleanQuery($_GET["view"]);
    if(!canaccess(getuid_sid($sid), $fid))
    {
      addonline(getuid_sid($sid),"im viewing admin forum naughty me","");
    echo "<head>";
     $pstyle = gettheme($sid);
    echo xhtmlhead("$stitle",$pstyle);
    echo "<body>";
      echo "<p align=\"center\">";
      echo "You Don't Have A Permission To View The Contents Of This Forum<br/><br/>";
      echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>";
      echo "</p>";
      echo "</body>";
      echo "</html>";
      exit();
    }
    addonline(getuid_sid($sid),"Viewing Forum","index.php?action=viewfrm&sid=$sid&fid=$fid");
    $finfo = mysql_fetch_array(mysql_query("SELECT name from ibwf_forums WHERE id='".$fid."'"));
    $fnm = htmlspecialchars($finfo[0]);
   $pstyle = gettheme($sid);
    echo xhtmlhead("$stitle",$pstyle);
    echo "<body>";
    echo "<p align=\"center\">";
    $umsg = getunreadpm(getuid_sid($sid));
    if($umsg>0)
    {
    echo "<br/><a href=\"inbox.php?action=main&sid=$sid\">$umsg New Inbox!</a><br/>";
    }
    $norf = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_rss WHERE fid='".$fid."'"));
    if($norf[0]>0)
    {
        echo "<a href=\"rwrss.php?action=showfrss&sid=$sid&fid=$fid\"><img src=\"../images/rss.gif\" alt=\"rss\"/>$finfo[0] Extras</a><br/>";
    }
    echo "<a href=\"index.php?action=newtopic&sid=$sid&fid=$fid\">New Topic</a><br/>";
    echo "<form action=\"index.php\" method=\"get\">";
    echo "View: <select name=\"view\">";
    echo "<option value=\"all\">All</option>";
    echo "<option value=\"new\">Since Last Visit</option>";
    echo "<option value=\"myps\">I posted In</option>";
    echo "</select>";
    echo "<input type=\"submit\" value=\"Go\"/>";
    echo "<input type=\"hidden\" name=\"action\" value=\"$action\"/>";
    echo "<input type=\"hidden\" name=\"fid\" value=\"$fid\"/>";
    echo "<input type=\"hidden\" name=\"sid\"  value=\"$sid\"/>";
    echo "</form>";
    echo "<br/>";
	if($view=="new")
	{
		echo "<small>Viewing topics that has no new posts since your last visit</small>";
	}else if($view=="myps")
	{
		echo "<small>Viewing topics contain posts by you</small>";
	}else {
	echo "<small>Viewing All topics</small>";
	}
    echo "</p>";
    echo "<p>";
    if($page=="" || $page<=0)$page=1;
    if($page==1)
    {
      ///////////pinned topics
      $topics = mysql_query("SELECT id, name, closed, views, pollid FROM ibwf_topics WHERE fid='".$fid."' AND pinned='1' ORDER BY lastpost DESC, name, id LIMIT 0,5");
      while($topic = mysql_fetch_array($topics))
    {
      $iml = "<img src=\"../images/normal.gif\" alt=\"*\"/>";
      $iml = "*";
      $atxt ="";
      if($topic[2]=='1')
      {
        //closed
        $atxt = "(X)";
      }
      if($topic[4]>0)
      {
        $pltx = "(P)";
      }else{
        $pltx = "";
      }
      $tnm = htmlspecialchars($topic[1]);
      $nop = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE tid='".$topic[0]."'"));
      echo "<a href=\"index.php?action=viewtpc&sid=$sid&tid=$topic[0]\">$iml$pltx$tnm($nop[0])$atxt</a><br/>";

    }
    echo "<br/>";
  }
  $uid = getuid_sid($sid);
  if($view=="new")
  {

  $ulv = mysql_fetch_array(mysql_query("SELECT lastvst FROM ibwf_users WHERE id='".$uid."'"));
  $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$fid."' AND pinned='0' AND lastpost >='".$ulv[0]."'"));
  }
  else if($view=="myps")
  {
	$noi = mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT a.id) FROM ibwf_topics a INNER JOIN ibwf_posts b ON a.id = b.tid WHERE a.fid='".$fid."' AND a.pinned='0' AND b.uid='".$uid."'"));
  }
  else{
  $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$fid."' AND pinned='0'"));
  }
    $num_items = $noi[0]; //changable
    $items_per_page= 10;
    $num_pages = ceil($num_items/$items_per_page);
    if($page>$num_pages)$page= $num_pages;
    $limit_start = ($page-1)*$items_per_page;
    if($limit_start<0)$limit_start=0;
	if($view=="new")
	{
	$ulv = mysql_fetch_array(mysql_query("SELECT lastvst FROM ibwf_users WHERE id='".$uid."'"));
    $topics = mysql_query("SELECT id, name, closed, views, moved, pollid, authorid FROM ibwf_topics WHERE fid='".$fid."' AND pinned='0' AND lastpost >='".$ulv[0]."' ORDER BY lastpost DESC, name, id LIMIT $limit_start, $items_per_page");
	}
	else if($view=="myps"){
	$topics = mysql_query("SELECT a.id, a.name, a.closed, a.views, a.moved, a.pollid, a.authorid FROM ibwf_topics a INNER JOIN ibwf_posts b ON a.id = b.tid WHERE a.fid='".$fid."' AND a.pinned='0' AND b.uid='".$uid."' GROUP BY a.id ORDER BY a.lastpost DESC, a.name, a.id  LIMIT $limit_start, $items_per_page");
	}
	else{
	$topics = mysql_query("SELECT id, name, closed, views, moved, pollid, authorid FROM ibwf_topics WHERE fid='".$fid."' AND pinned='0' ORDER BY lastpost DESC, name, id LIMIT $limit_start, $items_per_page");
	}

    while($topic = mysql_fetch_array($topics))
    {

      $nop = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE tid='".$topic[0]."'"));
      $iml = "<img src=\"../images/normal.gif\" alt=\"*\"/>";
      if($nop[0]>24)
      {
        $iml = "<img src=\"../images/hot.gif\" alt=\"*\"/>";
      }
      if($topic[4]=='1')
      {
        $iml = "<img src=\"../images/moved.gif\" alt=\"*\"/>";
      }
      if($topic[2]=='1')
      {
        $iml = "<img src=\"../images/closed.gif\" alt=\"*\"/>";
      }
      if($topic[5]>0)
      {
        $iml = "<img src=\"../images/poll.gif\" alt=\"*\"/>";
      }
      $atxt ="";
      if($topic[2]=='1')
      {
        //closed
        $atxt = "(X)";
      }
				$who = $topic[6];
				$user = getnick_uid($who);
    $vulnk = "<a href=\"index.php?action=viewuser&sid=$sid&who=$who\">$user</a>";

      $tnm = htmlspecialchars($topic[1]);
      echo "<a href=\"index.php?action=viewtpc&sid=$sid&tid=$topic[0]\">$iml$tnm$atxt</a><br/>
      <i>Total Post: $nop[0]</i><br/>Author: <i>$vulnk</i><br/><br/>";
    }

    echo "</p>";
    echo "<p align=\"center\">";

    if($page>1)
    {
      $ppage = $page-1;
      echo "<a href=\"index.php?action=viewfrm&page=$ppage&sid=$sid&fid=$fid&view=$view\">«PREV</a> ";
    }
    if($page<$num_pages)
    {
      $npage = $page+1;
      echo "<a href=\"index.php?action=viewfrm&page=$npage&sid=$sid&fid=$fid&view=$view\">Next»</a>";
    }
    echo "<br/>$page/$num_pages<br/>";
    if($num_pages>2)
    {
        $rets = "<form action=\"index.php\" method=\"get\">";
        $rets .= "<input name=\"page\" style=\"-wap-input-format: '*N'\" size=\"2\"/>";
        $rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>";
        $rets .= "<input type=\"hidden\" name=\"fid\" value=\"$fid\"/>";
        $rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";
	  $rets .= "<input type=\"hidden\" name=\"view\" value=\"$view\"/>";
        $rets .= "<input type=\"submit\" value=\"Go To Page\"/>";
        $rets .= "</form>";

        echo $rets;
    }

    echo "<br/><a href=\"index.php?action=newtopic&sid=$sid&fid=$fid\">New Topic</a><br/>";

  $var3 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online WHERE place='Viewing Forum'"));
  echo "<br/><i>$var3[0] User(s) Currently Browsing Here</i><br/>";

    $cid = mysql_fetch_array(mysql_query("SELECT cid FROM ibwf_forums WHERE id='".$fid."'"));
    if($cid[0]>0)
    {
    $cinfo = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_fcats WHERE id='".$cid[0]."'"));
    $cname = htmlspecialchars($cinfo[0]);
    echo "<a href=\"index.php?action=viewcat&sid=$sid&cid=$cid[0]\">$cname</a><br/>";
    echo forumlink($sid);
    }else{
        $cid = mysql_fetch_array(mysql_query("SELECT clubid FROM ibwf_forums WHERE id='".$fid."'"));
        $cinfo = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_clubs WHERE id='".$cid[0]."'"));
        $cname = htmlspecialchars($cinfo[0]);
    echo "<br/><a href=\"index.php?action=gocl&sid=$sid&clid=$cid[0]\">$cname Club</a><br/>";
    echo forumlink($sid);
    }
  echo "<a href=\"index.php?action=main&sid=$sid\">© $stitle</a>";
  echo "</p>";
    echo "</body>";
exit();
}
////////////////////////////////////////////////NEW TOPIC
else if($action=="newtopic")
{
  $fid = $_GET["fid"];
  if(!canaccess(getuid_sid($sid), $fid))
    {
    $pstyle = gettheme($sid);
    echo xhtmlhead("$stitle",$pstyle);
      echo "<p align=\"center\">";
      echo "You Don't Have A Permission To View The Contents Of This Forum<br/><br/>";
      echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>";
      echo "</p>";
      echo xhtmlfoot();

      exit();
    }
    addonline(getuid_sid($sid),"Creating new topic - xHTML","index.php?action=online");
    $pstyle = gettheme($sid);
    echo xhtmlhead("New Topic",$pstyle);
    echo "<p align=\"center\">";
  echo "<form method=\"post\" action=\"genproc.php?action=newtopic&sid=$sid\">";
    echo "Title:<input name=\"ntitle\" maxlength=\"30\"/><br/>";
    echo "Text:<input name=\"tpctxt\" maxlength=\"500\"/><br/>";
  echo "<input type=\"hidden\" name=\"fid\" value=\"$fid\"/>";
  echo "<input type=\"submit\" name=\"Submit\" value=\"Create\"/><br/>";
  echo "</form>";
    echo "<br/><br/><a href=\"index.php?action=viewfrm&sid=$sid&fid=$fid\">";
    $fname = getfname($fid);
echo "$fname</a><br/>";
    $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
    $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
    echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";

    echo "</p>";
    echo xhtmlfoot();
exit();
}
//////////////////////////////////////////////Post reply

else if($action=="post")
{
    $tid = $_GET["tid"];

    $tfid = mysql_fetch_array(mysql_query("SELECT fid FROM ibwf_topics WHERE id='".$tid."'"));
    $fid = $tfid[0];
if(!canaccess(getuid_sid($sid), $fid))
    {
    $pstyle = gettheme($sid);
    echo xhtmlhead("$stitle",$pstyle);
      echo "<p align=\"center\">";
      echo "You Don't Have A Permission To View The Contents Of This Forum<br/><br/>";
      echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>";
      echo "</p>";
      echo xhtmlfoot();

      exit();
    }
    addonline(getuid_sid($sid),"Posting reply - xHTML","");

    $pstyle = gettheme($sid);
    echo xhtmlhead("Post Reply",$pstyle);
    echo "<onevent type=\"onenterforward\">";
  echo "<refresh>
        <setvar name=\"reptxt\" value=\"\"/>
        <setvar name=\"qut\" value=\"\"/>
   ";
  echo "</refresh></onevent>";
    $qut = $_GET["qut"];
    echo "<p align=\"center\">";
  echo "<form method=\"post\" action=\"genproc.php?action=post&sid=$sid\">";
  echo "Text:<input name=\"reptxt\" maxlength=\"500\"/><br/>";
  echo "<input type=\"hidden\" name=\"tid\" value=\"$tid\"/>";
  echo "<input type=\"hidden\" name=\"qut\" value=\"$qut\"/>";
  echo "<input type=\"submit\" name=\"Submit\" value=\"Reply\"/><br/>";
  echo "</form>";
         $fid = getfid($tid);
         $fname = getfname($fid);
         echo "<br/><br/><a href=\"index.php?action=viewtpc&sid=$sid&tid=$tid\">";
echo "Back to topic</a>";
      echo "<br/><a href=\"index.php?action=viewfrm&sid=$sid&fid=$fid\">";
echo "$fname</a><br/>";
         $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
    $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
    echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
    echo "</p>";
    echo xhtmlfoot();
exit();
}
/////////////////////////////////////////////
else if($action=="tpcopt")
{
    $tid = $_GET["tid"];
    addonline(getuid_sid($sid),"Topic Options - xHTML","");
    $tinfo= mysql_fetch_array(mysql_query("SELECT name,fid, authorid, text, pinned, closed  FROM ibwf_topics WHERE id='".$tid."'"));
    $trid = $tinfo[2];
    $ttext = htmlspecialchars($tinfo[3]);
    $tname = htmlspecialchars($tinfo[0]);
    $pstyle = gettheme($sid);
    echo xhtmlhead("Topic Options",$pstyle);
    echo "<onevent type=\"onenterforward\">";
    echo "<refresh>
        <setvar name=\"ttext\" value=\"$ttext\"/>
        <setvar name=\"tname\" value=\"$tname\"/>";
    echo "</refresh></onevent>";
  echo "<p align=\"center\">";
  echo "<b>Topic Options</b>";

  echo "</p>";
  echo "<p>";
  echo "Topic ID: <b>$tid</b><br/>";
  $trnick = getnick_uid($trid);
  echo "<a href=\"inbox.php?action=sendpm&sid=$sid&who=$trid\">»Send PM to $trnick</a><br/>";
  echo "<a href=\"index.php?action=viewuser&sid=$sid&who=$trid\">»View $trnick's Profile</a><br/>";
  //echo "<a href=\"index.php?action=post&sid=$sid&tid=$tid&qut=$pid\">»Quote</a><br/>";
  $plid = mysql_fetch_array(mysql_query("SELECT pollid FROM ibwf_topics WHERE id='".$tid."'"));
  if($plid[0]==0)
  {
  if(ismod($uid))
    {
  echo "<a href=\"index.php?action=pltpc&sid=$sid&tid=$tid\">»Add Poll</a><br/>";
}
}else{
  if(ismod($uid))
  {
    echo "<a href=\"genproc.php?action=dltpl&sid=$sid&tid=$tid\">»Delete Poll</a><br/>";
    }
}
  echo "<a href=\"genproc.php?action=rtpc&sid=$sid&tid=$tid\">»Report</a><br/>";
  echo "<a href=\"index.php?action=viewtpc&sid=$sid&tid=$tid&page=1\">«Back to topic</a><br/>";
  if(ismod(getuid_sid($sid)))
  {
    echo "<form method=\"post\" action=\"mprocpl.php?action=rentpc&sid=$sid&tid=$tid\">";
    echo "<br/>Title: <input name=\"tname\" value=\"$tname\" maxlength=\"25\"/>";
    echo "<br/><input type=\"submit\" name=\"Submit\" value=\"Rename\"/><br/>";
    echo "</form>";

    echo "<form method=\"post\" action=\"mprocpl.php?action=edttpc&sid=$sid&tid=$tid\">";
    echo "<br/>Text: <input name=\"ttext\" value=\"$ttext\" maxlength=\"500\"/> ";
    echo "<br/><input type=\"submit\" name=\"Submit\" value=\"Edit\"/><br/>";
    echo "</form>";

echo "<a href=\"mprocpl.php?action=delt&sid=$sid&tid=$tid\">»DELETE</a><br/>";
    echo "<br/>";
    if($tinfo[5]=='1')
    {
      $ctxt = "Open";
      $cact = "0";
    }else{
        $ctxt = "Close";
      $cact = "1";
    }
    echo "<a href=\"mprocpl.php?action=clot&sid=$sid&tid=$tid&tdo=$cact\">»$ctxt</a><br/>";
    if($tinfo[4]=='1')
    {
      $ptxt = "Unpin";
      $pact = "0";
    }else{
        $ptxt = "Pin";
      $pact = "1";
    }
  echo "<a href=\"mprocpl.php?action=pint&sid=$sid&tid=$tid&tdo=$pact\">»$ptxt</a><br/>";
  //echo "<a href=\"index.php?action=post&sid=$sid&tid=$tid&qut=$pid\">»Quote</a><br/>";
  echo "<br/>Move to:<br/>";
  echo "<form method=\"post\" action=\"mprocpl.php?action=mvt&sid=$sid&tid=$tid\">";
  $forums = mysql_query("SELECT id, name FROM ibwf_forums WHERE clubid='0'");
  echo "<select name=\"mtf\">";
  while ($forum = mysql_fetch_array($forums))
  {
    echo "<option value=\"$forum[0]\">$forum[1]</option>";
  }
  echo "</select><br/>";
  echo "<input type=\"submit\" name=\"Submit\" value=\"Move\"/><br/>";
  echo "</form>";
  }
  echo "</p>";
echo "<p align=\"center\">";
  $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
    $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
    echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
  echo xhtmlfoot();
exit();
}
///////////////////////////////////

if($action=="forumindx")
{
  addonline(getuid_sid($sid),"Forum Index","index.php?action=$action");
  $sid = cleanQuery($_GET["sid"]);
  $uid = getuid_sid($sid);
 $pstyle = gettheme($sid);
    echo xhtmlhead("Forum Menu",$pstyle);
  echo "<body>";

  echo "<div><b><i>Forum Index</i></b></div>";
  echo "<div>";
  echo "<a href=\"search.php?action=tpc&sid=$sid\">[Search]</a><br/>";

    if($page=="" || $page<=0)$page=1;
    $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_fcats"));
    $num_items = $noi[0];
    $items_per_page= 5;
    $num_pages = ceil($num_items/$items_per_page);
    if(($page>$num_pages)&&$page!=1)$page= $num_pages;
    $limit_start = ($page-1)*$items_per_page;

    $sql = "SELECT id, name, descrip FROM ibwf_fcats ORDER BY position, id
    DESC LIMIT $limit_start, $items_per_page";

    $items = mysql_query($sql);
    echo mysql_error();
    if(mysql_num_rows($items)>0)
    {
    while ($item = mysql_fetch_array($items))
    {
    $catlink = "<a href=\"index.php?action=viewcat&sid=$sid&cid=$item[0]\">[ $item[1] ]</a>";
    echo "<br/><br/>$catlink<br/><i>$item[2]</i><br/>Moderated By: ";

    $mod = "SELECT DISTINCT name FROM ibwf_modr WHERE forum='".$item[0]."' ORDER BY name";
                 $itm = mysql_query($mod);
                 echo mysql_error();
                  if(mysql_num_rows($itm)>0)
                     {
                  while ($it = mysql_fetch_array($itm))
                     {

				$who = $it[0];
				$user = getnick_uid($who);
    $vulnk = "<a href=\"index.php?action=viewuser&sid=$sid&who=$who\">$user</a>";
    echo "<i>$vulnk,</i>";
}}
    }
  }
  echo "<br/>";
    echo "</div>";
    echo "<div>";
    if($page>1)
    {
      $ppage = $page-1;
      echo "<a href=\"index.php?action=forumindx&page=$ppage&sid=$sid\">«PREV</a> ";
    }
    if($page<$num_pages)
    {
      $npage = $page+1;
      echo "<a href=\"index.php?action=forumindx&page=$npage&sid=$sid\">Next»</a>";
    }

    echo "<br/>$page of $num_pages<br/>";
    echo "</div>";
  echo "<div>";
  $var3 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online WHERE place='Forum Index'"));
  echo "<i>$var3[0] User(s) Currently Browsing Here</i><br/><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\">©$stitle</a>";
  echo "</p></div>";
  echo "</body>";
}

Jacques jacques@gw-designs.co.za http://coding.biz.tm Come join and lets make it a place to learn all the noobies how to code


NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

riderz Lead · 975 posts #2

///////////////////////////////////////////////////////////// STAFF TOOLS /////////////////////////////////////////////////////////////

echo "<a href=\"admincp.php?action=fcats&sid=$sid\">»Forum Categories</a><br/>";
echo "<a href=\"admincp.php?action=forums&sid=$sid\">»Forums</a><br/>";
echo "<a href=\"admincp.php?action=addperm&sid=$sid\">»Add permissions</a><br/>";
echo "<a href=\"admincp.php?action=ugroups&sid=$sid\">»User groups</a><br/>";

////////////////// ADMINPROC //////////////////

else if($action=="addgrp")
{
  $frname = $_POST["ugname"];
  $ugaa = $_POST["ugaa"];
  $allus = $_POST["allus"];
  $mage = $_POST["mage"];
  $mpst = $_POST["mpst"];
  $mpls = $_POST["mpls"];

    echo "<card id=\"main\" title=\"$stitle\">";
      echo "<p align=\"center\">";
        echo $ugname;
        echo "<br/>";
        $res = mysql_query("INSERT INTO ibwf_groups SET name='".$ugname."', autoass='".$ugaa."', userst='".$allus."', mage='".$mage."', posts='".$mpst."', plusses='".$mpls."'");

        if($res)
      {
        echo "<img src=\"images/ok.gif\" alt=\"O\"/>User group  added successfully";
      }else{
        echo "<img src=\"images/notok.gif\" alt=\"X\"/>Error adding User group";
      }

      echo "<br/><br/><a href=\"admincp.php?action=ugroups&sid=$sid\">";
  echo "UGroups</a><br/>";
      echo "<a href=\"index.php?action=admincp&sid=$sid\"><img src=\"images/admn.gif\" alt=\"*\"/>";
  echo "Admin CP</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Home</a>";

      echo "</p></card>";
}
else if($action=="delgrp")
{
  $ugid = $_POST["ugid"];
    echo "<card id=\"main\" title=\"$stitle\">";
      echo "<p align=\"center\">";

        echo "<br/>";
        $res = mysql_query("DELETE FROM ibwf_groups WHERE id='".$ugid."'");

        if($res)
      {
        echo "<img src=\"images/ok.gif\" alt=\"O\"/>UGroup  deleted successfully";
      }else{
        echo "<img src=\"images/notok.gif\" alt=\"X\"/>Error deleting UGroup";
      }

      echo "<br/><br/><a href=\"admincp.php?action=ugroups&sid=$sid\">";
  echo "UGroups</a><br/>";
      echo "<a href=\"index.php?action=admincp&sid=$sid\"><img src=\"images/admn.gif\" alt=\"*\"/>";
  echo "Admin CP</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Home</a>";

      echo "</p></card>";
}

else if($action=="addcat")
{
  $fcname = $_POST["fcname"];
  $fcpos = $_POST["fcpos"];
    echo "<card id=\"main\" title=\"$stitle\">";
      echo "<p align=\"center\">";
        echo $fcname;
        echo "<br/>";
        $res = mysql_query("INSERT INTO ibwf_fcats SET name='".$fcname."', position='".$fcpos."'");

        if($res)
      {
        echo "<img src=\"images/ok.gif\" alt=\"O\"/>Forum Category added successfully";
      }else{
        echo "<img src=\"images/notok.gif\" alt=\"X\"/>Error adding Forum Category";
      }

      echo "<br/><br/><a href=\"admincp.php?action=fcats&sid=$sid\">";
  echo "Forum Categories</a><br/>";
      echo "<a href=\"index.php?action=admincp&sid=$sid\"><img src=\"images/admn.gif\" alt=\"*\"/>";
  echo "Admin CP</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Home</a>";

      echo "</p></card>";
}
else if($action=="addfrm")
{
  $frname = $_POST["frname"];
  $frpos = $_POST["frpos"];
  $fcid = $_POST["fcid"];
    echo "<card id=\"main\" title=\"$stitle\">";
      echo "<p align=\"center\">";
        echo $frname;
        echo "<br/>";
        $res = mysql_query("INSERT INTO ibwf_forums SET name='".$frname."', position='".$frpos."', cid='".$fcid."'");

        if($res)
      {
        echo "<img src=\"images/ok.gif\" alt=\"O\"/>Forum  added successfully";
      }else{
        echo "<img src=\"images/notok.gif\" alt=\"X\"/>Error adding Forum ";
      }

      echo "<br/><br/><a href=\"admincp.php?action=forums&sid=$sid\">";
  echo "Forums</a><br/>";
      echo "<a href=\"index.php?action=admincp&sid=$sid\"><img src=\"images/admn.gif\" alt=\"*\"/>";
  echo "Admin CP</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Home</a>";

      echo "</p></card>";
}
else if($action=="edtfrm")
{
  $fid = $_POST["fid"];
  $frname = $_POST["frname"];
  $frpos = $_POST["frpos"];
  $fcid = $_POST["fcid"];
    echo "<card id=\"main\" title=\"$stitle\">";
      echo "<p align=\"center\">";
        echo $frname;
        echo "<br/>";
        $res = mysql_query("UPDATE ibwf_forums SET name='".$frname."', position='".$frpos."', cid='".$fcid."' WHERE id='".$fid."'");

        if($res)
      {
        echo "<img src=\"images/ok.gif\" alt=\"O\"/>Forum  updated successfully";
      }else{
        echo "<img src=\"images/notok.gif\" alt=\"X\"/>Error updating Forum ";
      }

      echo "<br/><br/><a href=\"admincp.php?action=forums&sid=$sid\">";
  echo "Forums</a><br/>";
      echo "<a href=\"index.php?action=admincp&sid=$sid\"><img src=\"images/admn.gif\" alt=\"*\"/>";
  echo "Admin CP</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Home</a>";

      echo "</p></card>";
}
else if($action=="edtcat")
{
  $fcid = $_POST["fcid"];
  $fcname = $_POST["fcname"];
  $fcpos = $_POST["fcpos"];
    echo "<card id=\"main\" title=\"$stitle\">";
      echo "<p align=\"center\">";
        echo $fcname;
        echo "<br/>";
        $res = mysql_query("UPDATE ibwf_fcats SET name='".$fcname."', position='".$fcpos."' WHERE id='".$fcid."'");

        if($res)
      {
        echo "<img src=\"images/ok.gif\" alt=\"O\"/>Forum Category updated successfully";
      }else{
        echo "<img src=\"images/notok.gif\" alt=\"X\"/>Error updating Forum Category";
      }

      echo "<br/><br/><a href=\"admincp.php?action=fcats&sid=$sid\">";
  echo "Forum Categories</a><br/>";
      echo "<a href=\"index.php?action=admincp&sid=$sid\"><img src=\"images/admn.gif\" alt=\"*\"/>";
  echo "Admin CP</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Home</a>";

      echo "</p></card>";
}
else if($action=="delfrm")
{
  $fid = $_POST["fid"];
    echo "<card id=\"main\" title=\"$stitle\">";
      echo "<p align=\"center\">";

        echo "<br/>";
        $res = mysql_query("DELETE FROM ibwf_forums WHERE id='".$fid."'");

        if($res)
      {
        echo "<img src=\"images/ok.gif\" alt=\"O\"/>Forum  deleted successfully";
      }else{
        echo "<img src=\"images/notok.gif\" alt=\"X\"/>Error deleting Forum ";
      }

      echo "<br/><br/><a href=\"admincp.php?action=forums&sid=$sid\">";
  echo "Forums</a><br/>";
      echo "<a href=\"index.php?action=admincp&sid=$sid\"><img src=\"images/admn.gif\" alt=\"*\"/>";
  echo "Admin CP</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Home</a>";

      echo "</p></card>";
}

else if($action=="delcat")
{
  $fcid = $_POST["fcid"];
    echo "<card id=\"main\" title=\"$stitle\">";
      echo "<p align=\"center\">";
        echo $fcname;
        echo "<br/>";
        $res = mysql_query("DELETE FROM ibwf_fcats WHERE id='".$fcid."'");

        if($res)
      {
        echo "<img src=\"images/ok.gif\" alt=\"O\"/>Forum Category deleted successfully";
      }else{
        echo "<img src=\"images/notok.gif\" alt=\"X\"/>Error deleting Forum Category";
      }

      echo "<br/><br/><a href=\"admincp.php?action=fcats&sid=$sid\">";
  echo "Forum Categories</a><br/>";
      echo "<a href=\"index.php?action=admincp&sid=$sid\"><img src=\"images/admn.gif\" alt=\"*\"/>";
  echo "Admin CP</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Home</a>";

      echo "</p></card>";
}
//////////////////////////Add moderating

else if($action=="addfmod")
{
    $mid = $_POST["mid"];
  $fid = $_POST["fid"];
   echo "<card id=\"main\" title=\"$stitle\">";
      echo "<p align=\"center\">";
      $res = mysql_query("INSERT INTO ibwf_modr SET name='".$mid."', forum='".$fid."'");
      if($res)
      {
        echo "<img src=\"images/ok.gif\" alt=\"O\"/>Moding Privileges Added<br/>";
      }else{
        echo "<img src=\"images/notok.gif\" alt=\"X\"/>Database Error<br/>";
      }
      echo "<br/><br/><a href=\"admincp.php?action=manmods&sid=$sid\">";
  echo "Manage Moderators</a><br/>";
      echo "<a href=\"index.php?action=admincp&sid=$sid\"><img src=\"images/admn.gif\" alt=\"*\"/>";
  echo "Admin CP</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Home</a>";
  echo "</p></card>";
}
else if($action=="delfmod")
{
    $mid = $_POST["mid"];
  $fid = $_POST["fid"];
   echo "<card id=\"main\" title=\"$stitle\">";
      echo "<p align=\"center\">";
      $res = mysql_query("DELETE FROM ibwf_modr WHERE name='".$mid."' AND forum='".$fid."'");
      if($res)
      {
        echo "<img src=\"images/ok.gif\" alt=\"O\"/>Moding Privileges Deleted<br/>";
      }else{
        echo "<img src=\"images/notok.gif\" alt=\"X\"/>Database Error<br/>";
      }
      echo "<br/><br/><a href=\"admincp.php?action=manmods&sid=$sid\">";
  echo "Manage Moderators</a><br/>";
      echo "<a href=\"index.php?action=admincp&sid=$sid\"><img src=\"images/admn.gif\" alt=\"*\"/>";
  echo "Admin CP</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Home</a>";
  echo "</p></card>";
}

///////////////////// ADMINCP ////////////////////

else if($action=="addperm")
{
      echo "<head>\n";
	  echo "<title>$stitle</title>\n";
      echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/$theme[0]\" />";
	  echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />\n";
      echo "<meta http-equiv=\"Cache-Control\" content=\"no-cache\" />\n";
      echo "<meta http-equiv=\"Pragma\" content=\"no-cache\" />\n";
	  echo "</head>";
      echo "<body>";
    echo "<p align=\"center\">";
	echo "<form action=\"admproc.php?action=addperm&sid=$sid\" method=\"post\">\n";
    echo "<b>Add permission</b>";
    $forums = mysql_query("SELECT id, name FROM ibwf_forums ORDER BY position, id, name");
    echo "<br/><br/>Forum: <select name=\"fid\">";
    while ($forum=mysql_fetch_array($forums))
    {
        echo "<option value=\"$forum[0]\">$forum[1]</option>";
    }
    echo "</select>";
    $forums = mysql_query("SELECT id, name FROM ibwf_groups ORDER BY  name, id");
    echo "<br/>UGroups: <select name=\"gid\">";
    while ($forum=mysql_fetch_array($forums))
    {
        echo "<option value=\"$forum[0]\">$forum[1]</option>";
    }
    echo "</select>";
	echo "<br/><input type=\"submit\" value=\"Update\" />\n";
	echo "</form>\n";
    echo "<br/><br/><a href=\"index.php?action=admincp&sid=$sid\"><img src=\"images/admn.gif\" alt=\"*\"/>";
  echo "Admin CP</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Home</a>";
  echo "</p>";
  echo "</body>";
  echo "</html>";
  exit();
}

//////////////////////////////////////Manage Mods

else if($action=="manmods")
{
      echo "<head>\n";
	  echo "<title>$stitle</title>\n";
      echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/$theme[0]\" />";
	  echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />\n";
      echo "<meta http-equiv=\"Cache-Control\" content=\"no-cache\" />\n";
      echo "<meta http-equiv=\"Pragma\" content=\"no-cache\" />\n";
	  echo "</head>";
      echo "<body>";

    echo "<p align=\"center\">";
	echo "<form action=\"admproc.php?action=addfmod&sid=$sid\" method=\"post\">\n";
    echo "NOTE: Some features will be added later to this page<br/><br/>";
    $mods = mysql_query("SELECT id, name FROM ibwf_users WHERE perm='1'");
    echo "Mod: <select name=\"mid\">";
    while($mod=mysql_fetch_array($mods))
    {
      echo "<option value=\"$mod[0]\">$mod[1]</option>";
    }
    echo "</select><br/>";
echo "<input type=\"submit\" value=\"update\" />\n";
echo "</form>\n";
echo "<form action=\"admproc.php?action=delfmod&sid=$sid\" method=\"post\">\n";
echo "<input type=\"submit\" value=\"Delete All Forums\" />\n";
echo "</form>\n";
  echo "<br/><br/><a href=\"index.php?action=admincp&sid=$sid\"><img src=\"images/admn.gif\" alt=\"*\"/>";
  echo "Admin CP</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Home</a>";
  echo "</p>";
  echo "</body>";
  echo "</html>";
  exit();
}
else if($action=="fcats")
{
      echo "<head>\n";
	  echo "<title>$stitle</title>\n";
      echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/$theme[0]\" />";
	  echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />\n";
      echo "<meta http-equiv=\"Cache-Control\" content=\"no-cache\" />\n";
      echo "<meta http-equiv=\"Pragma\" content=\"no-cache\" />\n";
	  echo "</head>";
      echo "<body>";

    echo "<p>";
    echo "<a href=\"admincp.php?action=addcat&sid=$sid\">»Add Category</a><br/>";
    echo "<a href=\"admincp.php?action=edtcat&sid=$sid\">»Edit Category</a><br/>";
    echo "<a href=\"admincp.php?action=delcat&sid=$sid\">»Delete Category</a><br/>";
    echo "</p>";
    echo "<p align=\"center\">";
    echo "<a href=\"index.php?action=admincp&sid=$sid\"><img src=\"images/admn.gif\" alt=\"*\"/>";
  echo "Admin CP</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Home</a>";
  echo "</p>";
    echo "</body>";
	echo "</html>";
	exit();
}
else if($action=="forums")
{
      echo "<head>\n";
	  echo "<title>$stitle</title>\n";
      echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/$theme[0]\" />";
	  echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />\n";
      echo "<meta http-equiv=\"Cache-Control\" content=\"no-cache\" />\n";
      echo "<meta http-equiv=\"Pragma\" content=\"no-cache\" />\n";
	  echo "</head>";
      echo "<body>";
    echo "<p>";
    echo "<a href=\"admincp.php?action=addfrm&sid=$sid\">»Add Forum</a><br/>";
    echo "<a href=\"admincp.php?action=edtfrm&sid=$sid\">»Edit Forum</a><br/>";
    echo "<a href=\"admincp.php?action=delfrm&sid=$sid\">»Delete Forum</a><br/>";
    echo "</p>";
    echo "<p align=\"center\">";
    echo "<a href=\"index.php?action=admincp&sid=$sid\"><img src=\"images/admn.gif\" alt=\"*\"/>";
  echo "Admin CP</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Home</a>";
  echo "</p>";
    echo "</body>";
	echo "</html>";
	exit();
}
else if($action=="addcat")
{
      echo "<head>\n";
	  echo "<title>$stitle</title>\n";
      echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/$theme[0]\" />";
	  echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />\n";
      echo "<meta http-equiv=\"Cache-Control\" content=\"no-cache\" />\n";
      echo "<meta http-equiv=\"Pragma\" content=\"no-cache\" />\n";
	  echo "</head>";
      echo "<body>";
    echo "<p align=\"center\">";
	echo "<form action=\"admproc.php?action=addcat&sid=$sid\" method=\"post\">\n";
    echo "<b>Add Category</b><br/><br/>";
    echo "Name:<input name=\"fcname\" maxlength=\"30\"/><br/>";
    echo "Position:<input name=\"fcpos\" format=\"*N\" size=\"3\"  maxlength=\"3\"/><br/>";
	echo "<input type=\"submit\" value=\"Add\" />\n";
	echo "</form>\n";
    echo "<br/><br/><a href=\"admincp.php?action=fcats&sid=$sid\">";
  echo "Forum Categories</a><br/>";
    echo "<a href=\"index.php?action=admincp&sid=$sid\"><img src=\"images/admn.gif\" alt=\"*\"/>";
  echo "Admin CP</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Home</a>";
  echo "</p>";
    echo "</body>";
	echo "</html>";
	exit();
}
else if($action=="addfrm")
{
      echo "<head>\n";
	  echo "<title>$stitle</title>\n";
      echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/$theme[0]\" />";
	  echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />\n";
      echo "<meta http-equiv=\"Cache-Control\" content=\"no-cache\" />\n";
      echo "<meta http-equiv=\"Pragma\" content=\"no-cache\" />\n";
	  echo "</head>";
      echo "<body>";
    echo "<p align=\"center\">";
	echo "<form action=\"admproc.php?action=addfrm&sid=$sid\" method=\"post\">\n";
    echo "<b>Add Forum</b><br/><br/>";
    echo "Name:<input name=\"frname\" maxlength=\"30\"/><br/>";
    echo "Position:<input name=\"frpos\" format=\"*N\" size=\"3\"  maxlength=\"3\"/><br/>";
    $fcats = mysql_query("SELECT id, name FROM ibwf_fcats ORDER BY position, id, name");
    echo "Category: <select name=\"fcid\">";
    while ($fcat=mysql_fetch_array($fcats))
    {
        echo "<option value=\"$fcat[0]\">$fcat[1]</option>";
    }
    echo "</select><br/>";
	echo "<input type=\"submit\" value=\"Add\" />\n";
	echo "</form>\n";
    echo "<br/><br/><a href=\"admincp.php?action=forums&sid=$sid\">";
  echo "Forums</a><br/>";
    echo "<a href=\"index.php?action=admincp&sid=$sid\"><img src=\"images/admn.gif\" alt=\"*\"/>";
  echo "Admin CP</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Home</a>";
  echo "</p>";
  echo "</body>";
  echo "</html>";
  exit();
}
else if($action=="edtfrm")
{
      echo "<head>\n";
	  echo "<title>$stitle</title>\n";
      echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/$theme[0]\" />";
	  echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />\n";
      echo "<meta http-equiv=\"Cache-Control\" content=\"no-cache\" />\n";
      echo "<meta http-equiv=\"Pragma\" content=\"no-cache\" />\n";
	  echo "</head>";
      echo "<body>";

    echo "<p align=\"center\">";
    echo "<b>Edit Forum</b><br/><br/>";
    $forums = mysql_query("SELECT id,name FROM ibwf_forums ORDER BY position, id, name");
    echo "<form action=\"admproc.php?action=edtfrm&sid=$sid\" method=\"post\">\n";
	echo "Forum: <select name=\"fid\">";
    while($forum=mysql_fetch_array($forums))
    {
      echo "<option value=\"$forum[0]\">$forum[1]</option>";
    }
    echo "</select>";
    echo "<br/>Name:<input name=\"frname\" maxlength=\"30\"/><br/>";
    echo "Position:<input name=\"frpos\" format=\"*N\" size=\"3\"  maxlength=\"3\"/><br/>";
    $fcats = mysql_query("SELECT id, name FROM ibwf_fcats ORDER BY position, id, name");
    echo "Category: <select name=\"fcid\">";
    while ($fcat=mysql_fetch_array($fcats))
    {
        echo "<option value=\"$fcat[0]\">$fcat[1]</option>";
    }
    echo "</select><br/>";
	echo "<input type=\"submit\" value=\"Edit\" />\n";
	echo "</form>\n";
    echo "<br/><br/><a href=\"admincp.php?action=forums&sid=$sid\">";
  echo "Forums</a><br/>";
    echo "<a href=\"index.php?action=admincp&sid=$sid\"><img src=\"images/admn.gif\" alt=\"*\"/>";
  echo "Admin CP</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Home</a>";
  echo "</p>";
  echo "</body>";
  echo "</html>";
  exit();
}
else if($action=="delfrm")
{
      echo "<head>\n";
	  echo "<title>$stitle</title>\n";
      echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/$theme[0]\" />";
	  echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />\n";
      echo "<meta http-equiv=\"Cache-Control\" content=\"no-cache\" />\n";
      echo "<meta http-equiv=\"Pragma\" content=\"no-cache\" />\n";
	  echo "</head>";
      echo "<body>";

    echo "<p align=\"center\">";
    echo "<b>Delete Forum</b><br/><br/>";
    $forums = mysql_query("SELECT id,name FROM ibwf_forums ORDER BY position, id, name");
	echo "<form action=\"admproc.php?action=delfrm&sid=$sid\" method=\"post\">\n";
    echo "Forum: <select name=\"fid\">";
    while($forum=mysql_fetch_array($forums))
    {
      echo "<option value=\"$forum[0]\">$forum[1]</option>";
    }
    echo "</select><br/>";
	echo "<input type=\"submit\" value=\"Delete\" />\n";
	echo "</form>\n";
    echo "<br/><br/><a href=\"admincp.php?action=forums&sid=$sid\">";
  echo "Forums</a><br/>";
    echo "<a href=\"index.php?action=admincp&sid=$sid\"><img src=\"images/admn.gif\" alt=\"*\"/>";
  echo "Admin CP</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Home</a>";
  echo "</p>";
  echo "</body>";
  echo "</html>";
  exit();
}
else if($action=="edtcat")
{
      echo "<head>\n";
	  echo "<title>$stitle</title>\n";
      echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/$theme[0]\" />";
	  echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />\n";
      echo "<meta http-equiv=\"Cache-Control\" content=\"no-cache\" />\n";
      echo "<meta http-equiv=\"Pragma\" content=\"no-cache\" />\n";
	  echo "</head>";
      echo "<body>";

    echo "<p align=\"center\">";
    echo "<b>Edit Category</b><br/><br/>";
	echo "<form action=\"admproc.php?action=edtcat&sid=$sid\" method=\"post\">\n";
    $fcats = mysql_query("SELECT id, name FROM ibwf_fcats ORDER BY position, id, name");
    echo "Edit: <select name=\"fcid\">";
    while ($fcat=mysql_fetch_array($fcats))
    {
        echo "<option value=\"$fcat[0]\">$fcat[1]</option>";
    }
    echo "</select><br/>";
    echo "Name:<input name=\"fcname\" maxlength=\"30\"/><br/>";
    echo "Position:<input name=\"fcpos\" format=\"*N\" size=\"3\"  maxlength=\"3\"/><br/>";
	echo "<input type=\"submit\" value=\"Edit\" />\n";
	echo "</form>\n";
    echo "<br/><br/><a href=\"admincp.php?action=fcats&sid=$sid\">";
  echo "Forum Categories</a><br/>";
    echo "<a href=\"index.php?action=admincp&sid=$sid\"><img src=\"images/admn.gif\" alt=\"*\"/>";
  echo "Admin CP</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Home</a>";
  echo "</p>";
    echo "</body>";
	echo "</html>";
	exit();
}else if($action=="delcat")
{
      echo "<head>\n";
	  echo "<title>$stitle</title>\n";
      echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/$theme[0]\" />";
	  echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />\n";
      echo "<meta http-equiv=\"Cache-Control\" content=\"no-cache\" />\n";
      echo "<meta http-equiv=\"Pragma\" content=\"no-cache\" />\n";
	  echo "</head>";
      echo "<body>";
    echo "<p align=\"center\">";
    echo "<b>Delete Category</b><br/><br/>";

    $fcats = mysql_query("SELECT id, name FROM ibwf_fcats ORDER BY position, id, name");
	echo "<form action=\"admproc.php?action=delcat&sid=$sid\" method=\"post\">\n";
    echo "Delete: <select name=\"fcid\">";

    while ($fcat=mysql_fetch_array($fcats))
    {
        echo "<option value=\"$fcat[0]\">$fcat[1]</option>";
    }
    echo "</select><br/>";
	echo "<input type=\"submit\" value=\"Delete\" />\n";
	echo "</form>\n";
    echo "<br/><br/><a href=\"admincp.php?action=fcats&sid=$sid\">";
  echo "Forum Categories</a><br/>";
    echo "<a href=\"index.php?action=admincp&sid=$sid\"><img src=\"images/admn.gif\" alt=\"*\"/>";
  echo "Admin CP</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Home</a>";
  echo "</p>";
  echo "</body>";
  echo "</html>";
  exit();
}
else if($action=="ugroups")
{
      echo "<head>\n";
	  echo "<title>$stitle</title>\n";
      echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/$theme[0]\" />";
	  echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />\n";
      echo "<meta http-equiv=\"Cache-Control\" content=\"no-cache\" />\n";
      echo "<meta http-equiv=\"Pragma\" content=\"no-cache\" />\n";
	  echo "</head>";
      echo "<body>";

    echo "<p>";
    echo "<a href=\"admincp.php?action=addgrp&sid=$sid\">»Add User Group</a><br/>";
    echo "<a href=\"admincp.php?action=delgrp&sid=$sid\">»Delete User group</a><br/>";
    echo "</p>";
    echo "<p align=\"center\">";
    echo "<a href=\"index.php?action=admincp&sid=$sid\"><img src=\"images/admn.gif\" alt=\"*\"/>";
  echo "Admin CP</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Home</a>";
  echo "</p>";
    echo "</body>";
	echo "</html>";
	exit();
}
else if($action=="addgrp")
{
      echo "<head>\n";
	  echo "<title>$stitle</title>\n";
      echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/$theme[0]\" />";
	  echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />\n";
      echo "<meta http-equiv=\"Cache-Control\" content=\"no-cache\" />\n";
      echo "<meta http-equiv=\"Pragma\" content=\"no-cache\" />\n";
	  echo "</head>";
      echo "<body>";

    echo "<p align=\"center\">";
    echo "<b>Add Group</b><br/><br/>";
	echo "<form action=\"admproc.php?action=addgrp&sid=$sid\" method=\"post\">\n";
    echo "Name:<input name=\"ugname\" maxlength=\"30\"/><br/>";
    echo "Auto Assign:<select name=\"ugaa\">";
    echo "<option value=\"1\">Yes</option>";
    echo "<option value=\"0\">No</option>";
    echo "</select><br/>";
    echo "<br/><small><b>For Auto Assign Only</b></small><br/>";
    echo "Allow:<select name=\"allus\">";
    echo "<option value=\"0\">Normal Users</option>";
    echo "<option value=\"1\">Mods</option>";
    echo "<option value=\"2\">Admins</option>";
    echo "</select><br/>";
    echo "Min. Age:";
    echo "<input name=\"mage\" format=\"*N\" maxlength=\"3\" size=\"3\"/>";
    echo "<br/>Min. Posts:";
    echo "<input name=\"mpst\" format=\"*N\" maxlength=\"3\" size=\"3\"/>";
    echo "<br/>Min. Plusses:";
    echo "<input name=\"mpls\" format=\"*N\" maxlength=\"3\" size=\"3\"/><br/>";
	echo "<input type=\"submit\" value=\"Add\" />\n";
	echo "</form>\n";
  echo "<br/><br/><a href=\"admincp.php?action=ugroups&sid=$sid\">";
  echo "UGroups</a><br/>";
    echo "<a href=\"index.php?action=admincp&sid=$sid\"><img src=\"images/admn.gif\" alt=\"*\"/>";
  echo "Admin CP</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Home</a>";
  echo "</p>";
    echo "</body>";
	echo "</html>";
	exit();
}
  

Jacques jacques@gw-designs.co.za http://coding.biz.tm Come join and lets make it a place to learn all the noobies how to code


NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

riderz Lead · 975 posts #3

////////////////////////////////////////// MPROCPL.PHP ////////////////////////////////////////////

else if($action=="rentpc")
{
  $tid = $_GET["tid"];
  $tname = $_POST["tname"];
  $fid = getfid_tid($tid);
 echo "<card id=\"main\" title=\"Mod CP\">";
  echo "<p align=\"center\">";
  $otname = gettname($tid);
  if(trim($tname!=""))
  {
    $not = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE name LIKE '".$tname."' AND fid='".$fid."'"));
    if($not[0]==0)
   {
  $res = mysql_query("UPDATE ibwf_topics SET name='"
  .$tname."' WHERE id='".$tid."'");
  if($res)
          {
            mysql_query("INSERT INTO ibwf_mlog SET action='topics', details='<b>".getnick_uid(getuid_sid($sid))."</b> Renamed The thread ".mysql_escape_string($otname)." to ".mysql_escape_string($tname)." at the forum ".getfname($fid)."', actdt='".(time() - $timeadjust)."'");
            echo "<img src=\"images/ok.gif\" alt=\"O\"/>Topic  Renamed";
          }else{
            echo "<img src=\"images/notok.gif\" alt=\"X\"/>Database Error";
          }
  }else{
    echo "<img src=\"images/notok.gif\" alt=\"X\"/>Topic Name already exist";
  }
 }else{
    echo "<img src=\"images/notok.gif\" alt=\"X\"/>You must specify a name for the topic";
  }
  echo "<br/><br/>";
  echo "<a href=\"index.php?action=viewtpc&sid=$sid&tid=$tid\">";
echo "View Topic</a><br/>";
$fname = getfname($fid);
      echo "<a href=\"index.php?action=viewfrm&sid=$sid&fid=$fid\">";
echo "$fname</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p></card>";
}
   ////////////////////////////////////////////
else if($action=="edttpc")
{
  $tid = $_GET["tid"];
  $ttext = $_POST["ttext"];
  $fid = getfid_tid($tid);
 echo "<card id=\"main\" title=\"Mod CP\">";
  echo "<p align=\"center\">";
  $res = mysql_query("UPDATE ibwf_topics SET text='"
  .$ttext."' WHERE id='".$tid."'");
  if($res)
          {
            mysql_query("INSERT INTO ibwf_mlog SET action='topics', details='<b>".getnick_uid(getuid_sid($sid))."</b> Edited the text Of the thread ".mysql_escape_string(gettname($tid))." at the forum ".getfname($fid)."', actdt='".(time() - $timeadjust)."'");
            echo "<img src=\"images/ok.gif\" alt=\"O\"/>Topic Message Edited";
          }else{
            echo "<img src=\"images/notok.gif\" alt=\"X\"/>Database Error";
          }
  echo "<br/><br/>";
  echo "<a href=\"index.php?action=viewtpc&sid=$sid&tid=$tid\">";
echo "View Topic</a><br/>";
$fname = getfname($fid);
      echo "<a href=\"index.php?action=viewfrm&sid=$sid&fid=$fid\">";
echo "$fname</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p></card>";
}

///////////////////////////////////////Close/ Open Topic
else if($action=="clot")
{
  $tid = $_GET["tid"];
  $tdo = $_GET["tdo"];
  $fid = getfid_tid($tid);
 echo "<card id=\"main\" title=\"Mod CP\">";
  echo "<p align=\"center\">";
  $res = mysql_query("UPDATE ibwf_topics SET closed='"
  .$tdo."' WHERE id='".$tid."'");
  if($res)
          {
            if($tdo==1)
            {
              $msg = "Closed";
            }else{
                $msg = "Opened";
            }
            mysql_query("INSERT INTO ibwf_mlog SET action='topics', details='<b>".getnick_uid(getuid_sid($sid))."</b> Closed The thread ".mysql_escape_string(gettname($tid))." at the forum ".getfname($fid)."', actdt='".(time() - $timeadjust)."'");
            echo "<img src=\"images/ok.gif\" alt=\"O\"/>Topic $msg";
			$tpci = mysql_fetch_array(mysql_query("SELECT name, authorid FROM ibwf_topics WHERE id='".$tid."'"));
			$tname = htmlspecialchars($tpci[0]);
			$msg = "your thread [topic=$tid]$tname"."[/topic] is $msg"."[br/][small][i]p.s: this is an automatic pm[/i][/small]";
			autopm($msg, $tpci[1]);
          }else{
            echo "<img src=\"images/notok.gif\" alt=\"X\"/>Database Error";
         }
 echo "<br/><br/>";
$fname = getfname($fid);
      echo "<a href=\"index.php?action=viewfrm&sid=$sid&fid=$fid\">";
echo "$fname</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
 echo "</p></card>";
}
  ///////////////////////////////////Delete the damn thing
else if($action=="delt")
{
  $tid = $_GET["tid"];
  $fid = getfid_tid($tid);
 echo "<card id=\"main\" title=\"Mod CP\">";
  echo "<p align=\"center\">";
  $tname=gettname($tid);
  $res = mysql_query("DELETE FROM ibwf_topics WHERE id='".$tid."'");
  if($res)
          {
            mysql_query("DELETE FROM ibwf_posts WHERE tid='".$tid."'");
            mysql_query("INSERT INTO ibwf_mlog SET action='topics', details='<b>".getnick_uid(getuid_sid($sid))."</b> Deleted The thread ".mysql_escape_string($tname)." at the forum ".getfname($fid)."', actdt='".(time() - $timeadjust)."'");
            echo "<img src=\"images/ok.gif\" alt=\"O\"/>Topic Deleted";
          }else{
            echo "<img src=\"images/notok.gif\" alt=\"X\"/>Database Error";
         }
  echo "<br/><br/>";
$fname = getfname($fid);
      echo "<a href=\"index.php?action=viewfrm&sid=$sid&fid=$fid\">";
echo "$fname</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p></card>";
}
///////////////////////////////////////Pin/ Unpin Topic
  else if($action=="pint")
 {
   $tid = $_GET["tid"];
   $tdo = $_GET["tdo"];
   $fid = getfid_tid($tid);
  echo "<card id=\"main\" title=\"Mod CP\">";
   echo "<p align=\"center\">";
   $pnd = getpinned($fid);
   if($pnd<=5)
   {
  $res = mysql_query("UPDATE ibwf_topics SET pinned='"
   .$tdo."' WHERE id='".$tid."'");
   if($res)
           {
             if($tdo==1)
             {
               $msg = "Pinned";
             }else{
                 $msg = "Unpinned";
             }
             mysql_query("INSERT INTO ibwf_mlog SET action='topics', details='<b>".getnick_uid(getuid_sid($sid))."</b> $msg The thread ".mysql_escape_string(gettname($tid))." at the forum ".getfname($fid)."', actdt='".(time() - $timeadjust)."'");
             echo "<img src=\"images/ok.gif\" alt=\"O\"/>Topic $msg";
           }else{
             echo "<img src=\"images/notok.gif\" alt=\"X\"/>Database Error";
           }
           }else{
             echo "<img src=\"images/notok.gif\" alt=\"X\"/>You can only pin 5 topics in every forum";
           }
   echo "<br/><br/>";
   $fname = getfname($fid);
       echo "<a href=\"index.php?action=viewfrm&sid=$sid&fid=$fid\">";
 echo "$fname</a><br/>";
   echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
 echo "Home</a>";
   echo "</p></card>";
 }
 //////////////////////////////////////////////////Move topic
else if($action=="mvt")
{
  $tid = $_GET["tid"];
  $mtf = $_POST["mtf"];
  $fname = htmlspecialchars(getfname($mtf));
  //$fid = getfid_tid($tid);
 echo "<card id=\"main\" title=\"Mod CP\">";
  echo "<p align=\"center\">";
   $not = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE name LIKE '".$tname."' AND fid='".$mtf."'"));
    if($not[0]==0)
    {
  $res = mysql_query("UPDATE ibwf_topics SET fid='"
  .$mtf."', moved='1' WHERE id='".$tid."'");
  if($res)
          {
            mysql_query("INSERT INTO ibwf_mlog SET action='topics', details='<b>".getnick_uid(getuid_sid($sid))."</b> Moved The thread ".mysql_escape_string($tname)." to forum ".getfname($fid)."', actdt='".(time() - $timeadjust)."'");
			$tpci = mysql_fetch_array(mysql_query("SELECT name, authorid FROM ibwf_topics WHERE id='".$tid."'"));
			$tname = htmlspecialchars($tpci[0]);
			$msg = "your thread [topic=$tid]$tname"."[/topic] Was moved to $fname forum[br/][small][i]p.s: this is an automatic pm[/i][/small]";
			autopm($msg, $tpci[1]);
            echo "<img src=\"images/ok.gif\" alt=\"O\"/>Topic Moved";
          }else{
            echo "<img src=\"images/notok.gif\" alt=\"X\"/>Database Error";
          }
  }else{
    echo "<img src=\"images/notok.gif\" alt=\"X\"/>Topic Name already exist";
  }
  echo "<br/><br/>";
      echo "<a href=\"index.php?action=viewfrm&sid=$sid&fid=$mtf\">";
echo "$fname</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p></card>";
}

///////////////////////////////////////// MCPPL.PHP ////////////////////////////////////////

  $nrps = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE reported='1'"));

    echo "<a href=\"mcppl.php?action=rps&sid=$sid\">»Posts($nrps[0])</a><br/>";

    $nrtp = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE reported='1'"));

    echo "<a href=\"mcppl.php?action=rtp&sid=$sid\">»Topics($nrtp[0])</a>";
    
    
    /////////////////////////////////Reported Posts
else if($action=="rps")
{
  $page = $_GET["page"];
    echo "<card id=\"main\" title=\"Mod CP\">";
    echo "<p align=\"center\">";
    echo "<b>Reported Posts</b>";
    echo "</p>";
    echo "<p>";
    echo "<small>";
    if($page=="" || $page<=0)$page=1;
    $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE reported ='1'"));
    $num_items = $noi[0]; //changable
    $items_per_page= 5;
    $num_pages = ceil($num_items/$items_per_page);
    if($page>$num_pages)$page= $num_pages;
    $limit_start = ($page-1)*$items_per_page;
    $sql = "SELECT id, text, tid, uid, dtpost FROM ibwf_posts WHERE reported='1' ORDER BY dtpost DESC LIMIT $limit_start, $items_per_page";
    $items = mysql_query($sql);
    while ($item=mysql_fetch_array($items))
    {
      $poster = getnick_uid($item[3]);
      $tname = htmlspecialchars(gettname($item[3]));
      $dtop = date("d m y - H:i:s", $item[4]);
      $text = parsemsg($item[1]);
      $flk = "<a href=\"index.php?action=viewuser&sid=$sid&who=$item[3]\">$poster</a>";
      $tlk = "<a href=\"index.php?action=viewtpc&sid=$sid&tid=$item[2]\">$tname</a>";
      echo "Poster: $flk<br/>In: $tlk<br/>Time: $dtop<br/>";
       echo $text;
       echo "<br/>";
       echo "<a href=\"mprocpl.php?action=hps&sid=$sid&pid=$item[0]\">Handle</a><br/><br/>";
    }
    echo "</small>";
    echo "</p>";
    echo "<p align=\"center\">";
    if($page>1)
    {
      $ppage = $page-1;
      echo "<a href=\"mcppl.php?action=$action&page=$ppage&sid=$sid\">«PREV</a> ";
    }
    if($page<$num_pages)
    {
      $npage = $page+1;
      echo "<a href=\"mcppl.php?action=$action&page=$npage&sid=$sid\">Next»</a>";
    }
    echo "<br/>$page/$num_pages<br/>";
    if($num_pages>2)
    {
      $rets = "Jump to page<input name=\"pg\" format=\"*N\" size=\"3\"/>";
        $rets .= "<anchor>[GO]";
        $rets .= "<go href=\"mcppl.php\" method=\"get\">";
        $rets .= "<postfield name=\"action\" value=\"$action\"/>";
        $rets .= "<postfield name=\"sid\" value=\"$sid\"/>";
        $rets .= "<postfield name=\"page\" value=\"$(pg)\"/>";
        $rets .= "</go></anchor>";
        echo $rets;
   }
    echo "<br/><br/>";
    echo "<a href=\"mcppl.php?action=main&sid=$sid\">";
echo "Mod R/L</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p></card>";
}
   /////////////////////////////////Reported Topics
else if($action=="rtp")
{
  $page = $_GET["page"];
    echo "<card id=\"main\" title=\"Mod CP\">";
    echo "<p align=\"center\">";
   echo "<b>Reported Topics</b>";
    echo "</p>";
    echo "<p>";
    echo "<small>";
    if($page=="" || $page<=0)$page=1;
    $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE reported ='1'"));
    $num_items = $noi[0]; //changable
    $items_per_page= 5;
    $num_pages = ceil($num_items/$items_per_page);
    if($page>$num_pages)$page= $num_pages;
    $limit_start = ($page-1)*$items_per_page;
    $sql = "SELECT id, name, text, authorid, crdate FROM ibwf_topics WHERE reported='1' ORDER BY crdate DESC LIMIT $limit_start, $items_per_page";
    $items = mysql_query($sql);
    while ($item=mysql_fetch_array($items))
    {
      $poster = getnick_uid($item[3]);
      $tname = htmlspecialchars($item[1]);
      $dtop = date("d m y - H:i:s", $item[4]);
      $text = parsemsg($item[2]);
      $flk = "<a href=\"index.php?action=viewuser&sid=$sid&who=$item[3]\">$poster</a>";
      $tlk = "<a href=\"index.php?action=viewtpc&sid=$sid&tid=$item[0]\">$tname</a>";
      echo "Poster: $flk<br/>In: $tlk<br/>Time: $dtop<br/>";
       echo $text;
       echo "<br/>";
       echo "<a href=\"mprocpl.php?action=htp&sid=$sid&tid=$item[0]\">Handle</a><br/><br/>";
    }
    echo "</small>";
    echo "</p>";
    echo "<p align=\"center\">";
    if($page>1)
    {
      $ppage = $page-1;
      echo "<a href=\"mcppl.php?action=$action&page=$ppage&sid=$sid\">«PREV</a> ";
    }
    if($page<$num_pages)
    {
      $npage = $page+1;
      echo "<a href=\"mcppl.php?action=$action&page=$npage&sid=$sid\">Next»</a>";
    }
    echo "<br/>$page/$num_pages<br/>";
    if($num_pages>2)
    {
      $rets = "Jump to page<input name=\"pg\" format=\"*N\" size=\"3\"/>";
        $rets .= "<anchor>[GO]";
        $rets .= "<go href=\"mcppl.php\" method=\"get\">";
        $rets .= "<postfield name=\"action\" value=\"$action\"/>";
        $rets .= "<postfield name=\"sid\" value=\"$sid\"/>";
        $rets .= "<postfield name=\"page\" value=\"$(pg)\"/>";
        $rets .= "</go></anchor>";
       echo $rets;
    }
    echo "<br/><br/>";
    echo "<a href=\"mcppl.php?action=main&sid=$sid\">";
echo "Mod R/L</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p></card>";
}

///////////////////////////////////////////////////// SEARCH.PHP /////////////////////////////////////////////////////

if($action=="tpc")
{      echo "<head>\n";
	  echo "<title>$stitle</title>\n";
      echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/$theme[0]\" />";
	  	  echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />\n";
      echo "<meta http-equiv=\"Cache-Control\" content=\"no-cache\" />\n";
      echo "<meta http-equiv=\"Pragma\" content=\"no-cache\" />\n";

	  echo "</head>";
      echo "<body>";

    addonline(getuid_sid($sid),"Topics search","");
	echo "<div class=\"ahblock2\">";
	echo "</div>";

    echo "<p>";
    echo "<form action=\"search.php?action=stpc&sid=$sid\" method=\"post\">";
    echo "Text: <input name=\"stext\" maxlength=\"30\"/><br/>";
    echo "In: <select name=\"sin\">";
    echo "<option value=\"1\">Topic Posts</option>";
    echo "<option value=\"2\">Topic Text</option>";
    echo "<option value=\"3\">Topic Name</option>";
    echo "</select><br/>";
    echo "Order: <select name=\"sor\">";
    echo "<option value=\"1\">Newest First</option>";
    echo "<option value=\"2\">Oldest First</option>";
    echo "</select><br/>";
    echo "<input type=\"Submit\" name=\"send\" value=\"Find It\"></form>";

    echo "</p>";

  echo "<p align=\"center\">";
  echo "<a href=\"index.php?action=search&sid=$sid\"><img src=\"images/search.gif\" alt=\"*\"/>";
echo "Search Menu</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
  	echo "<div class=\"ahblock2\">";
	echo "</div>";
  echo"</body>";
  echo "</html>";
  exit();
}
else if($action=="stpc")
{
  $stext = $_POST["stext"];
  $sin = $_POST["sin"];
  $sor = $_POST["sor"];
        echo "<head>\n";
	  echo "<title>$stitle</title>\n";
	  	  echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />\n";
      echo "<meta http-equiv=\"Cache-Control\" content=\"no-cache\" />\n";
      echo "<meta http-equiv=\"Pragma\" content=\"no-cache\" />\n";

      echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/$theme[0]\" />";
	  echo "</head>";
      echo "<body>";

    addonline(getuid_sid($sid),"Topics search","");
	echo "<div class=\"ahblock2\">";
	echo "</div>";

    echo "<p>";

        if(trim($stext)=="")
        {
            echo "<br/>Please Specify the text to search for";
        }else{
          //begin search
          if($page=="" || $page<1)$page=1;
          if($sin=="1")
          {
            $where_table = "ibwf_posts";
            $cond = "text";
            $select_fields = "id, tid";
            if($sor=="1")
            {
              $ord_fields = "dtpost DESC";
            }else{
                $ord_fields = "dtpost";
            }
          }else if($sin=="2")
          {
            $where_table = "ibwf_topics";
            $cond = "text";
            $select_fields = "name, id";
            if($sor=="1")
            {
              $ord_fields = "crdate DESC";
            }else{
                $ord_fields = "crdate";
            }
          }else if($sin=="3")
          {
            $where_table = "ibwf_topics";
            $cond = "name";
            $select_fields = "name, id";
            if($sor=="1")
            {
              $ord_fields = "crdate DESC";
            }else{
                $ord_fields = "crdate";
            }
          }
          $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ".$where_table." WHERE ".$cond." LIKE '%".$stext."%'"));
          $num_items = $noi[0];
          $items_per_page = 10;
          $num_pages = ceil($num_items/$items_per_page);
    if(($page>$num_pages)&&$page!=1)$page= $num_pages;
    $limit_start = ($page-1)*$items_per_page;

    $sql = "SELECT ".$select_fields." FROM ".$where_table." WHERE ".$cond." LIKE '%".$stext."%' ORDER BY ".$ord_fields." LIMIT $limit_start, $items_per_page";
          $items = mysql_query($sql);
          while($item=mysql_fetch_array($items))
          {
            if($sin=="1")
            {
              $tname = htmlspecialchars(gettname($item[1]));

              if($tname=="" || !canaccess(getuid_sid($sid),getfid_tid($item[1]))){
                $tlink = "Unreachable<br/>";
              }else{
              $tlink = "<a href=\"index.php?action=viewtpc&sid=$sid&tid=$item[1]&go=$item[0]\">".$tname."</a><br/>";
              }
                echo  $tlink;
            }
            else
            {
              $tname = htmlspecialchars($item[0]);
              if($tname=="" || !canaccess(getuid_sid($sid),getfid_tid($item[1]))){
                $tlink = "Unreachable<br/>";
              }else{
              $tlink = "<a href=\"index.php?action=viewtpc&sid=$sid&tid=$item[1]\">".$tname."</a><br/>";
              }
                echo  $tlink;
            }
          }
          echo "<p align=\"center\">";
    if($page>1)
    {
      $ppage = $page-1;
        $rets = "<form action=\"search.php?action=$action&sid=$sid&page=$ppage\" method=\"post\">";
	  $rets .= "<input type=\"hidden\" name=\"stext\" value=\"$stext\"/>";
	  $rets .= "<input type=\"hidden\" name=\"sin\" value=\"$sin\"/>";
	  $rets .= "<input type=\"hidden\" name=\"sor\" value=\"$sor\"/>";
        $rets .= "<input type=\"Submit\" name=\"Prev\" value=\"Prev\"></form>";

        echo $rets;

    }
    if($page<$num_pages)
    {
      $npage = $page+1;
        $rets = "<form action=\"search.php?action=$action&sid=$sid&page=$npage\" method=\"post\">";
	  $rets .= "<input type=\"hidden\" name=\"stext\" value=\"$stext\"/>";
	  $rets .= "<input type=\"hidden\" name=\"sin\" value=\"$sin\"/>";
	  $rets .= "<input type=\"hidden\" name=\"sor\" value=\"$sor\"/>";
        $rets .= "<input type=\"Submit\" name=\"Next\" value=\"Next\"></form>";

        echo $rets;

    }
    echo "<br/>$page/$num_pages<br/>";
    if($num_pages>2)
    {
        $rets = "<form action=\"search.php?action=$action&sid=$sid&page=$(pg)\" method=\"post\">";
        $rets .= "<input name=\"pg\" style=\"-wap-input-format: '*N'\" size=\"3\"/>";
	  $rets .= "<input type=\"hidden\" name=\"stext\" value=\"$stext\"/>";
	  $rets .= "<input type=\"hidden\" name=\"sin\" value=\"$sin\"/>";
	  $rets .= "<input type=\"hidden\" name=\"sor\" value=\"$sor\"/>";
        $rets .= "<input type=\"Submit\" name=\"Send\" value=\"Go To Page\"></form>";

        echo $rets;
    }
    echo "</p>";
        }

echo "</p>";

  echo "<p align=\"center\">";
  echo "<a href=\"index.php?action=search&sid=$sid\"><img src=\"images/search.gif\" alt=\"*\"/>";
echo "Search Menu</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
	echo "<div class=\"ahblock2\">";
	echo "</div>";
  echo "</body>";
  echo "</html>";
  exit();

}

Jacques jacques@gw-designs.co.za http://coding.biz.tm Come join and lets make it a place to learn all the noobies how to code


NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

riderz Lead · 975 posts #4

///////////////////////////////////////////////// SQL /////////////////////////////////////////////////

--
-- Table structure for table `ibwf_topics`
--

DROP TABLE IF EXISTS `ibwf_topics`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ibwf_topics` (
  `id` int(100) NOT NULL auto_increment,
  `name` varchar(30) NOT NULL default '',
  `fid` int(100) NOT NULL default '0',
  `authorid` int(100) NOT NULL default '0',
  `text` blob NOT NULL,
  `pinned` char(1) NOT NULL default '0',
  `closed` char(1) NOT NULL default '0',
  `crdate` int(100) NOT NULL default '0',
  `views` int(100) NOT NULL default '0',
  `reported` char(1) NOT NULL default '0',
  `lastpost` int(100) NOT NULL default '0',
  `moved` char(1) NOT NULL default '0',
  `pollid` int(100) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1132 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `ibwf_topics`
--

--
-- Table structure for table `ibwf_posts`
--

DROP TABLE IF EXISTS `ibwf_posts`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ibwf_posts` (
  `id` int(100) NOT NULL auto_increment,
  `text` blob NOT NULL,
  `tid` int(100) NOT NULL default '0',
  `uid` int(100) NOT NULL default '0',
  `dtpost` int(100) NOT NULL default '0',
  `reported` char(1) NOT NULL default '0',
  `quote` int(100) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=5878 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `ibwf_posts`
--

--
-- Table structure for table `ibwf_acc`
--

DROP TABLE IF EXISTS `ibwf_acc`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ibwf_acc` (
  `id` int(100) NOT NULL auto_increment,
  `gid` int(100) NOT NULL default '0',
  `fid` int(100) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `ibwf_acc`
--

-- Table structure for table `ibwf_clubmembers`
--

DROP TABLE IF EXISTS `ibwf_clubmembers`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ibwf_clubmembers` (
  `id` int(100) NOT NULL auto_increment,
  `uid` int(100) NOT NULL default '0',
  `clid` int(100) NOT NULL default '0',
  `accepted` char(1) NOT NULL default '0',
  `points` int(100) NOT NULL default '0',
  `joined` int(100) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=81 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `ibwf_clubmembers`
--

--
-- Table structure for table `ibwf_groups`
--

DROP TABLE IF EXISTS `ibwf_groups`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ibwf_groups` (
  `id` int(10) NOT NULL auto_increment,
  `name` varchar(50) NOT NULL default '',
  `autoass` char(1) NOT NULL default '1',
  `mage` int(10) NOT NULL default '0',
  `userst` char(1) NOT NULL default '0',
  `posts` int(100) NOT NULL default '0',
  `plusses` int(100) NOT NULL default '0',
  `maxage` int(10) NOT NULL default '0',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `name` (`name`)
) ENGINE=MyISAM AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `ibwf_groups`
--

ibwf_users
  `birthday` varchar(50) NOT NULL default '',
 `perm` char(1) NOT NULL default '0',
  `posts` int(100) NOT NULL default '0',
    `plusses` int(100) NOT NULL default '100',
   `lastvst` int(100) NOT NULL default '0',
 `id` int(100) NOT NULL auto_increment,
  `name` varchar(30) NOT NULL default '',

    --
-- Table structure for table `ibwf_online`
--

DROP TABLE IF EXISTS `ibwf_online`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ibwf_online` (
  `id` int(10) NOT NULL auto_increment,
  `userid` int(100) NOT NULL default '0',
  `actvtime` int(100) NOT NULL default '0',
  `place` varchar(50) NOT NULL default '',
  `placedet` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `userid` (`userid`)
) ENGINE=MyISAM AUTO_INCREMENT=18896 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `ibwf_online`
--

--
-- Table structure for table `ibwf_fcats`
--

DROP TABLE IF EXISTS `ibwf_fcats`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ibwf_fcats` (
  `id` int(50) NOT NULL auto_increment,
  `name` varchar(30) NOT NULL default '',
  `position` int(50) NOT NULL default '0',
  `descrip` varchar(70) NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `name` (`name`)
) ENGINE=MyISAM AUTO_INCREMENT=16 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `ibwf_fcats`
--

--
-- Table structure for table `ibwf_modr`
--

DROP TABLE IF EXISTS `ibwf_modr`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ibwf_modr` (
  `id` int(11) NOT NULL auto_increment,
  `name` int(100) NOT NULL default '0',
  `forum` varchar(99) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `ibwf_modr`
--
--
-- Table structure for table `ibwf_clubs`
--

DROP TABLE IF EXISTS `ibwf_clubs`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ibwf_clubs` (
  `id` int(100) NOT NULL auto_increment,
  `owner` int(100) NOT NULL default '0',
  `name` varchar(30) NOT NULL default '',
  `description` varchar(200) NOT NULL default '',
  `rules` blob NOT NULL,
  `logo` varchar(200) NOT NULL default '',
  `plusses` int(100) NOT NULL default '0',
  `created` int(100) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `ibwf_clubs`
--
--
-- Table structure for table `ibwf_rss`
--

DROP TABLE IF EXISTS `ibwf_rss`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ibwf_rss` (
  `id` int(50) NOT NULL auto_increment,
  `title` varchar(50) NOT NULL default '',
  `link` varchar(150) NOT NULL default '',
  `srcd` varchar(200) NOT NULL default '',
  `dscr` varchar(100) NOT NULL default '',
  `imgsrc` varchar(100) NOT NULL default '',
  `pubdate` varchar(50) NOT NULL default '',
  `fid` int(50) NOT NULL default '0',
  `lupdate` int(100) NOT NULL default '0',
  `pgurl` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `ibwf_rss`
--
     --
-- Table structure for table `ibwf_mlog`
--

DROP TABLE IF EXISTS `ibwf_mlog`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ibwf_mlog` (
  `id` int(100) NOT NULL auto_increment,
  `action` varchar(10) NOT NULL default '',
  `details` blob NOT NULL,
  `actdt` int(100) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1006 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `ibwf_mlog`
--

Jacques jacques@gw-designs.co.za http://coding.biz.tm Come join and lets make it a place to learn all the noobies how to code


NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close