View file wapirate/xhtml/guest/index.php

File size: 23.94Kb
<?php





include("captainsafecore.php");

include("../captainsafeconfig.php");





header("Content-type: text/html; charset=ISO-8859-1");

echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";

echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\"\"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">";

echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">";



	echo "<head>";

	echo "<title>$stitle</title>";

	echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes1.php\">";

echo "

<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />

<meta http-equiv=\"Cache-Control\" content=\"no-cache\"/>

<meta name=\"description\" content=\"wapirate :)\"> 

<meta name=\"keywords\" content=\"free, community, forums, chat, wap, communicate\">

";

	

	echo "</head>";



	echo "<body>";



$bcon = connectdb();

if (!$bcon)

{

    

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

    echo "<img src=\"images/error.gif\" alt=\"*\"/><br/>";

    echo "ERROR! cannot connect to database<br/><br/>";

    echo "This error usually happens when backing up the database, please be patient, The site will be up as soon as possible<br/><br/>";

    echo "You can temporary use our other <a href=\"http://wapirate.mygamesonline.org/chat/index.php\">chatroom</a> while wapirate is offline<br/>";

    echo "<b>THANK YOU VERY MUCH</b>";

    echo "</p>";

    exit();

}



$action = $_GET["action"];

$sid = $_GET["sid"];

$page = $_GET["page"];

$who = $_GET["who"];

$addy = "wapirate.net";

$uid = getuid_sid($sid);



cleardata();

if(isipbanned($uip,$ubr))

    {

      if(!isshield(getuid_sid($sid)))

      {

        

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

      echo "<img src=\"images/notok.gif\" alt=\"x\"/><br/>";

      echo "This IP address is blocked<br/>";

      echo "<br/>";

      echo "However we grant a shield against IP-Ban for our best users, you can try to see if you are shielded by trying to login, if you keep coming to this page that means you are not shielded, so come back when the ip-ban period is over<br/><br/>";

      $banto = mysql_fetch_array(mysql_query("SELECT  timeto FROM ibwf_penalties WHERE  penalty='2' AND ipadd='".$uip."' AND browserm='".$ubr."' LIMIT 1 "));

      //echo mysql_error();

      $remain =  $banto[0] - time();

      $rmsg = gettimemsg($remain);

      echo " IP: $rmsg<br/><br/>";

      

      echo "</p>";

      echo "<p>";

  echo "<form action=\"/xhtml/login.php\" method=\"get\">";

  echo "username:<br/> <input name=\"loguid\" format=\"*x\" size=\"8\" maxlength=\"30\"/><br/>";

  echo "password:<br/> <input type=\"password\" name=\"logpwd\" size=\"8\" maxlength=\"30\"/><br/>";

echo "<input type=\"submit\" value=\"login &#187;\"/>";

echo "</form>"; 

  echo "</p>";

      exit();

      }

    }



if(isbanned($uid))

    {

        

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

      echo "<img src=\"images/notok.gif\" alt=\"x\"/><br/>";

      echo "You are <b>Banned</b><br/>";

      $banto = mysql_fetch_array(mysql_query("SELECT timeto FROM ibwf_penalties WHERE uid='".$uid."' AND penalty='1'"));

	  $banres = mysql_fetch_array(mysql_query("SELECT lastpnreas FROM ibwf_users WHERE id='".$uid."'"));

	  

      $remain = $banto[0]- time();

      $rmsg = gettimemsg($remain);

      echo "Time to finish your penalty: $rmsg<br/><br/>";

	  echo "Ban Reason: $banres[0]";

      //echo "<a href=\"index.php\">Login</a>";

      echo "</p>";

      exit();

    }





///////////////////////////////////////view cat

if($action=="viewcat")

{

    $cid = $_GET["cid"];

    $cinfo = mysql_fetch_array(mysql_query("SELECT name from ibwf_fcats WHERE id='".$cid."'"));

$cnm = htmlspecialchars($cinfo[0]);

      echo "<div><br/>$cnm<br/></div>";  

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

    echo getshoutbox($sid);

echo "</p>";

    echo "<p>";

    $forums = mysql_query("SELECT id, name FROM ibwf_forums WHERE cid='".$cid."' AND clubid='0' ORDER BY position, id, name");

    echo "";

    while($forum = mysql_fetch_array($forums))

    {

      if(canaccess(getuid_sid($sid), $forum[0]))

      {

        $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&amp;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&amp;tid=$lpt[0]&amp;go=last\">$tlnm</a>";

      $vulnk = "<a href=\"index.php?action=viewuser&amp;who=$tluid\">$tlnick</a>";

      echo "Last Post: $tpclnk, BY: $vulnk<br/><br/>";

      }

    }

    echo "";

    echo "</p>";

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

echo "<a href=\"index.php?action=boards\">Forums</a><br/>";

  echo "<a href=\"/xhtml/index.php\"><img src=\"/images/home.gif\" alt=\"*\"/>";

echo "Home</a>";

  echo "</p>";

    echo "<div>$addy</div>";

}



//////////////////////////////////View Topic



else if($action=="viewtpc")

{

  $tid = $_GET["tid"];

  $go = $_GET["go"];

  $tfid = mysql_fetch_array(mysql_query("SELECT fid FROM ibwf_topics WHERE id='".$tid."'"));

  if(!canaccess(getuid_sid($sid), $tfid[0]))

    {

        

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

      echo "You Don't Have Permission To View The Contents Of This Forum<br/><br/>";

      echo "<a href=\"/xhtml/index.php\">Home</a>";

      echo "</p>";

      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]);

          echo "<div><br/>$tnm<br/></div>"; 

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

echo getshoutbox($sid);

echo "<br/><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&amp;tid=$tid\">Post Reply</a>";

    $lastlink = "<a href=\"index.php?action=$action&amp;tid=$tid&amp;go=last\">Last Page</a>";

    $firstlink = "<a href=\"index.php?action=$action&amp;tid=$tid&amp;page=1\">First Page</a> ";

    $golink = "";

    if($page>1)

    {

      $golink = $firstlink;

    }

    if($page<$num_pages)

    {

      $golink .= $lastlink;

    }

    if($golink !="")

    {

      echo "<br/>$golink";

    }

    echo "</p>";

    echo "<p>";

    $vws = $tinfo[4]+1;

    $rpls = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE tid='".$tid."'"));

    echo "Replies: $rpls[0] - Views: $vws<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=\"-\"/>";

    }

    $usl = "<br/><a href=\"index.php?action=viewuser&amp;who=$ttext[0]\">$iml$unick</a>";

    $topt = "<a href=\"index.php?action=tpcopt&amp;tid=$tid\">*</a>";

    if($go==$tid)

    {

      $fli = "<img src=\"/images/flag.gif\" alt=\"!\"/>";

    }else{

      $fli ="";

    }

    $pst = parsemsg($ttext[1],$sid);

    echo "$usl: $fli$pst $topt<br/>";

////

$path = mysql_fetch_array(mysql_query("SELECT path, hits, size, filename FROM download_topic WHERE tid='".$tid."'"));

$osize = round($path[2],1);

if($osize>1023)

{

$msize = $osize / 1024;

$nsize = round($msize,2);

$size = "$nsize mb";

}else{

$size = "$osize kb";

}

if($path[1]==1)

{

$views = "1 view";

}else{

$views = "$path[1] views";

}

if($path[0]==""){

$hmm = "";

}else{

$hmm = "<small>&#187;Attatchment<br/>&#187;<a href=\"index.php?action=gettopic&amp;tid=$tid\">$path[3]</a> ($size / $views)</small><br/>";

}

echo "$hmm";

////

    $dtot = date("d-m-y - H:i:s",$ttext[2]);

    echo $dtot;

    echo "<br/>";

    if($ttext[3]>0)

    {

      echo "<a href=\"index.php?action=viewtpl&amp;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=\"-\"/>";

    }

    $usl = "<br/><a href=\"index.php?action=viewuser&amp;who=$post[2]\">$iml$unick</a>";

    $pst = parsemsg($post[1], $sid);

    $topt = "<a href=\"index.php?action=pstopt&amp;pid=$post[0]&amp;page=$page&amp;fid=$tinfo[5]\">*</a>";

    if($post[4]>0)

    {

        $qtl = "<i><a href=\"index.php?action=viewtpc&amp;tid=$tid&amp;pst=\">(quote:p=wapirate,d=16-04-2006)</a></i>";

    }

    if($go==$post[0])

    {

      $fli = "<img src=\"/images/flag.gif\" alt=\"!\"/>";

    }else{

      $fli ="";

    }

    echo "$usl: $fli$pst $topt<br/>";

///////////

$path = mysql_fetch_array(mysql_query("SELECT path, hits, size, filename FROM download_post WHERE pid='".$post[0]."'"));

//$size = round($path[2],0);

$osize = round($path[2],1);

if($osize>1023)

{

$msize = $osize / 1024;

$nsize = round($msize,2);

$size = "$nsize mb";

}else{

$size = "$osize kb";

}

if($path[1]==1)

{

$views = "1 view";

}else{

$views = "$path[1] views";

}

if($path[0]==""){

$hmm = "";

}else{

$hmm = "<small>&#187;Attatchment<br/>&#187;<a href=\"index.php?action=getpost&amp;pid=$post[0]\">$path[3]</a> ($size / $views)</small><br/>";

}

echo "$hmm";

////////////

    $dtot = date("d-m-y - H:i:s",$post[3]);

    echo $dtot;

    echo "<br/>";

  }

    ///to here

    echo "</p>";

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



    if($page>1)

    {

      $ppage = $page-1;

      echo "<a href=\"index.php?action=viewtpc&amp;page=$ppage&amp;tid=$tid\">&#171;PREV</a> ";

    }

    if($page<$num_pages)

    {

      $npage = $page+1;

      echo "<a href=\"index.php?action=viewtpc&amp;page=$npage&amp;tid=$tid\">Next&#187;</a>";

    }

    echo "<br/>$page/$num_pages<br/>";

    if($num_pages>2)

    {



        $rets = "<form action=\"index.php\" method=\"get\">";

      $rets .= "Jump To Page: <input name=\"page\" format=\"*N\" size=\"3\"/>";

        $rets .= "<input type=\"submit\" value=\"GO\"/>";

        $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 .= "</form>";



        echo $rets;

    }

echo "<br/>";

    echo "<a href=\"index.php?action=post&amp;tid=$tid\">Post Reply</a>";

    echo "</p>";

    echo "<p>";

    $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];



    echo "<a href=\"/xhtml/index.php?\">";

echo "Home</a>&gt;";

echo "<a href=\"index.php?action=boards\">Forums</a>&gt;";

$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&amp;cid=$cid[0]\">";

    echo "$cname</a><br/>";

    }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&amp;clid=$cid[0]\">";

    echo "$cname Club</a><br/>";

  }

  $fname = htmlspecialchars($fname);

    echo "&gt;<a href=\"index.php?action=viewfrm&amp;fid=$fid\">$fname</a>&gt;$tnm";

  echo "</p>";

   echo "<div>$addy</div>"; 

}

//////////////////////////////////View Forum



else if($action=="viewfrm")

{

  

    $fid = $_GET["fid"];

	$view = $_GET["view"];

    if(!canaccess(getuid_sid($sid), $fid))

    {

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

      echo "You Don't Have Permission To View The Contents Of This Forum<br/><br/>";

      echo "<a href=\"/xhtml/index.php\">Home</a>";

      echo "</p>";

      exit();

    }

    $finfo = mysql_fetch_array(mysql_query("SELECT name from ibwf_forums WHERE id='".$fid."'"));

    $fnm = htmlspecialchars($finfo[0]);

      echo "<div><br/>$fnm<br/></div>"; 

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



echo getshoutbox($sid);

echo "<br/><br/>";

    $norf = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_rss WHERE fid='".$fid."'"));

    if($norf[0]>0)

    {

        echo "<a href=\"index.php\"><img src=\"images/rss.gif\" alt=\"rss\"/>$finfo[0] Extras</a><br/>";

    }

    echo "<a href=\"index.php\">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 "Viewing topics that has no new posts since your last visit";

	}else if($view=="myps")

	{

		echo "Viewing topics contain posts by you";

	}else {

	echo "Viewing All topics";

	}

    echo "</p>";

    echo "<p>";

    echo "";

    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&amp;tid=$topic[0]\">$iml$pltx$tnm($nop[0])$atxt</a>  &#187;<a href=\"index.php?action=viewtpc&amp;go=last&amp;tid=$topic[0]\">&#187;</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 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 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 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)";

      }

      $tnm = htmlspecialchars($topic[1]);

      echo "<a href=\"index.php?action=viewtpc&amp;tid=$topic[0]\">$iml$tnm($nop[0])$atxt</a> &#187;<a href=\"index.php?action=viewtpc&amp;go=last&amp;tid=$topic[0]\">&#187;</a><br/>";



    }



    echo "";



    echo "</p>";

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



    if($page>1)

    {

      $ppage = $page-1;

      echo "<a href=\"index.php?action=viewfrm&amp;page=$ppage&amp;fid=$fid&amp;view=$view\">&#171;PREV</a> ";

    }

    if($page<$num_pages)

    {

      $npage = $page+1;

      echo "<a href=\"index.php?action=viewfrm&amp;page=$npage&amp;fid=$fid&amp;view=$view\">Next&#187;</a>";

    }

    echo "<br/>$page/$num_pages<br/>";

    if($num_pages>2)

    {



        $rets = "<form action=\"index.php\" method=\"get\">";

      $rets .= "Jump To Page: <input name=\"page\" format=\"*N\" size=\"3\"/>";

        $rets .= "<input type=\"submit\" value=\"GO\"/>";

        $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 .= "</form>";



        echo $rets;

    }



    echo "<br/><br/><a href=\"index.php?action=newtopic&amp;fid=$fid\">New Topic</a><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&amp;cid=$cid[0]\">";

    echo "$cname</a><br/>";

    }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&amp;clid=$cid[0]\">";

    echo "$cname Club</a><br/>";

    }

echo "<a href=\"index.php?action=boards\">Forums</a><br/>";

  echo "<a href=\"/xhtml/index.php\"><img src=\"/images/home.gif\" alt=\"*\"/>";

echo "Home</a>";

  echo "</p>";

  echo "<div>$addy</div>";  

}

///////////////////////////////////////forum boards/menu  

else if($action=="boards")

{

      echo "<div><br/>Forums<br/></div>"; 

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

    echo getshoutbox($sid);

echo "</p>";

   echo "<p>";

  $fcats = mysql_query("SELECT id, name FROM ibwf_fcats ORDER BY position, id");

  $iml = "<img src=\"/images/1.gif\" alt=\"*\"/>";

  while($fcat=mysql_fetch_array($fcats))

  {

    $catlink = "<a href=\"index.php?action=viewcat&amp;cid=$fcat[0]\">$iml$fcat[1]</a>";

    echo "<br/>$catlink";

    $forums = mysql_query("SELECT id, name FROM ibwf_forums WHERE cid='".$fcat[0]."' AND clubid='0' ORDER BY position, id, name");

    if(getfview()==0)

    {

    echo "<br/>";

    while($forum=mysql_fetch_array($forums))

        {

      if(canaccess(getuid_sid($sid),$forum[0]))

      {

        

      echo "<a href=\"index.php?action=viewfrm&amp;fid=$forum[0]\">$forum[1]</a>, ";

      }

    }

    echo "";

    }else if(getfview()==20)

    {

echo "<form action=\"index.php\" method=\"get\">";

      echo "<br/>Forums: <select name=\"fid\">";

      while($forum=mysql_fetch_array($forums))

        {

      if(canaccess(getuid_sid($sid),$forum[0]))

      {

        $notp = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$forum[0]."'"));

      echo "<option value=\"$forum[0]\">$forum[1]($notp[0])</option>";

      }

      }

      echo "</select>";

echo "<input type=\"submit\" value=\"GO\"/>";

     echo "<go href=\"index.php\" method=\"get\">";

      echo "<input type=\"hidden\" name=\"action\" value=\"viewfrm\"/>";

      echo "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";

      echo "<input type=\"hidden\" name=\"fid\" value=\"$(fid)\"/>";

echo "</form>";

    }

  }

  echo "</p>";

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

  echo "<br/><a href=\"/xhtml/index.php\">Home</a>";

  echo "</p>";

echo "<div>$addy</div>";

  }

////////////////////////////////////////MAIN PAGE Here

else{

echo "<div><small>".date("D d M y - ")."</small>\n";

  $wapirateNew_Time = time() + (23 * 60 * 60); 

  $wapiratetime=date("H:i",$wapirateNew_Time);

echo "<small>$wapiratetime</small><br/>";

   echo "<img src=\"images/logo.gif\" alt=\"wapirate\"/><br/></div>";

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

echo "You Need To Login To Access This Feature<br/><br/><br/>";

 echo "</p>";

echo "<form action=\"../login.php\" method=\"get\">";

  echo "UserID:<br/> <input name=\"loguid\" format=\"*x\" size=\"8\" maxlength=\"30\"/><br/>";

  echo "Password:<br/> <input type=\"password\" name=\"logpwd\" size=\"8\" maxlength=\"30\"/><br/>";

echo "<input type=\"submit\" value=\"GO\"/>";

echo "</form>";

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

echo "<br/><br/>Not registered yet? <br/><a href=\"../register.php\">SIGN UP</a><br/>";

echo "<br/><br/><br/>";

echo "<br/><a href=\"../index.php\"><img src=\"/images/home.gif\" alt=\"*\"/>";

echo "Home</a><br/>";

echo "</p>";

echo "<div>&#169; wapirate</div>";

}





	echo "</body>";

	echo "</html>";

?>