View file retrivewap/inx.php

File size: 194.15Kb
<?php
/*
Arawap wap forum
by  araa
*/
//» &#187;
//« &#171;
include("config.php");
include("core.php");
include("xhtmlfunctions.php");
header("Content-type: text/html; charset=ISO-8859-1");
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";

?>

<?php

$bcon = connectdb();
$uid = getuid_sid($sid);
$lang = mysql_fetch_array(mysql_query("SELECT lang FROM ibwf_users WHERE id='".$uid."'"));
include("language.php");
if (!$bcon)
{
    $pstyle = gettheme1("1");
    echo xhtmlhead("Arawap (ERROR!)",$pstyle);
    echo "<p align=\"center\">";
    echo "<img src=\"images/exit.gif\" alt=\"*\"/><br/>";
    echo "ERROR! cannot connect to database<br/><br/>";
    echo "This error happens usually when backing up the database, please be patient, The site will be up any minute<br/><br/>";
    echo "<b>THANK YOU VERY MUCH</b>";
    echo "</p>";
  echo xhtmlfoot();
      exit();
}
$brws = explode("/",$_SERVER['HTTP_USER_AGENT']);
$ubr = $brws[0];
$uip = getip();
$action = $_GET["action"];
$sid = $_GET["sid"];
$page = $_GET["page"];
$who = $_GET["who"];

cleardata();
if(isipbanned($uip,$ubr))
    {
      if(!isshield(getuid_sid($sid)))
      {
      $pstyle = gettheme1("1");
      echo xhtmlhead("Arawap",$pstyle);
      echo "<p align=\"center\">";
      echo "<img src=\"images/notok.gif\" alt=\"x\"/><br/>";
      echo "This IP address is blocked<br/>";
      echo "<br/>";
      echo "How ever we grant a shield against IP-Ban for our great users, you can try to see if you are shielded by trying to log-in, if you kept 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_metpenaltiespl WHERE  penalty='2' AND ipadd='".$uip."' AND browserm='".$ubr."' LIMIT 1 "));
      //echo mysql_error();
      $remain =  $banto[0] - (time() - $timeadjust) ;
      $rmsg = gettimemsg($remain);
      echo "Time to unblock the IP: $rmsg<br/><br/>";
      
      echo "</p>";
      echo "<p>";
  echo "<form action=\"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\"/>";
echo "</form>"; 
  echo "</p>";
  echo xhtmlfoot();
      exit();
      }
    }
if(($action != "") && ($action!="terms"))
{
    $uid = getuid_sid($sid);
    if((islogged($sid)==false)||($uid==0))
    {
      $pstyle = gettheme($sid);
      echo xhtmlhead("Arawap",$pstyle);
      echo "<p align=\"center\">";
      echo "You are not logged in<br/>";
      echo "Or Your session has been expired<br/><br/>";
      echo "<a href=\"index.php\">Login</a>";
      echo "</p>";
  echo xhtmlfoot();
      exit();
    }
    
    
    
}
//echo isbanned($uid);
if(isbanned($uid))
    {
      $pstyle = gettheme($sid);
      echo xhtmlhead("Arawap",$pstyle);
      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_metpenaltiespl WHERE uid='".$uid."' AND penalty='1'"));
	  $banres = mysql_fetch_array(mysql_query("SELECT lastpnreas FROM ibwf_users WHERE id='".$uid."'"));
	  
      $remain = $banto[0]- (time() - $timeadjust) ;
      $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>";
  echo xhtmlfoot();
      exit();
    }
$res = mysql_query("UPDATE ibwf_users SET browserm='".$ubr."', ipadd='".$uip."' WHERE id='".getuid_sid($sid)."'");

////////////////////////////////////////MAIN PAGE
if($action=="main")
{
  $showicons = mysql_fetch_array(mysql_query("SELECT showicon FROM ibwf_users WHERE id='".$uid."'"));
  $showtime = mysql_fetch_array(mysql_query("SELECT showtime FROM ibwf_users WHERE id='".$uid."'"));
  $showshout = mysql_fetch_array(mysql_query("SELECT showshout FROM ibwf_users WHERE id='".$uid."'"));
  $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]."'"));
  
  if($showicons[0]=="1"){
  $iconinn =       "<img src=\"images/themes/$themeimageset[0]/inbox2.gif\" alt=\"*\"/>";
  $iconino =       "<img src=\"images/themes/$themeimageset[0]/inbox1.gif\" alt=\"*\"/>";
  $iconbuddy =     "<img src=\"images/themes/$themeimageset[0]/buddies.gif\" alt=\"*\"/>";
  $iconchat =      "<img src=\"images/themes/$themeimageset[0]/chat.gif\" alt=\"*\"/>";
  $iconforum =     "<img src=\"images/themes/$themeimageset[0]/forum.gif\" alt=\"*\"/>";
  $iconclub =      "<img src=\"images/themes/$themeimageset[0]/clubs.gif\" alt=\"*\"/>";
  $icongames =     "<img src=\"images/themes/$themeimageset[0]/games.gif\" alt=\"*\"/>";
  $icondownloads = "<img src=\"images/themes/$themeimageset[0]/downloads.gif\" alt=\"*\"/>";
  $iconusergall =  "<img src=\"images/themes/$themeimageset[0]/usergallery.gif\" alt=\"*\"/>";
  $iconcp =        "<img src=\"images/themes/$themeimageset[0]/cpanel.gif\" alt=\"*\"/>";
  $iconshop =      "<img src=\"images/arashop.gif\" alt=\"*\"/>";
  $iconupl =      "<img src=\"images/dwn.gif\" alt=\"*\"/>";
   $iconfree =      "<img src=\"images/free.gif\" alt=\"*\"/>";
    $iconextra =      "<img src=\"images/faq.gif\" alt=\"*\"/>";
  }else
  if($showicons[0]=="0"){
  $iconinn =       "&#187;";
  $iconino =       "&#187;";
  $iconbuddy =     "&#187;";
  $iconchat =      "&#187;";
  $iconforum =     "&#187;";
  $iconclub =      "&#187;";
  $icongames =     "&#187;";
  $icondownloads = "&#187;";
  $iconusergall =  "&#187;";
  $iconcp =        "&#187;";
  $iconshop =      "&#187;";
   $iconupl =      "&#187;";
   $iconfree =      "&#187;";
   $iconextra =      "&#187;";
  }
  
  addvisitor();
  addonline(getuid_sid($sid),"Main Page - xHTML","index.php?action=$action");
  //saveuinfo($sid);
  $pstyle = gettheme($sid);
  echo xhtmlhead("Arawap",$pstyle);
  echo "<p align=\"center\">";
include ("pops.php");
include ("music.php");
  if($showtime[0]=="1"){
    $TimeZone="3.5"; ////Change the TimeZone accordingly!
$New_Time = time() + ($TimeZone * 60 * 60);
  echo "<small><a href=\"time.php?sid=$sid\"><blink>".date("D d M y - H:i",$New_Time)."</blink></a></small><br/>";
  }
  
$TimeZone="3.5"; ////Change the TimeZone accordingly!
$New_Time = (time() - $timeadjust) + ($TimeZone * 60 * 60);

$show_date=date("D dS F, Y",$New_Time); 
$show_time=date("H:i",$New_Time); 
$Hour=date("G",$New_Time);


  echo "<img src=\"images/themes/$themeimageset[0]/logo.jpg\" alt=\"Arawap\"/><br/>";
  echo "</p>";
  
$nick = getnick_sid($sid);
if ($Hour <= 4) { echo "<h5 align=\"center\"><MARQUEE WIDTH=100% BEHAVIOR=ALTERNATE>$nick $lang16</h5></MARQUEE>"; } 

else if ($Hour <= 11) { echo "<h5 align=\"center\"><MARQUEE WIDTH=100% BEHAVIOR=ALTERNATE>$lang17 $nick!</MARQUEE></h5>"; } 

else if ($Hour <= 12) { echo "<h5 align=\"center\"><MARQUEE WIDTH=100% BEHAVIOR=ALTERNATE>$lang18 $nick!</MARQUEE></h5>"; }

else if ($Hour <= 17) { echo "<h5 align=\"center\"><MARQUEE WIDTH=100% BEHAVIOR=ALTERNATE>$lang19 $nick!</MARQUEE></h5>"; } 

else if ($Hour <= 22) { echo "<h5 align=\"center\"><MARQUEE WIDTH=100% BEHAVIOR=ALTERNATE>$lang20 $nick!</MARQUEE></h5>"; }

  echo "<p align=\"center\"><small>";
  $fmsg = parsepm(getfmsg(), $sid);
  echo "$fmsg<br/>";
  echo "</small></p>";
  
    if($showshout[0]=="1"){
  echo "<br/>";

  echo "<div class=\"mblock2\">";
  echo "<center><b><u>$lang32</u></b></center>";
  echo "<small>";
  echo getshoutbox($sid);
  echo "</small>";
  echo "</div>";
  }
   echo "<br/>";
  echo "<div class=\"mblock1\">";
  echo "<center><b><u>$lang40</u></b></center>";
  echo "<small>";    
  /////inbox data
  
  $new_gm = getnewgml(getuid_sid($sid));
  if($new_gm>0)
  {
  echo "<a href=\"rwgmail.php?sid=$sid\">&#187;G-Mail(".$new_gm.")</a><br/>";
  }   
    
  $tmsg = getpmcount(getuid_sid($sid));
  $umsg = getunreadpm(getuid_sid($sid));  
  if($umsg==1)
  {
  echo "1 <a accesskey=\"1\" href=\"inbox.php?action=folderunread&amp;sid=$sid\">$iconinn $lang21</a>[$umsg $lang21a]<br/>";
  }
  if($umsg>1)
  {
  echo "1 <a accesskey=\"1\" href=\"inbox.php?action=folderunread&amp;sid=$sid\">$iconinn $lang21</a>[$umsg $lang21b]<br/>";
  }  
  if($umsg==0)
  {
  echo "1 <a accesskey=\"1\" href=\"inbox.php?action=main&amp;sid=$sid\">$iconino $lang21</a>[$tmsg]<br/>";
  } 
  
  $uid = getuid_sid($sid);
  $mybuds = getnbuds($uid);
  $onbuds = getonbuds($uid);
  echo "2 <a accesskey=\"2\" href=\"lists.php?action=buds&amp;sid=$sid\">$iconbuddy $lang22</a>[$onbuds|$mybuds]";
  $reqs = getnreqs($uid);
  if($reqs>0)
  {
    echo ": <a href=\"lists.php?action=reqs&amp;sid=$sid\">$reqs</a>";
  }
  
  $chs = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline"));
  echo "<br/>3 <a accesskey=\"3\" href=\"index.php?action=chat&amp;sid=$sid\">$iconchat $lang23</a>[$chs[0]]<br/>";
   $notc = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics"));
    $nops = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts"));
  echo "4 <a accesskey=\"4\" href=\"index.php?action=formmenu&amp;sid=$sid\">$iconforum $lang24</a>[$nops[0]|$notc[0]]<br/>";
  
  $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_usergallery"));echo "5 <a accesskey=\"5\" href=\"usergallery.php?action=main&amp;sid=$sid\">$iconusergall $lang28</a>[$noi[0]]<br/>";
  $chs = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubs"));
  echo "6 <a accesskey=\"6\" href=\"index.php?action=clmenu&amp;sid=$sid\">$iconclub $lang25</a>[$chs[0]]<br/>";
 
  $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_vault"));
  echo "7 <a accesskey=\"7\" href=\"lists.php?action=vault&amp;sid=$sid\">$icondownloads $lang27</a>[$noi[0]]<br/>";
   echo "8 <a accesskey=\"8\" href=\"index.php?action=funm&amp;sid=$sid\">$icongames $lang26</a><br/>";
  
   echo "9 <a accesskey=\"9\" href=\"wz.php?action=war&amp;sid=$sid\">warzone -NEW!</a><br/>";
 
  echo "# <a accesskey=\"#\" href=\"index.php?action=cpanel&amp;sid=$sid\">$iconcp $lang29</a><br/>";
  echo "<a href=\"index.php?action=free&amp;sid=$sid\">$iconfree FREE SMS!</a><br/>";
	 $no = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_uploads"));
	  echo "<a href=\"http://arawap.freehostia.com/uploaded/index.php?action=main&amp;sid=$sid\">$iconupl $lang43! </a>[$no[0]]<br/>";
	echo "<a href=\"index.php?action=extra&amp;sid=$sid\">$iconextra $lang44</a><br/>";
  echo "</small>";
  echo "</div>";
  

  

  echo "<br/>";
  echo "<div class=\"mblock2\">";
  echo "<center><b><u>$lang41</u></b></center>";
  echo "<small>";
  $memberonline = "$lang33 <a href=\"index.php?action=online&amp;sid=$sid\">".getnumonline()."</a><br/>";
  echo "$memberonline";
  $timeout = (time() - $timeadjust)  - 180;
  $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE perm>'0' AND lastact>'".$timeout."'"));
  echo "$lang34 <a href=\"index.php?action=stfol&amp;sid=$sid\">".$noi[0]."</a><br/>";
  $timeout = (time() - $timeadjust)  - 180;
  $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE specialid>'0' AND lastact>'".$timeout."'"));
  echo "$lang35 <a href=\"index.php?action=vipol&amp;sid=$sid\">".$noi[0]."</a><br/>";
  echo "</small>";
  echo "</div>";
    
  echo "<br/>";  
 
  echo "<div class=\"mblock2\">";

  echo "<small>";
 include ('lastpost_wappyMOD.php');
  echo "</small>";
  echo "</div>";

  echo "<p><small>";
  

  $memid = mysql_fetch_array(mysql_query("SELECT id, name  FROM ibwf_users ORDER BY regdate DESC LIMIT 0,1"));
    echo "Newest: <b><a href=\"index.php?action=viewuser&amp;who=$memid[0]&amp;sid=$sid\">$memid[1]</a></b><br/>";
	$norm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users"));
  echo "Registered Members: <b>$norm[0]</b> ";
  echo "</small></p>";

 echo "<p align=\"center\"><small>";
	 $randnum2=rand(0,1);
if($randnum2==0)
{

	Echo "<a href=\"index.php?action=viewpl&amp;who=1&amp;sid=$sid\">Poll Of The Week!</a>";
}
if($randnum2==1)
{

	Echo "<a href=\"lists.php?action=gbook&amp;who=1&amp;sid=$sid\">Leave ur Comments!</a>";
}
	 
  echo "<br/><a href=\"index.php?action=stats&amp;sid=$sid\">[$iconstats$lang30] </a>";
  
  echo "<a href=\"index.php?action=search&amp;sid=$sid\">[$lang31]</a><br/>";
  echo "<a href=\"index.php?action=stset&amp;sid=$sid\">Display Settings</a><br/>";

  echo "* <a accesskey=\"*\" href=\"../index.php?action=main&amp;sid=$sid\">$lang37a</a><br/>";
  echo "0 <a accesskey=\"0\" href=\"index.php?action=logout&amp;sid=$sid\">$lang38</a>";
  
  echo "<br/>";
  echo "<a href=\"http://lavalair.net\">Orginal Script: IrisBlaze </a><br/>";
    echo "&#169; $stitle 2003-2007<br/>";
  echo "</small></p>";
  echo "<p><small>";
   if (isadmin(getuid_sid($sid)))
  {
    echo "<a href=\"index.php?action=admincp&amp;sid=$sid\">&#187;$lang39</a><br/>";
  }
  
  if(ismod($uid))
  {
    $tnor = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE reported='1'"));
    $tot = $tnor[0];
    $tnor = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE reported='1'"));
    $tot += $tnor[0];
    $tnor = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE reported='1'"));
    $tot += $tnor[0];
    $tnol = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_mlog"));
    $tol = $tnol[0];
    if($tol+$tot>0)
    {
    echo "<a href=\"mcppl.php?action=main&amp;sid=$sid\">Staff log actions</a>($tot|$tol)";
	echo "<br/><a href=\"index.php?action=idlestaff&amp;sid=$sid\">idle -staff!</a>";
    }

  }
  echo "</small></p>";
  echo xhtmlfoot();
  
 }
else if($action=="clmop")
{
    $clid = $_GET["clid"];
    $who = $_GET["who"];
    addonline(getuid_sid($sid),"Moderating Club Member - xHTML","");
          $pstyle = gettheme($sid);
      echo xhtmlhead("Moderate Member",$pstyle);
    echo "<p align=\"center\">";
    $whnick = getnick_uid($who);
    echo "<b>$whnick</b>";
    echo "</p>";
    echo "<p>";
    $exs = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE uid='".$who."' AND clid=".$clid.""));
$cow = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubs WHERE owner='".$uid."' AND id=".$clid.""));
if($exs[0]>0 && $cow[0]>0)
{
    echo "<a href=\"genproc.php?action=dcm&amp;sid=$sid&amp;who=$who&amp;clid=$clid\">&#187;Kick $whnick out</a><br/>";
    echo "<a href=\"index.php?action=gcp&amp;sid=$sid&amp;who=$who&amp;clid=$clid\">&#187;$whnick's Club Points</a><br/>";
    echo "<a href=\"index.php?action=gpl&amp;sid=$sid&amp;who=$who&amp;clid=$clid\">&#187;Give $whnick Credits</a><br/>";
    }else{
      echo "<img src=\"images/notok.gif\" alt=\"X\"/>Missing Info!";
    }
    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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo xhtmlfoot();
}

else if($action=="gcp")
{
    $clid = $_GET["clid"];
    $who = $_GET["who"];
    addonline(getuid_sid($sid),"Moderating Club Member - xHTML","");
              $pstyle = gettheme($sid);
      echo xhtmlhead("Moderate Member",$pstyle);
    echo "<p align=\"center\">";
    $whnick = getnick_uid($who);
    echo "<b>$whnick</b>";
    echo "</p>";
    echo "<p>";
    $exs = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE uid='".$who."' AND clid=".$clid.""));
$cow = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubs WHERE owner='".$uid."' AND id=".$clid.""));
if($exs[0]>0 && $cow[0]>0)
{
echo "<form action=\"genproc.php?action=gcp&amp;sid=$sid&amp;who=$who&amp;clid=$clid\" method=\"post\">";
    echo "Action: <select name=\"giv\">";
    echo "<option value=\"1\">Add</option>";
    echo "<option value=\"0\">Subtract</option>";
    echo "</select><br/>";
    echo "Points: <input name=\"pnt\" format=\"*N\" size=\"2\" maxlength=\"2\"/><br/>";
echo "<input type=\"submit\" value=\"GO\"/>";
echo "</form>";
    }else{
      echo "<img src=\"images/notok.gif\" alt=\"X\"/>Missing Info!";
    }
    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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo xhtmlfoot();
}

else if($action=="gpl")
{
    $clid = $_GET["clid"];
    $who = $_GET["who"];
    addonline(getuid_sid($sid),"Moderating Club Member - xHTML","");
          $pstyle = gettheme($sid);
      echo xhtmlhead("Moderate Member",$pstyle);
    echo "<p align=\"center\">";
    $whnick = getnick_uid($who);
    echo "<b>$whnick</b>";
    echo "</p>";
    echo "<p>";
    $exs = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE uid='".$who."' AND clid=".$clid.""));
$cow = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubs WHERE owner='".$uid."' AND id=".$clid.""));
if($exs[0]>0 && $cow[0]>0)
{
    echo "<small><img src=\"images/point.gif\" alt=\"!\"/>You can only give Credits, these are real Credits, you can't subtract Credits<br/>";
    $cpl = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_clubs WHERE id='".$clid."'"));
    echo "<img src=\"images/point.gif\" alt=\"!\"/>Your club credits is $cpl[0]<br/>";
    echo "<img src=\"images/point.gif\" alt=\"!\"/>Do not abuse the giving of Credits, your club could be deleted<br/></small><br/>";
    
echo "<form action=\"genproc.php?action=gpl&amp;sid=$sid&amp;who=$who&amp;clid=$clid\" method=\"post\">";
echo "Credits: <input name=\"pnt\" format=\"*N\" size=\"2\" maxlength=\"2\"/><br/>";
echo "<input type=\"submit\" value=\"GO\"/>";    
echo "</form>";
  
    }else{
      echo "<img src=\"images/notok.gif\" alt=\"X\"/>Missing Info!";
    }
    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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo xhtmlfoot();
}
///////////////////////////////////Control Panel

else if($action=="cpanel")
{
    addonline(getuid_sid($sid),"Control Panel - xHTML","index.php?action=$action");
    $pstyle = gettheme($sid);
    echo xhtmlhead("Control Panel",$pstyle);
    echo "<p align=\"center\">";
include ("pops.php");
    echo "<img src=\"images/cpanel.gif\" alt=\"CPanel\"/><br/>";
    echo "<b>Control Panel</b>";
    echo "</p>";
    echo "<p><small>";
  $tmsg = getpmcount(getuid_sid($sid));
  $umsg = getunreadpm(getuid_sid($sid));
  
  if($umsg==1)
  {
  echo "<a href=\"inbox.php?action=main&amp;sid=$sid\">&#187;Inbox($umsg New Message)</a><br/>";
  }
  if($umsg>1)
  {
  echo "<a href=\"inbox.php?action=main&amp;sid=$sid\">&#187;Inbox($umsg New Messages)</a><br/>";
  }  
  if($umsg==0)
  {
  echo "<a href=\"inbox.php?action=main&amp;sid=$sid\">&#187;Inbox($tmsg)</a><br/>";
  } 
  $uid =getuid_sid($sid);
  //$new_gm = getnewgml($uid);
  echo "<a href=\"index.php?action=rwidc&amp;sid=$sid\">&#187;Arawap ID card.</a><br/>";
  echo "<a href=\"index.php?action=myclub&amp;sid=$sid\">&#187;My Clubs</a><br/>";
  echo "<a href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$uid\">&#187;Profile</a><br/>";
  echo "<a href=\"index.php?action=uset&amp;sid=$sid\">&#187;User Settings</a><br/>";
  echo "<a href=\"index.php?action=uxset&amp;sid=$sid\">&#187;Profile Settings</a><br/>";
  echo "<a href=\"index.php?action=stset&amp;sid=$sid\">&#187;Site Settings</a><br/>";
  echo "<a href=\"index.php?action=pws&amp;sid=$sid\">&#187;Personal Wap site</a><br/>";
  echo "<a href=\"index.php?action=search&amp;sid=$sid\">&#187;Search</a><br/>";
  $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_vault WHERE uid='".$uid."'"));
  echo "<a href=\"lists.php?action=vault&amp;sid=$sid&amp;who=$uid\">&#187;My Vault($noi[0])</a><br/>";
  $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_ignore WHERE name='".$uid."'"));
  echo "<a href=\"lists.php?action=ignl&amp;sid=$sid\">&#187;Ignore List($noi[0])</a><br/>";
  $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_gbook WHERE gbowner='".$uid."'"));
  echo "<a href=\"lists.php?action=gbook&amp;sid=$sid&amp;who=$uid\">&#187;Guestbook($noi[0])</a><br/>";
  echo "<a href=\"index.php?action=poll&amp;sid=$sid\">&#187;My Poll</a><br/>";
  $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_blogs WHERE bowner='".$uid."'"));
  echo "<a href=\"lists.php?action=blogs&amp;sid=$sid&amp;who=$uid\">&#187;Blogs($noi[0])</a><br/>";
  echo "<a href=\"lists.php?action=chmood&amp;sid=$sid\">&#187;Chatmood</a><br/>";
  echo "<a href=\"status.php?action=status&amp;sid=$sid\">&#187;Status</a><br/>";
  echo "<a href=\"lists.php?action=smilies&amp;sid=$sid\">&#187;Smilies</a><br/>";
  echo "<a href=\"lists.php?action=avatars&amp;sid=$sid\">&#187;Avatars</a><br/>";  
  echo "<a href=\"lists.php?action=ecards&amp;sid=$sid\">&#187;E-Cards</a><br/>";
  echo "<a href=\"lists.php?action=bbcode&amp;sid=$sid\">&#187;BBCode</a><br/>";
  echo "<a href=\"lists.php?action=faqs&amp;sid=$sid\">&#187;F.A.Qs</a><br/>";
  echo "<a href=\"help.php?sid=$sid\">&#187;Help Menu</a><br/>";
  echo "<a href=\"index.php?action=terms&amp;sid=$sid\">&#187;Terms of use</a><br/>";
  
  echo "</small></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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo xhtmlfoot();
}

///////////////////////////////////Control Panel

else if($action=="clmenu")
{
    addonline(getuid_sid($sid),"Clubs Menu - xHTML","index.php?action=$action");
    $pstyle = gettheme($sid);
    echo xhtmlhead("Clubs Menu",$pstyle);
    echo "<p align=\"center\">";
include ("pops.php");
    echo "<b>Clubs Menu</b>";
    echo "</p>";
    echo "<p><small>";
    $myid = getuid_sid($sid);
  echo "<a href=\"index.php?action=clubs&amp;sid=$sid\">&#187;All Clubs</a><br/>";
  echo "<a href=\"index.php?action=myclub&amp;sid=$sid\">&#187;My Clubs</a><br/>";
  echo "<a href=\"lists.php?action=clm&amp;who=$myid&amp;sid=$sid&amp;who=$uid\">&#187;Clubs I'm member of</a><br/>";
  echo "<a href=\"lists.php?action=pclb&amp;sid=$sid&amp;who=$uid\">&#187;Clubs By popularity</a><br/>";
  echo "<a href=\"lists.php?action=aclb&amp;sid=$sid&amp;who=$uid\">&#187;Clubs By Activity</a><br/>";
  //echo "<a href=\"lists.php?action=rclb&amp;sid=$sid&amp;who=$uid\">&#187;5 random clubs</a><br/><br/>";
  $ncl = mysql_fetch_array(mysql_query("SELECT id, name FROM ibwf_clubs ORDER BY created DESC LIMIT 1"));
  echo "Newest Club: <a href=\"index.php?action=gocl&amp;clid=$ncl[0]&amp;sid=$sid\">".htmlspecialchars($ncl[1])."</a><br/>";
/*
  echo "<a href=\"index.php?action=uset&amp;sid=$sid\">&#187;Settings</a><br/>";
  echo "<a href=\"index.php?action=uxset&amp;sid=$sid\">&;#187;Extended Settings</a><br/>";
  $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_vault WHERE uid='".$uid."'"));
  echo "<a href=\"lists.php?action=vault&amp;sid=$sid&amp;who=$uid\">&#187;My Vault($noi[0])</a><br/>";
  $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_ignore WHERE name='".$uid."'"));
  echo "<a href=\"lists.php?action=ignl&amp;sid=$sid\">&#187;Ignore List($noi[0])</a><br/>";
  $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_gbook WHERE gbowner='".$uid."'"));
  echo "<a href=\"lists.php?action=gbook&amp;sid=$sid&amp;who=$uid\">&#187;Guestbook($noi[0])</a><br/>";
  echo "<a href=\"index.php?action=poll&amp;sid=$sid\">&#187;My Poll</a><br/>";
  $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_blogs WHERE bowner='".$uid."'"));
  echo "<a href=\"lists.php?action=blogs&amp;sid=$sid&amp;who=$uid\">&#187;Blogs($noi[0])</a><br/>";
  echo "<a href=\"lists.php?action=chmood&amp;sid=$sid\">&#187;Chatmood</a><br/>";
  echo "<a href=\"lists.php?action=smilies&amp;sid=$sid\">&#187;Smilies</a><br/>";
  echo "<a href=\"lists.php?action=avatars&amp;sid=$sid\">&#187;Avatars</a><br/>";
  echo "<a href=\"lists.php?action=bbcode&amp;sid=$sid\">&#187;BBCode</a><br/>";
*/
  echo "</small></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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo xhtmlfoot();
}


else if($action=="rwidc")
{
    addonline(getuid_sid($sid),"Arawap ID - xHTML","index.php?action=$action");
    $pstyle = gettheme($sid);
    echo xhtmlhead("Arawap ID",$pstyle);
    echo "<p align=\"center\">";
    echo "<b>M! ID card</b><br/>";
    $uid = getuid_sid($sid);
    echo "<img src=\"http://Arawap.net/rwidc.php?id=$uid\" alt=\"M id\"/><br/><br/>";
    echo "This ID card is updated automatically everytime someone request it, the source to your card is http://Arawap.net/rwidc.php?id=$uid<br/><br/>";
    echo "you can use it as an avatar in other sites<br/><br/>";
    echo "To look at others cards view the user profile then go to more information&gt;Arawap ID card.";
    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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo xhtmlfoot();
}

///////////////////////////////////My Clubs

else if($action=="myclub")
{
    addonline(getuid_sid($sid),"My Clubs - xHTML","index.php?action=$action");
    $pstyle = gettheme($sid);
    echo xhtmlhead("My Clubs",$pstyle);
    echo "<p align=\"center\">";
include ("pops.php");
    echo "<b>My Clubs</b>";
    echo "</p>";
    echo "<p>";
    $uid = getuid_sid($sid);
    if(getplusses($uid)<500)
    {
      echo "Clubs are small communities that users can create, every community should have things in common, for example a community for goths, blink 182 fans, rappers and anythin g you can think of, currently people who have more than 500 Credits only can create clubs, every user can create up to 5 clubs, to get Credits post in forms, or invite friends";
    }else{
      $uclubs = mysql_query("SELECT id, name FROM ibwf_clubs WHERE owner='".$uid."'");
      while($club=mysql_fetch_array($uclubs))
      {
        echo "<a href=\"index.php?action=gocl&amp;clid=$club[0]&amp;sid=$sid\">$club[1]</a>";
        echo ", <a href=\"genproc.php?action=dlcl&amp;clid=$club[0]&amp;sid=$sid\">[DELETE]</a><br/><br/>";
      }
      $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubs WHERE owner='".$uid."'"));
      if($noi[0]<5)
      {
      echo "<a href=\"index.php?action=addcl&amp;sid=$sid\">Add Club</a>";
      }
    }
  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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo xhtmlfoot();
}

///////////////////////////////////My Clubs

else if($action=="clubs")
{
    addonline(getuid_sid($sid),"Clubs List - xHTML","index.php?action=$action");
    
    $pstyle = gettheme($sid);
    echo xhtmlhead("Clubs List",$pstyle);
    echo "<p align=\"center\">";
    echo "<b>Clubs List</b>";
    echo "</p>";
    //////ALL LISTS SCRIPT <<

    if($page=="" || $page<=0)$page=1;
    $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubs"));
    $num_items = $noi[0]; //changable
    $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;

    //changable sql

        $sql = "SELECT id, name, owner, description, created FROM ibwf_clubs ORDER BY created DESC LIMIT $limit_start, $items_per_page";


    echo "<p>";
    $items = mysql_query($sql);
    if(mysql_num_rows($items)>0)
    {
    while ($item = mysql_fetch_array($items))
    {
        $item[1]=htmlspecialchars($item[1]);
        $mems = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE clid='".$item[0]."' AND accepted='1'"));
      $lnk = "<a href=\"index.php?action=gocl&amp;clid=$item[0]&amp;sid=$sid\">$item[1]($mems[0])</a> <small>Owner: <a href=\"index.php?action=viewuser&amp;who=$item[2]&amp;sid=$sid\">".getnick_uid($item[2])."</a></small>";
      echo "$lnk<br/><small>";
      echo htmlspecialchars($item[3])."<br/>Creation Date: (".date("d/m/y", $item[4]).")</small><br/><br/>";
    }
    }
    echo "</p>";
    echo "<p align=\"center\">";
    if($page>1)
    {
      $ppage = $page-1;
      echo "<a href=\"index.php?action=$action&amp;page=$ppage&amp;sid=$sid&amp;view=$view\">&#171;PREV</a> ";
    }
    if($page<$num_pages)
    {
      $npage = $page+1;
      echo "<a href=\"index.php?action=$action&amp;page=$npage&amp;sid=$sid&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=\"sid\" value=\"$sid\"/>";
        $rets .= "</form>";

        echo $rets;
  
    }
    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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo xhtmlfoot();
}

else if($action=="gocl")
{
  $clid = $_GET["clid"];
  $clinfo = mysql_fetch_array(mysql_query("SELECT name, owner, description, rules, logo, plusses, created FROM ibwf_clubs WHERE id='".$clid."'"));
    addonline(getuid_sid($sid),"Viewing Club - xHTML","index.php?action=$action");
    $clnm = htmlspecialchars($clinfo[0]);
        $pstyle = gettheme($sid);
    echo xhtmlhead($clnm,$pstyle);
    echo "<p align=\"center\">";
    echo "<small><b>$clnm</b></small><br/>";
    if(trim($clinfo[4])=="")
    {
      echo "<img src=\"images/logo.jpg\" alt=\"logo\"/>";
    }else{
        echo "<img src=\"$clinfo[4]\" alt=\"logo\"/>";
    }
    echo "</p>";
    echo "<p><small>";
    echo "Club ID: <b>$clid</b><br/>";
    $uid = getuid_sid($sid);
    $cango = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE clid='".$clid."' AND uid='".$uid."' AND accepted='1'"));
    echo "Owner: <a href=\"index.php?action=viewuser&amp;who=$clinfo[1]&amp;sid=$sid\">".getnick_uid($clinfo[1])."</a><br/>";
      $mems = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE clid='".$clid."' AND accepted='1'"));
      echo "Members: <a href=\"lists.php?action=clmem&amp;sid=$sid&amp;clid=$clid\">$mems[0]</a><br/>";
      echo "Created On: ".date("d/m/y", $clinfo[6])."<br/>";
      echo "Credits: $clinfo[5]<br/>";
      $fid = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_forums WHERE clubid='".$clid."'"));
      $rid = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_rooms WHERE clubid='".$clid."'"));
      $tps = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$fid[0]."'"));
      $pss = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts a INNER JOIN ibwf_topics b ON a.tid = b.id WHERE b.fid='".$fid[0]."'"));
      
    if(($cango[0]>0)||ismod($uid))
    {
        $noa = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_announcements WHERE clid='".$clid."'"));
        echo "<br/><a href=\"lists.php?action=annc&amp;sid=$sid&amp;clid=$clid\"><img src=\"images/annc.gif\" alt=\"!\"/>Announcements($noa[0])</a><br/>";
        $noa = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chat WHERE rid='".$rid[0]."'"));
        echo "<a href=\"chat.php?sid=$sid&amp;rid=$rid[0]\"><img src=\"images/chat.gif\" alt=\"*\"/>$clnm Chat($noa[0])</a><br/>";
        echo "<a href=\"index.php?action=viewfrm&amp;sid=$sid&amp;fid=$fid[0]\"><img src=\"images/1.gif\" alt=\"*\"/>$clnm Forum($tps[0]/$pss[0])</a><br/><br/>";
		$ismem = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE clid='".$clid."' AND uid='".getuid_sid($sid)."'"));
		
		if($ismem[0]>0)
		{
			//unjoin 
			if($clinfo[1]!=$uid)
			{
				echo "<a href=\"genproc.php?action=unjc&amp;sid=$sid&amp;clid=$clid\">Unjoin Club</a>";
			}
		}else{
			echo "<a href=\"genproc.php?action=reqjc&amp;sid=$sid&amp;clid=$clid\">Join Now!</a>";
		}
		if(isadmin(getuid_sid($sid)))
		{
			echo "<br/><a href=\"admincp.php?action=club&amp;sid=$sid&amp;clid=$clid\">Admin Tools</a>";
		}
        if($clinfo[1]==$uid)
      {
        //club owner
        $mems = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE clid='".$clid."' AND accepted='0'"));
        echo "<br/><a href=\"lists.php?action=clreq&amp;sid=$sid&amp;clid=$clid\">&#187;Requests($mems[0])</a><br/>";
	 echo "<a href=\"index.php?action=pmallmem&amp;sid=$sid&amp;clid=$clid\">PM All Club Members</a><br/>";
		
      }
    }else{
      echo "Topics: <b>$tps[0]</b>, Posts: <b>$pss[0]</b><br/>";
      echo "<b>Description:</b><br/>";
      echo htmlspecialchars($clinfo[2]);
      echo "<br/><br/>";
      echo "<b>Rules:</b><br/>";
      echo htmlspecialchars($clinfo[3]);
      echo "<br/><br/>";
      echo "Seems Good? <a href=\"genproc.php?action=reqjc&amp;sid=$sid&amp;clid=$clid\">Join Now!</a>";
    }
    echo "</small></p>";
    echo "<p align=\"center\">";
    echo "<a href=\"index.php?action=clubs&amp;sid=$sid\">";
echo "Clubs list</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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo xhtmlfoot();
}

else if($action=="addcl")
{
    addonline(getuid_sid($sid),"Adding Club - xHTML","");
    $pstyle = gettheme($sid);
    echo xhtmlhead("Add Club",$pstyle);
    echo "<p align=\"center\">";
    echo "<b>Add Club</b>";
    echo "</p>";
    echo "<p>";
    if(getplusses($uid)>=500)
    {
    $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubs WHERE owner='".$uid."'"));
      if($noi[0]<5)
      {
        echo "<small><img src=\"images/point.gif\" alt=\"*\"/>All Info are required except the logo<br/>";
        echo "<img src=\"images/point.gif\" alt=\"*\"/>Beside you, mods can moderate your club forums and chat<br/>";
        echo "<img src=\"images/point.gif\" alt=\"*\"/>Any leading spaces for description, name, logo, or rules will be removed<br/>";
        echo "<img src=\"images/point.gif\" alt=\"*\"/>Admins will delete your club and subtract your Credits if you abuse the using of the club<br/>";
        echo "<img src=\"images/point.gif\" alt=\"*\"/>Admins have the right to delete your club if it want active or if it was useless<br/></small><br/>";
        

echo "<form action=\"genproc.php?action=addcl&amp;sid=$sid\" method=\"post\">";
echo "Club Name:<input name=\"clnm\" maxlength=\"30\"/><br/>";
        echo "Description:<input name=\"clds\" maxlength=\"200\"/><br/>";
        echo "Rules:<input name=\"clrl\" maxlength=\"500\"/><br/>";
        echo "Logo:<input name=\"cllg\" maxlength=\"200\"/><br/>";
echo "<input type=\"submit\" value=\"Create\"/>";        
echo "</form>";  
        
        
      }else{
        echo "You already have 5 clubs";
      }
      }else{

      echo "You cant add clubs";
      }
    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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo xhtmlfoot();
}
///////////////////////////////////free

else if($action=="free")
{
    addonline(getuid_sid($sid),"xhtml-Sending FREE SMS","index.php?action=$action");
    $pstyle = gettheme($sid);
    echo xhtmlhead("Arawap",$pstyle);
	
	
    echo " <p align=\"center\">";
	include("pops.php");

    echo "<b>SEND UNLIMITED FREE SMS!!!</b><br/><br/>";
	  echo "More Networks comming Soon for FREE SMS..<i>Keep In touch!!</i><br/><br/>";
    echo "</p>";
    echo "<p>";
    echo "<a href=\"http://arawap.6te.net/xmobisms.php?&amp;sid=$sid\">&#0187; FREE SMS to Mobitel</a><br/>";
    echo "<a href=\"http://arawap.6te.net/xdialogsms.php?&amp;sid=$sid\">&#0187; FREE SMS to Dialog</a><br/>";
    echo "<a href=\"http://arawap.6te.net/xemail.php?&amp;sid=$sid\">&#0187; FREE Em@il Service</a><br/>";
  
	echo "--------<br/>";
		echo "&#0187; FREE MMS to Mobitel<br/>";
		echo "&#0187; FREE MMS to Dialog<br/>";
		echo "&#0187; FREE MMS to Tigo<br/>";
 	echo "Comming Soon!<br/><br/>";

	echo "<u>Note:</u> If You r not From Sri Lanka, If u need FREE SMS Service from ARAWAP, Just Pm <b> aRaa  </b> <br/>";
    
    
  echo "</p>";

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

    echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
     echo xhtmlfoot();
}
///////////////////////////////////Search

else if($action=="search")
{
    addonline(getuid_sid($sid),"Search Menu - xHTML","index.php?action=$action");
        $pstyle = gettheme($sid);
    echo xhtmlhead("Search Menu",$pstyle);
    echo "<p align=\"center\">";
include ("pops.php");
    echo "<img src=\"images/search.gif\" alt=\"*\"/><br/>";
    echo "<b>Search Menu</b>";
    echo "</p>";
    echo "<p>";
    echo "<a href=\"search.php?action=tpc&amp;sid=$sid\">&#0187;In Topics</a><br/>";
    echo "<a href=\"search.php?action=blg&amp;sid=$sid\">&#0187;In Blogs</a><br/>";
    echo "<a href=\"search.php?action=nbx&amp;sid=$sid\">&#0187;In My Inbox</a><br/>";
    echo "<a href=\"search.php?action=clb&amp;sid=$sid\">&#0187;In Clubs</a><br/><br/>";
	echo "Find Members:<br/>";
    echo "<a href=\"search.php?action=mbrn&amp;sid=$sid\">&#0187;In Nicknames</a><br/>";
	//echo "<a href=\"search.php?action=mbrl&amp;sid=$sid\">&#0187;In Location</a><br/>";
	//echo "<a href=\"search.php?action=mbrs&amp;sid=$sid\">&#0187;By sex orientation</a><br/>";
	echo "More search options for members are to come<br/>";
    echo "<br/><small>or you can just type the nickname of the member and view its profile</small><br/>";
    
   
    echo "<form method=\"post\" action=\"index.php?action=viewuser&amp;sid=$sid\">";
    echo "<br/>Nickname <input name=\"mnick\" maxlength=\"15\"/><br/>";
    echo "<input type=\"submit\" name=\"Submit\" value=\"View Profile\"/><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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo xhtmlfoot();
}

///////////////////////////////////Settings

else if($action=="uset")
{
    addonline(getuid_sid($sid),"User Settings - xHTML","index.php?action=$action");
    $pstyle = gettheme($sid);
    echo xhtmlhead("User Settings",$pstyle);
    echo "<onevent type=\"onenterforward\">";
    $uid = getuid_sid($sid);
    $avat = getavatar($uid);
    $email = mysql_fetch_array(mysql_query("SELECT email FROM ibwf_users WHERE id='".$uid."'"));
    $site = mysql_fetch_array(mysql_query("SELECT site FROM ibwf_users WHERE id='".$uid."'"));
    $bdy = mysql_fetch_array(mysql_query("SELECT birthday FROM ibwf_users WHERE id='".$uid."'"));
    $uloc = mysql_fetch_array(mysql_query("SELECT location FROM ibwf_users WHERE id='".$uid."'"));
    $usig = mysql_fetch_array(mysql_query("SELECT signature FROM ibwf_users WHERE id='".$uid."'"));
    $sx = mysql_fetch_array(mysql_query("SELECT sex FROM ibwf_users WHERE id='".$uid."'"));
	$uloc[0] = htmlspecialchars($uloc[0]);
  echo "<refresh>
        <setvar name=\"savat\" value=\"$avat\"/>
        <setvar name=\"semail\" value=\"$email[0]\"/>
        <setvar name=\"usite\" value=\"$site[0]\"/>
        <setvar name=\"ubday\" value=\"$bdy[0]\"/>
        <setvar name=\"uloc\" value=\"$uloc[0]\"/>
        <setvar name=\"usig\" value=\"$usig[0]\"/>
        <setvar name=\"sx\" value=\"$sx[0]\"/>
   ";
  echo "</refresh></onevent>";
    echo "<p align=\"center\">";
include ("pops.php");
    echo "<b>Settings</b>";
    echo "</p>";
    echo "<p>";


    
    echo "<form method=\"post\" action=\"genproc.php?action=uprof&amp;sid=$sid\">";   
    echo "Avatar: <input name=\"savat\" maxlength=\"100\" value=\"$avat\"/><br/>";
    echo "E-Mail: <input name=\"semail\" maxlength=\"100\" value=\"$email[0]\"/><br/>";
    echo "Phone No: <input name=\"usite\" format=\"*N\" maxlength=\"13\" value=\"$site[0]\"/><br/>";
    echo "Birthday<small>(YYYY-MM-DD)</small>: <input name=\"ubday\" maxlength=\"50\" value=\"$bdy[0]\"/><br/>";
    echo "Location: <input name=\"uloc\" maxlength=\"50\" value=\"$uloc[0]\"/><br/>";
    echo "Signature: <input name=\"usig\" maxlength=\"100\" value=\"$usig[0]\"/><br/>";
    echo "Sex: <select name=\"usex\" value=\"$sx[0]\">";
    if($sx[0]=="M"){
    echo "<option value=\"M\" selected=\"M\">Male</option>";
    }else{
    echo "<option value=\"M\">Male</option>";
    }
    if($sx[0]=="F"){
    echo "<option value=\"F\" selected=\"F\">Female</option>";
    }else{
    echo "<option value=\"F\">Female</option>";
    }
    echo "</select><br/>";    
    echo "<input type=\"submit\" name=\"Submit\" value=\"Update\"/><br/>";
    echo "</form>";

    echo "<br/><br/>";
	$sml = mysql_fetch_array(mysql_query("SELECT hvia FROM ibwf_users WHERE id='".getuid_sid($sid)."'"));
	if($sml[0]=="1")
	{
		echo "<a href=\"genproc.php?action=shsml&amp;sid=$sid&amp;act=dis\">Disable Smilies</a>";
	}else{
		echo "<a href=\"genproc.php?action=shsml&amp;sid=$sid&amp;act=enb\">Enable Smilies</a>";
	}
	echo "<br/><br/>";
	
	echo "<form method=\"post\" action=\"genproc.php?action=upwd&amp;sid=$sid\">";   
    echo "Password: <input type=\"password\" name=\"npwd\" format=\"*x\" maxlength=\"15\"/><br/>";
    echo "Password again: <input type=\"password\" name=\"cpwd\" format=\"*x\" maxlength=\"15\"/><br/>"; 
    echo "<input type=\"submit\" name=\"Submit\" value=\"Change\"/><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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo xhtmlfoot();
}

///////////////////////////////////Site Settings

else if($action=="stset")
{
    addonline(getuid_sid($sid),"Site Settings - xHTML","index.php?action=$action");
    $pstyle = gettheme($sid);
    echo xhtmlhead("Site Settings",$pstyle);
    echo "<p align=\"center\">";
    echo "<b>Site View Settings</b>";
    echo "</p>";
    echo "<p>";
    echo "<form method=\"POST\" action=\"genproc.php?action=ustset&amp;sid=$sid\">";
    
    $uid = getuid_sid($sid);
    
    $showcons = mysql_fetch_array(mysql_query("SELECT showicon FROM ibwf_users WHERE id='".$uid."'"));
    $showtime = mysql_fetch_array(mysql_query("SELECT showtime FROM ibwf_users WHERE id='".$uid."'"));
    $showshout = mysql_fetch_array(mysql_query("SELECT showshout FROM ibwf_users WHERE id='".$uid."'"));
    $theme = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
    $showshortkey = mysql_fetch_array(mysql_query("SELECT showshortkey FROM ibwf_users WHERE id='".$uid."'"));
    
    echo "<small>Select Site Language (Beta):</small> <select name=\"sitelang\" value=\"$sitelang[0]\">";
    echo "<option value=\"1\">English</option>";
    echo "<option value=\"2\">Sinhala</option>";
    echo "</select><br/><br/>";
    
    echo "<small>Theme:</small> <select name=\"theme\" value=\"$theme[0]\">";
    if (strstr($_SERVER['HTTP_USER_AGENT'], "MOT-")) {
	echo "<optgroup>";
	}
    if($theme[0]=="1"){
    echo "<option value=\"1\" selected=\"1\">Arawap</option>";
    }else{
    echo "<option value=\"1\">Arawap</option>";
    }
    if($theme[0]=="2"){
    echo "<option value=\"2\" selected=\"2\">Blue</option>";
    }else{
    echo "<option value=\"2\">Blue</option>";
    }
    if($theme[0]=="3"){
    echo "<option value=\"3\" selected=\"3\">Black to White</option>";
    }else{
    echo "<option value=\"3\">Black to White</option>";
    }
    if($theme[0]=="4"){
    echo "<option value=\"4\"  selected=\"4\">Red</option>";
    }else{
    echo "<option value=\"4\">Red</option>";
    }
    if($theme[0]=="5"){
    echo "<option value=\"5\"  selected=\"5\">Green</option>";
    }else{
    echo "<option value=\"5\">Green</option>";
    }
    if($theme[0]=="6"){
    echo "<option value=\"6\"  selected=\"6\">Steel</option>";
    }else{
    echo "<option value=\"6\">Steel</option>";
    }
    if($theme[0]=="7"){
    echo "<option value=\"7\"  selected=\"7\">Opera WML</option>";
    }else{
    echo "<option value=\"7\">Opera WML</option>";
    }
    if($theme[0]=="8"){
    echo "<option value=\"8\"  selected=\"8\">Error</option>";
    }else{
    echo "<option value=\"8\">Error</option>";
    }    
    if($theme[0]=="9"){
    echo "<option value=\"9\"  selected=\"9\">Grey Orange</option>";
    }else{
    echo "<option value=\"9\">Grey Orange</option>";
    }
    if($theme[0]=="10"){
    echo "<option value=\"10\"  selected=\"10\">Pinky</option>";
    }else{
    echo "<option value=\"10\">Pinky</option>";
    }
    if($theme[0]=="11"){
    echo "<option value=\"11\"  selected=\"11\">Matrix</option>";
    }else{
    echo "<option value=\"11\">Matrix</option>";
    }
    if($theme[0]=="12"){
    echo "<option value=\"12\"  selected=\"12\">Goth</option>";
    }else{
    echo "<option value=\"12\">Goth</option>";
    }
    if($theme[0]=="13"){
    echo "<option value=\"13\"  selected=\"13\">Night Pink</option>";
    }else{
    echo "<option value=\"13\">Night Pink</option>";
    }    
    if (strstr($_SERVER['HTTP_USER_AGENT'], "MOT-")) {
	echo "</optgroup>";
	}
    echo "</select><br/><br/>";
    
    echo "<small>Shorcut Key Number?:</small> <select name=\"showshortkey\" value=\"$showshortkey[0]\">";
    if($showshortkey[0]=="1"){
    echo "<option value=\"1\" selected=\"1\">Yes</option>";
    }else{
    echo "<option value=\"1\">Yes</option>";
    }
    if($showshortkey[0]=="0"){
    echo "<option value=\"0\" selected=\"0\">No</option>";
    }else{
    echo "<option value=\"0\">No</option>";
    }
    echo "</select><br/><br/>";
    
    echo "<small>Show Icons on Main Page?:</small> <select name=\"showcons\" value=\"$showcons[0]\">";
    if($showcons[0]=="1"){
    echo "<option value=\"1\" selected=\"1\">Yes</option>";
    }else{
    echo "<option value=\"1\">Yes</option>";
    }
    if($showcons[0]=="0"){
    echo "<option value=\"0\" selected=\"0\">No</option>";
    }else{
    echo "<option value=\"0\">No</option>";
    }
    echo "</select><br/><br/>";
    
    echo "<small>Show Time on Main Page?:</small> <select name=\"showtime\" value=\"$showtime[0]\">";
    if($showtime[0]=="1"){
    echo "<option value=\"1\" selected=\"1\">Yes</option>";
    }else{
    echo "<option value=\"1\">Yes</option>";
    }
    if($showtime[0]=="0"){
    echo "<option value=\"0\" selected=\"0\">No</option>";
    }else{
    echo "<option value=\"0\">No</option>";
    }
    echo "</select><br/><br/>";
    
    echo "<small>Show Shoutbox on Main Page?:</small> <select name=\"showshout\" value=\"$showshout[0]\">";
    if($showshout[0]=="1"){
    echo "<option value=\"1\" selected=\"1\">Yes</option>";
    }else{
    echo "<option value=\"1\">Yes</option>";
    }
    if($showshout[0]=="0"){
    echo "<option value=\"0\" selected=\"0\">No</option>";
    }else{
    echo "<option value=\"0\">No</option>";
    }
    echo "</select><br/><br/>";
    
    echo "<input type=\"submit\" name=\"Submit\" value=\"Update\"/><br/>";
    echo "</form>";
	echo "<br/><br/>";
    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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo xhtmlfoot();
}
///////////////////////////////////Poll Topic
else if($action=="poll")
{
    addonline(getuid_sid($sid),"Administrating Poll - xHTML","");
        $pstyle = gettheme($sid);
    echo xhtmlhead("Your Poll",$pstyle);
    echo "<p>";
    $uid = getuid_sid($sid);
    if(getplusses($uid)<50)
    {
      echo "Minimum Credits required to administrate your poll is 50 credits";
    }else{
        $pid = mysql_fetch_array(mysql_query("SELECT pollid FROM ibwf_users WHERE id='".$uid."'"));
        if($pid[0] == 0)
        {
          echo "<a href=\"index.php?action=crpoll&amp;sid=$sid\">Create Poll</a>";
        }else{
          echo "<a href=\"index.php?action=viewpl&amp;sid=$sid&amp;who=$uid\">View Your Poll</a><br/>";
            echo "<a href=\"genproc.php?action=dlpoll&amp;sid=$sid\">Delete Your Poll</a><br/>";
        }
    }
    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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo xhtmlfoot();
    
}else if($action=="crpoll")
{
    addonline(getuid_sid($sid),"Creating Poll - xHTML","");
    echo "<card id=\"main\" title=\"Create Poll\">";
    echo "<p>";
    if(getplusses(getuid_sid($sid))>=50)
    {
    $pid = mysql_fetch_array(mysql_query("SELECT pollid FROM ibwf_users WHERE id='".$uid."'"));
        if($pid[0] == 0)
        {
          
echo "<form action=\"genproc.php?action=crpoll&amp;sid=$sid\" method=\"post\">";
          echo "Question:<input name=\"pques\" maxlength=\"250\"/><br/>";
          echo "Option 1:<input name=\"opt1\" maxlength=\"100\"/><br/>";
          echo "Option 2:<input name=\"opt2\" maxlength=\"100\"/><br/>";
          echo "Option 3:<input name=\"opt3\" maxlength=\"100\"/><br/>";
          echo "Option 4:<input name=\"opt4\" maxlength=\"100\"/><br/>";
          echo "Option 5:<input name=\"opt5\" maxlength=\"100\"/><br/>";
echo "<input type=\"submit\" value=\"Create\"/>";          
echo "</form>";
    
    
          }else{
            echo "<img src=\"images/notok.gif\" alt=\"x\"/>You already have a poll";
          }
          }else{
            echo "<img src=\"images/notok.gif\" alt=\"x\"/>You should have at least 50 Credits to create a poll";
          }
    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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo xhtmlfoot();
}
else if($action=="pws")
{
    addonline(getuid_sid($sid),"P.W.S - xHTML","");
    $pstyle = gettheme($sid);
    echo xhtmlhead("P.W.S",$pstyle);
    echo "<p>";
    echo "&#187;Welcome Image<br/>";
	echo "<small>The image on main page<br/>";
	echo "In Image field: type smilie code for smilie like -hi-, the image URL for external image, leave blank for other options</small><br/>";
	echo "<form method=\"post\" action=\"genproc.php?action=pws&amp;sid=$sid\">";
	echo "<select name=\"imgt\">";
	echo "<option value=\"idc\">My ID Card</option>";
	echo "<option value=\"avt\">My Current Avatar</option>";
	echo "<option value=\"sml\">Smilie</option>";
	echo "<option value=\"ilk\">Image URL</option>";
	echo "</select><br/>";
	echo "Image:<input name=\"imgo\" maxlength=\"200\"/><br/><br/>";
	echo "&#187;Welcome Message<br/>";
	echo "<small>The message that appears on first page of your site, smilies are allowed</small><br/>";
	echo "Message:<input name=\"smsg\" maxlength=\"250\"/><br/><br/>";
	echo "&#187;Theme<br/>";
	echo "<small>Themes available only on phones supporting XHTML</small><br/>";
	echo "<select name=\"thms\">";
	$themes = mysql_query("SELECT id, name FROM ibwf_themes");
	while ($theme = mysql_fetch_array($themes))
	{
	echo "<option value=\"$theme[0]\">".htmlspecialchars($theme[1])."</option>";
	}
	echo "</select><br/>";
    echo "<input type=\"submit\" name=\"Submit\" value=\"Update\"/><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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
    echo "</p>";
    echo xhtmlfoot();
}

else if($action=="pltpc")
{
  $tid = $_GET["tid"];
    addonline(getuid_sid($sid),"Creating Poll - xHTML","");
    $pstyle = gettheme($sid);
    echo xhtmlhead("Create Poll",$pstyle);
    echo "<p>";
    if((getplusses(getuid_sid($sid))>=500)||ismod($uid))
    {
    $pid = mysql_fetch_array(mysql_query("SELECT pollid FROM ibwf_topics WHERE id='".$tid."'"));
        if($pid[0] == 0)
        {
          
          echo "<form method=\"post\" action=\"genproc.php?action=pltpc&amp;sid=$sid&amp;tid=$tid\">";
          echo "Question:<input name=\"pques\" maxlength=\"250\"/><br/>";
          echo "Option 1:<input name=\"opt1\" maxlength=\"100\"/><br/>";
          echo "Option 2:<input name=\"opt2\" maxlength=\"100\"/><br/>";
          echo "Option 3:<input name=\"opt3\" maxlength=\"100\"/><br/>";
          echo "Option 4:<input name=\"opt4\" maxlength=\"100\"/><br/>";
          echo "Option 5:<input name=\"opt5\" maxlength=\"100\"/><br/>";
          echo "<input type=\"submit\" name=\"Submit\" value=\"Create\"/><br/>";
          echo "</form>"; 
          
          
          }else{
            echo "<img src=\"images/notok.gif\" alt=\"x\"/>The topic already have a poll";
          }
          }else{
            echo "<img src=\"images/notok.gif\" alt=\"x\"/>You should have at least 500 Credits to create a poll";
          }
    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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo xhtmlfoot();
}

else if($action=="stats")
{
    addonline(getuid_sid($sid),"Site statistics - xHTML","index.php?action=$action");
    $pstyle = gettheme($sid);
    echo xhtmlhead("Site Statistics",$pstyle);
    echo "<p>";
    $norm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users"));
    echo "<small>";
    $siteage = mysql_fetch_array(mysql_query("SELECT value  FROM ibwf_settings WHERE id='9'"));
    $sage = (time() - $timeadjust)-$siteage[0];
    $stage = ceil($sage/(24*60*60));
    echo "Site Age: <b>$stage Days</b><br/><br/>";
    echo "Registered Members: <b>$norm[0]</b><br/>";
    $memid = mysql_fetch_array(mysql_query("SELECT id, name  FROM ibwf_users ORDER BY regdate DESC LIMIT 0,1"));
    echo "The Newest Member is: <b><a href=\"index.php?action=viewuser&amp;who=$memid[0]&amp;sid=$sid\">$memid[1]</a></b><br/><br/>";
    $mols = mysql_fetch_array(mysql_query("SELECT name, value FROM ibwf_settings WHERE id='2'"));
    echo "Most online: <b>$mols[1]</b> Members on $mols[0]<br/>";
    $mols = mysql_fetch_array(mysql_query("SELECT ppl, dtm FROM ibwf_mpot WHERE ddt='".date("d m y")."'"));
    echo "<br/>Most online(<a href=\"lists.php?action=moto&amp;sid=$sid\">today only</a>): <b>$mols[0]</b> Members at $mols[1]<br/>";
    $tm24 = (time() - $timeadjust) - (24*60*60) ;
    $aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE lastact>'".$tm24."'"));
    echo mysql_error();
    echo "<br/>Active users today <b>$aut[0]</b><br/>";
    $notc = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics"));
    $nops = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts"));
    echo "Number of Topics: <b>$notc[0]</b><br/>";
    echo "Number of Posts: <b>$nops[0]</b><br/>";
    $nopm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private"));
    echo "Number of PMs: <b>$nopm[0]</b><br/>";
    $nopm = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='Counter'"));
    echo "Counter: <b>$nopm[0]</b><br/><br/>";
    echo "</small>";
    echo "</p>";
    echo "<p>";
    echo "<small>";
    /////
    echo "<br/><i><u>General <b>Stats</b></u></i><br/>";    
    echo "<a href=\"index.php?action=l24&amp;sid=$sid\">&#187;What happend in the last 24 hours?</a><br/>";
    echo "<a href=\"lists.php?action=members&amp;sid=$sid\">&#187;Members($norm[0])</a><br/>";
    $norm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE sex='M'"));
    echo "<a href=\"lists.php?action=males&amp;sid=$sid\">--&#187;Males($norm[0])</a><br/>";
    $norm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE sex='F'"));
    echo "<a href=\"lists.php?action=fems&amp;sid=$sid\">--&#187;Females($norm[0])</a><br/>";     
    
    echo "<br/><i><u>Fun <b>Stats</b></u></i><br/>";
    $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_blogs"));
    echo "<a href=\"lists.php?action=allbl&amp;sid=$sid\">&#187;Blogs($noi[0])</a><br/>";
    $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE pollid>'0'"));
    echo "<a href=\"lists.php?action=polls&amp;sid=$sid\">&#187;Polls($noi[0])</a><br/>";
    $nobr=mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT browserm) FROM ibwf_users WHERE browserm IS NOT NULL "));
    echo "<a href=\"lists.php?action=brows&amp;sid=$sid\">&#187;Browsers($nobr[0])</a><br/>";
    
    echo "<br/><i><u>Members <b>Toplist</b></u></i><br/>";
    echo "<a href=\"lists.php?action=mmillionaire&amp;sid=$sid\">&#187;Arawap Millionaires</a><br/>";
    echo "<a href=\"lists.php?action=mpandps&amp;sid=$sid\">&#187;Arawap Prince and Princess</a><br/>";
    echo "<a href=\"lists.php?action=mquizm&amp;sid=$sid\">&#187;Arawap Quiz Masters</a><br/>";
    echo "<a href=\"lists.php?action=longon&amp;sid=$sid\">&#187;Longest Online</a><br/>";
    echo "<a href=\"lists.php?action=mostc&amp;sid=$sid\">&#187;Most Credits</a><br/>";
    echo "<a href=\"lists.php?action=topp&amp;sid=$sid\">&#187;Top Posters</a><br/>";
    echo "<a href=\"lists.php?action=tchat&amp;sid=$sid\">&#187;Top Chatters</a><br/>";
    echo "<a href=\"lists.php?action=topb&amp;sid=$sid\">&#187;Top Battlers</a><br/>";
    echo "<a href=\"lists.php?action=tshout&amp;sid=$sid\">&#187;Top Shouters</a><br/>";
    echo "<a href=\"lists.php?action=tthemes&amp;sid=$sid\">&#187;Top Themes</a><br/>";
    
    echo "<br/><i><u>Permission <b>Stats</b></u></i><br/>";
    $noi = mysql_fetch_array(mysql_query("SELECT count(*) FROM ibwf_users WHERE perm>'0'"));
    echo "<a href=\"lists.php?action=staff&amp;sid=$sid\">&#187;Staff Members($noi[0])</a><br/>";
    $noi = mysql_fetch_array(mysql_query("SELECT count(*) FROM ibwf_users WHERE specialid>'0'"));
    echo "<a href=\"lists.php?action=vips&amp;sid=$sid\">&#187;V.I.P Members($noi[0])</a><br/>";
    $noi = mysql_fetch_array(mysql_query("SELECT count(*) FROM ibwf_judges"));
    echo "<a href=\"lists.php?action=judg&amp;sid=$sid\">&#187;Battles Judges($noi[0])</a><br/>";
    $noi = mysql_fetch_array(mysql_query("SELECT count(*) FROM ibwf_metpenaltiespl WHERE penalty='1' OR penalty='2'"));
    
    echo "<br/><i><u>Other <b>Stats</b></u></i><br/>";
    $tbday=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users where month(`birthday`) = month(curdate()) and dayofmonth(`birthday`) = dayofmonth(curdate());"));
    echo "<a href=\"lists.php?action=bdy&amp;sid=$sid\">&#187;Today's Birthday($tbday[0])</a><br/>";    
    echo "<a href=\"lists.php?action=banned&amp;sid=$sid\">&#187;Banned($noi[0])</a><br/>";
    if(ismod(getuid_sid($sid)))
{
  $noi = mysql_fetch_array(mysql_query("SELECT count(*) FROM ibwf_metpenaltiespl WHERE penalty='0'"));
    echo "<a href=\"lists.php?action=trashed&amp;sid=$sid\">&#187;Trashed($noi[0])</a><br/>";
    $noi = mysql_fetch_array(mysql_query("SELECT count(*) FROM ibwf_metpenaltiespl WHERE penalty='2'"));
    echo "<a href=\"lists.php?action=ipban&amp;sid=$sid\">&#187;Banned IPs($noi[0])</a><br/>";
    }
   
    echo "</small></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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo xhtmlfoot();
}

else if($action=="l24")
{
    addonline(getuid_sid($sid),"24 Hour statistics - xHTML","index.php?action=$action");
    $pstyle = gettheme($sid);
    echo xhtmlhead("24 Hour Statistics",$pstyle);
    echo "<p>";
    echo "<small>";
    /////
    echo "Things happened in Arawap in the last 24 hours<br/><br/>";
    $tm24 = (time() - $timeadjust) - (24*60*60) ;
    $aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE lastact>'".$tm24."'"));
    echo "Active Members: <b>$aut[0]</b><br/>";
$aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE regdate>'".$tm24."'"));
    echo "Registered Members: <b>$aut[0]</b><br/>";
    $aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_blogs WHERE bgdate>'".$tm24."'"));
    echo "Blogs Created: <b>$aut[0]</b><br/>";
    $aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE joined>'".$tm24."' AND accepted='1'"));
    echo "Members Joined Clubs: <b>$aut[0]</b><br/>";
    $aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubs WHERE created>'".$tm24."'"));
    echo "Clubs Created: <b>$aut[0]</b><br/>";
    $aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE reqdt>'".$tm24."' AND agreed='1'"));
    echo "Buddies Added: <b>$aut[0]</b><br/>";
    $aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_gbook WHERE dtime>'".$tm24."'"));
    echo "Guestbooks Signed: <b>$aut[0]</b><br/>";
    if(ismod(getuid_sid($sid))){
    $aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_mlog WHERE actdt>'".$tm24."'"));
    echo "ModLog Actions: <b>$aut[0]</b><br/>";
  }
  $aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_polls WHERE pdt>'".$tm24."'"));
    echo "Polls Added: <b>$aut[0]</b><br/>";
    $aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE dtpost>'".$tm24."'"));
    echo "Posts: <b>$aut[0]</b><br/>";
    $aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE timesent>'".$tm24."'"));
    echo "PMs Sent: <b>$aut[0]</b><br/>";
    $aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_shouts WHERE shtime>'".$tm24."'"));
    echo "Shouts: <b>$aut[0]</b><br/>";
    $aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE crdate>'".$tm24."'"));
    echo "Topics Created: <b>$aut[0]</b><br/>";
    $aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_vault WHERE pudt>'".$tm24."'"));
    echo "Vault Items Added: <b>$aut[0]</b><br/>;";
    echo "</small></p>";
    echo "<p align=\"center\">";
echo "<a href=\"index.php?action=stats&amp;sid=$sid\"><img src=\"images/stat.gif\" alt=\"*\"/>";
echo "Statistics</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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo xhtmlfoot();
}



else if($action=="pmallmem")
{
	$clid=$_GET["clid"];
	$clinfo = mysql_fetch_array(mysql_query("SELECT name, owner, description, rules, logo, plusses, created FROM ibwf_clubs WHERE id='".$clid."'"));
	    addonline(getuid_sid($sid),"Xhtml - PMing Club Members","");
      $pstyle = gettheme($sid);
    echo xhtmlhead("Arawap",$pstyle);
    echo "<p align=\"center\">";
    echo "<b>PM All Members Of The $clinfo[0] Club</b><br/><br/>";
	echo "Please enter the message You Wish To Send To ALL Members Below<br/>";
	echo "<form action=\"index.php?action=sendclpm&amp;sid=$sid\" method=\"post\">";
	echo "<input name=\"pmtext\" maxlength=\"500\"/><br/>";
  
    echo "<input type=\"hidden\" name=\"clid\" value=\"$clid\"/>";
	 echo "<input type=\"hidden\" name=\"cname\" value=\"$clinfo[0] \"/>";
  
echo "<input type=\"submit\" value=\"SEND\"/>";
echo "</form>";
    echo "<p align=\"center\">";
    echo "<a href=\"index.php?action=clubs&amp;sid=$sid\">";
	echo "Clubs list</a><br/>";
    echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
	echo "Home</a>";
 	echo "</p>";
   echo xhtmlfoot();
    }
else if($action=="sendclpm")
{
$cname=$_POST["cname"];
	$clid=$_POST["clid"];
	$pmtext=$_POST["pmtext"];
	$clinfo = mysql_fetch_array(mysql_query("SELECT name, owner, description, rules, logo, plusses, created FROM ibwf_clubs WHERE id='".$clid."'"));
	$owner = $clinfo[1];
	    addonline(getuid_sid($sid),"Xhtml - PMing Club Members","");
      $pstyle = gettheme($sid);
    echo xhtmlhead("Arawap",$pstyle);
    echo "<p align=\"center\">";
    echo "<b>PM All Members Of The $clinfo[0] Club</b><br/><br/>";
	$mems = mysql_query("SELECT uid FROM ibwf_clubmembers WHERE clid='".$clid."' AND accepted='1'");
	while($row=mysql_fetch_array($mems))
	{
      $tm = time();
	  $pmtextn = "$pmtext [br/][br/]*[i] Automatic PM From [club=$clid] $cname [/club]Club![/i]*";
  $res = mysql_query("INSERT INTO ibwf_private SET text='".$pmtextn."', byuid='".$owner."', touid='".$row[0]."', timesent='".$tm."'");
}
  if($res)
  {

    echo "<img src=\"images/ok.gif\" alt=\"O\"/>";
    echo "PMs sent successfully<br/><br/>";
    echo parsepm($pmtextn, $sid);
  }else{
    echo "<img src=\"images/notok.gif\" alt=\"X\"/>";
    echo "Can't Send PM<br/><br/>";
  }
  echo "</p>";    
    echo "<p align=\"center\">";
    echo "<a href=\"index.php?action=clubs&amp;sid=$sid\">";
	echo "Clubs list</a><br/>";
    echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
	echo "Home</a>";
 	echo "</p>";
    echo xhtmlfoot();
    }
 

//////////////////////////////////View category

else if($action=="viewcat")
{
  $cinfo = mysql_fetch_array(mysql_query("SELECT name from ibwf_fcats WHERE id='".$cid."'"));
    $cid = $_GET["cid"];
    addonline(getuid_sid($sid),"xHTML-Viewing Category--$cinfo[0]","index.php?action=viewcat&amp;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 "<p>";
include ("pops.php");
    $forums = mysql_query("SELECT id, name FROM ibwf_forums WHERE cid='".$cid."' AND clubid='0' ORDER BY position, id, name");
    echo "<small>";
    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/2.gif\" alt=\"*\"/>";
      echo "<a href=\"index.php?action=viewfrm&amp;sid=$sid&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;sid=$sid&amp;tid=$lpt[0]&amp;go=last\">$tlnm</a>";
      $vulnk = "<a href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$tluid\">$tlnick</a>";
      echo "Last Post: $tpclnk, BY: $vulnk<br/><br/>";
      }
    }
    echo "</small>";
    echo "</p>";
    echo "<p align=\"center\">";
    $tmsg = getpmcount(getuid_sid($sid));
  $umsg = getunreadpm(getuid_sid($sid));
  if($umsg>0)
  {
  echo "<a href=\"inbox.php?action=main&amp;sid=$sid\">Inbox($umsg/$tmsg)</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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo xhtmlfoot();
}

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

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

   $tinfo = mysql_fetch_array(mysql_query("SELECT name, text, authorid, crdate, views, fid, pollid from ibwf_topics WHERE id='".$tid."'"));
    $tnm = htmlspecialchars($tinfo[0]);
  addonline(getuid_sid($sid),"xHTML-Viewing Topic-$tnm ","index.php?action=viewtpc&amp;page=$page&amp;tid=$tid");
  $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]))
    {
    $pstyle = gettheme($sid);
    echo xhtmlhead("Arawap",$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&amp;sid=$sid\">Home</a>";
      echo "</p>";
      echo xhtmlfoot();

      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($tnm,$pstyle);
    echo "<p align=\"center\">";
include ("pops.php");
    $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;sid=$sid&amp;tid=$tid\">Post reply</a>";
    $lastlink = "<a href=\"index.php?action=$action&amp;tid=$tid&amp;sid=$sid&amp;go=last\">Last Page</a>";
    $firstlink = "<a href=\"index.php?action=$action&amp;tid=$tid&amp;sid=$sid&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 align=\"center\">";
    $vws = $tinfo[4]+1;
    $rpls = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE tid='".$tid."'"));
    echo "<small>Replies: $rpls[0] - Views: $vws</small><br/>";
    echo "</p>";
    echo "<p>";
    ///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;sid=$sid&amp;who=$ttext[0]\">$iml$unick</a>";
    $topt = "<a href=\"index.php?action=tpcopt&amp;sid=$sid&amp;tid=$tid\">*</a>";
    if($go==$tid)
    {
      $fli = "<img src=\"images/flag.gif\" alt=\"!\"/>";
    }else{
      $fli ="";
    }
    $pst = parsemsg($ttext[1],$sid);
    $dtot = date("d/m/y - H:i:s",$ttext[2]);
    echo "<small>$usl: $dtot</small><br/>$fli$pst $topt<br/>";
    if($ttext[3]>0)
    {
      echo "<a href=\"index.php?action=viewtpl&amp;sid=$sid&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;sid=$sid&amp;who=$post[2]\">$iml$unick</a>";
    $pst = parsemsg($post[1], $sid);
    $topt = "<a href=\"index.php?action=pstopt&amp;sid=$sid&amp;pid=$post[0]&amp;page=$page&amp;fid=$tinfo[5]\">*</a>";
    if($post[4]>0)
    {
        $qtl = "<small><i><a href=\"index.php?action=viewtpc&amp;sid=$sid&amp;tid=$tid&amp;pst=\">(quote:p=blaze,d=16-04-2006)</a></i></small>";
    }
    if($go==$post[0])
    {
      $fli = "<img src=\"images/flag.gif\" alt=\"!\"/>";
    }else{
      $fli ="";
    }
    $dtot = date("d/m/y - H:i:s",$post[3]);
    echo "<small>$usl: $dtot</small><br/>$fli$pst $topt<br/>";
  }
    ///to here
    echo "</p>";
    echo "<p align=\"center\">";
    $tmsg = getpmcount(getuid_sid($sid));
  $umsg = getunreadpm(getuid_sid($sid));
  if($umsg>0)
  {
  echo "<a href=\"inbox.php?action=main&amp;sid=$sid\">Inbox($umsg/$tmsg)</a><br/>";
  }
    if($page>1)
    {
      $ppage = $page-1;
      echo "<a href=\"index.php?action=viewtpc&amp;page=$ppage&amp;sid=$sid&amp;tid=$tid\">&#171;PREV</a> ";
    }
    if($page<$num_pages)
    {
      $npage = $page+1;
      echo "<a href=\"index.php?action=viewtpc&amp;page=$npage&amp;sid=$sid&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;sid=$sid&amp;tid=$tid\">Post reply</a>";
    echo "</p>";
    echo "<p><small>";
    $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=\"index.php?action=main&amp;sid=$sid\">";
echo "Home</a>&gt;";
    echo "<a href=\"index.php?action=formmenu&amp;sid=$sid\">";
echo "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;sid=$sid&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;sid=$sid&amp;clid=$cid[0]\">";
    echo "$cname Club</a><br/>";
  }
  $fname = htmlspecialchars($fname);
    echo "&gt;<a href=\"index.php?action=viewfrm&amp;sid=$sid&amp;fid=$fid\">$fname</a>&gt;$tnm";
  echo "</small></p>";
    echo xhtmlfoot();
}
//////////////////////////////////View Forum

else if($action=="viewfrm")
{
  
    $fid = $_GET["fid"];
	$view = $_GET["view"];
    if(!canaccess(getuid_sid($sid), $fid))
    {
      addonline(getuid_sid($sid),"Lost in forums - xHTML","");
    $pstyle = gettheme($sid);
    echo xhtmlhead("Arawap",$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&amp;sid=$sid\">Home</a>";
      echo "</p>";
      echo xhtmlfoot();

      exit();
    }
	$finfo = mysql_fetch_array(mysql_query("SELECT name from ibwf_forums WHERE id='".$fid."'"));
    $fnm = htmlspecialchars($finfo[0]);
    addonline(getuid_sid($sid),"xHTML-Viewing Forum-$fnm","index.php?action=viewfrm&amp;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($fnm,$pstyle);
    echo "<p align=\"center\">";
include ("pops.php");
    $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&amp;sid=$sid&amp;fid=$fid\"><img src=\"images/rss.gif\" alt=\"rss\"/>$finfo[0] Extras</a><br/>";
    }
    echo "<a href=\"index.php?action=newtopic&amp;sid=$sid&amp;fid=$fid\">New Topic</a><br/>";
    
  echo "<form method=\"get\" action=\"index.php\">"; 
  echo "View: <select name=\"vopt\">";
  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=\"hidden\" name=\"action\" value=\"$action\"/>";
  echo "<input type=\"hidden\" name=\"fid\" value=\"$fid\"/>";
  echo "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";  
  echo "<input type=\"submit\" name=\"Submit\" value=\"[GO]\"/><br/>";
  echo "</form>"; 
          
	if($view=="new")
	{
		echo "<small>Viewing topics that has 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>";
    echo "<small>";
    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;sid=$sid&amp;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 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;sid=$sid&amp;tid=$topic[0]\">$iml$tnm($nop[0])$atxt</a><br/>";

    }

    echo "</small>";

    echo "</p>";
    echo "<p align=\"center\">";
$tmsg = getpmcount(getuid_sid($sid));
  $umsg = getunreadpm(getuid_sid($sid));
  if($umsg>0)
  {
  echo "<a href=\"inbox.php?action=main&amp;sid=$sid\">Inbox($umsg/$tmsg)</a><br/>";
  }
    if($page>1)
    {
      $ppage = $page-1;
      echo "<a href=\"index.php?action=viewfrm&amp;page=$ppage&amp;sid=$sid&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;sid=$sid&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;sid=$sid&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;sid=$sid&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;sid=$sid&amp;clid=$cid[0]\">";
    echo "$cname Club</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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo xhtmlfoot();
}


else if($action=="prop")
{
 $whonick = getnick_uid($who);
  addonline(getuid_sid($sid),"$whonick's Property","");

$pstyle = gettheme($sid);
    echo xhtmlhead("user Property",$pstyle);
  echo "<p align=\"center\">";
  
  $nick = getnick_sid($sid);
  $whonick = getnick_uid($who);
  
  echo "<i><b><u><small>$whonick's Property:</small></u></b></i><br/>";

  echo "</p>";
  echo "<p>";
  
     $sql = "SELECT itemid FROM ibwf_shop_Inventory WHERE uid='".$who."'";

    $items = mysql_query($sql);
    echo mysql_error();
    if(mysql_num_rows($items)>0)
    {
    while ($item = mysql_fetch_array($items))
    {
    $shopitem = mysql_fetch_array(mysql_query("SELECT itemid, itemname, itemshopid FROM ibwf_shop WHERE itemid='".$item[0]."'"));
	
    echo "$shopitem[1], ";
    if($shopitem[2]=='1'){

    }
   
   
  }
 }
    
    
    echo "</p>";
  ////// UNTILL HERE >> 
  echo "<p align=\"center\">";
  echo "<br/><a href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$who\">";
$whonick = getnick_uid($who);
echo "Back to $whonick's Profile</a><br/>";
  echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Home</a>";
  echo "</p>";
    echo xhtmlfoot();
  }
    
    


//////////////////////////////////ONLINE USERS
else if($action=="newtopic")
{
  $fid = $_GET["fid"];
  if(!canaccess(getuid_sid($sid), $fid))
    {
    $pstyle = gettheme($sid);
    echo xhtmlhead("Arawap",$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&amp;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&amp;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&amp;sid=$sid&amp;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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";

    echo "</p>";
    echo xhtmlfoot();
}

//////////////////////////////////////////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("Arawap",$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&amp;sid=$sid\">Home</a>";
      echo "</p>";
      echo xhtmlfoot();

      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]);
    addonline(getuid_sid($sid),"xHTML-Posting Reply at $tnm","");
    
    $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&amp;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&amp;sid=$sid&amp;tid=$tid\">";
echo "Back to topic</a>";
      echo "<br/><a href=\"index.php?action=viewfrm&amp;sid=$sid&amp;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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
    echo "</p>";
    echo xhtmlfoot();
}
//////////////////////////////////extra

else if($action=="extra")
{
    addonline(getuid_sid($sid),"site Extras-xhtml","index.php?action=$action");
	$pstyle = gettheme($sid);
    echo xhtmlhead("Extra",$pstyle);
   
    echo "<p align=\"left\">";
include("pops.php");
    echo "<b>Site Extras</b><br/><br/>";
	echo "<a
href=\"index.php?action=chapel&amp;sid=$sid\">Ara-Chapel [NEW]!</a><br/>";
echo "<a href=\"index.php?action=jstaff&amp;sid=$sid\">join to arawap STAFF!! </a><br/>";

 echo "<a href=\"http://arawap.net/go\">";
echo "Arawap Browser!</a><br/>";
    
    echo "<a href=\"../news/index.php?action=main&amp;sid=$sid\">";
echo "BBC hOt NEWS!!</a><br/>";
 echo "<a href=\"index.php?action=help&amp;sid=$sid\">";
echo "Help</a><br/>";
  echo "<a href=\"lists.php?action=faqs&amp;sid=$sid\">";
echo "F.A.Q.s</a><br/>";
  echo "<a href=\"index.php?action=terms&amp;sid=$sid\">Terms of Use</a><br/>";
  echo "<br/>";
    echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
    echo "</p>";
   echo xhtmlfoot();
}

//////////////////////////////////////////shout

else if($action=="shout")
{
    addonline(getuid_sid($sid),"Shouting - xHTML","index.php?action=$action");

$pstyle = gettheme($sid);
    echo xhtmlhead("Shout",$pstyle);
    echo "<p align=\"center\">";
    if(getplusses(getuid_sid($sid))<75)
    {
        echo "You should have at least 75 Credits to shout!,just ask credits from online staff member.";
    }else{
  echo "<form method=\"post\" action=\"genproc.php?action=shout&amp;sid=$sid\">";
  echo "Text:<input name=\"shtxt\" maxlength=\"100\"/><br/>";
  echo "<input type=\"submit\" name=\"Submit\" value=\"Shout\"/><br/>";
  echo "</form>";
            }
    $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 "<br/><br/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
    echo "</p>";
    echo xhtmlfoot();
}

//////////////////////////////////////////shout

else if($action=="annc")
{
    addonline(getuid_sid($sid),"Announcing! - xHTML","");
    $clid = $_GET["clid"];
    $pstyle = gettheme($sid);
    echo xhtmlhead("Announce!",$pstyle);
    echo "<p align=\"center\">";
    $cow = mysql_fetch_array(mysql_query("SELECT owner FROM ibwf_clubs WHERE id='".$clid."'"));
    $uid = getuid_sid($sid);
    if($cow[0]!=$uid)
    {
        echo "This club is not yours!";
    }else{
    
            
     echo "<form method=\"post\" action=\"genproc.php?action=annc&amp;sid=$sid&amp;clid=$clid\">"; 
     echo "Text:<input name=\"antx\" maxlength=\"200\"/><br/>";
     echo "<input type=\"submit\" name=\"Submit\" value=\"Announce\"/><br/>";
     echo "</form>"; 
  
            }
    $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 "<br/><br/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
    echo "</p>";
    echo xhtmlfoot();
}

//////////////////////////////////admin

else if($action=="jstaff")
{
    addonline(getuid_sid($sid),"trying to join AW staff","index.php?action=$action");
   $pstyle = gettheme($sid);
    echo xhtmlhead("join AW staff",$pstyle);
    echo "<p align=\"left\">";
include ("pops.php");
    echo "<b>join AW staff</b><br/><br/>";
 echo "of course u can join our arawap staff and work with us together.<br/>
Simply pm to <b>araa</b> that u'd like to join arawap staff and why u suitable to be a staff member here. but u should have a some knowledge of arawap and its all featuers.<br/> coz U will have to face a little test about arawap and its contents. if u'll be able to get more than 75% marks from it., we select u as a staff member.<br/><br/>
<u>ABOUT staff test:</u>with ur pm to araa, u will get a questions PM . then u have one hour to reply it. its all about arawap and wap features here! <br/><br/>and additionally u will be added some marks if have u these Qualifications..<br/>
* being a old arawapper<br/>
*signing others guest books<br/>
*always online in arawap<br/>
*have A OWN wap site<br/>
*have a knowledge of WML codings<br/>
*having much buddies in arawap<br/>
*inviting new freinds to arawap and specially having a cute smile on ur face
<br/><br/>
<b> all the best! hope u will be a staff member here!! good luck!!</b>
<br/>";
  
    echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
    echo "</p>";
   echo xhtmlfoot();
}

//////////////////////////////////////////Guestbook

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

    
if(!getplusses(getuid_sid($sid))>50)
    {
$pstyle = gettheme($sid);
    echo xhtmlhead("Arawap",$pstyle);
      echo "<p align=\"center\">";
      echo "At least you should have 50 Credits to add a blog<br/><br/>";
      echo "<a href=\"index.php?action=main&amp;sid=$sid\">Home</a>";
      echo "</p>";
      echo xhtmlfoot();

      exit();
    }
    addonline(getuid_sid($sid),"Adding a blog - xHTML","");

$pstyle = gettheme($sid);
    echo xhtmlhead("Add Blog",$pstyle);
    echo "<onevent type=\"onenterforward\">";
  echo "<refresh>
        <setvar name=\"msgtxt\" value=\"\"/>
        <setvar name=\"btitle\" value=\"\"/>
   ";
  echo "</refresh></onevent>";
    
    echo "<p align=\"center\">";
    
      echo "<form method=\"post\" action=\"genproc.php?action=addblg&amp;sid=$sid\">";
    echo "Title:<input name=\"btitle\" maxlength=\"30\"/><br/>";
    echo "Text:<input name=\"msgtxt\" maxlength=\"500\"/><br/>";
  echo "<input type=\"submit\" name=\"Submit\" value=\"Add\"/><br/>";
  echo "</form>";
            
    $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 "<br/><br/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
    echo "</p>";
    echo xhtmlfoot();
}

//////////////////////////////////////////add vault

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


if(!getplusses(getuid_sid($sid))>25)
    {
        $pstyle = gettheme($sid);
    echo xhtmlhead("Arawap",$pstyle);
      echo "<p align=\"center\">";
      echo "At least you should have 25 Credits to add an item to your vault<br/><br/>";
      echo "<a href=\"index.php?action=main&amp;sid=$sid\">Home</a>";
      echo "</p>";
      echo xhtmlfoot();

      exit();
    }
    addonline(getuid_sid($sid),"Adding a vault item - xHTML","index.php?action=$action");

$pstyle = gettheme($sid);
    echo xhtmlhead("Add Vault Item",$pstyle);
    echo "<onevent type=\"onenterforward\">";
  echo "<refresh>
        <setvar name=\"viname\" value=\"\"/>
        <setvar name=\"vilink\" value=\"\"/>
   ";
  echo "</refresh></onevent>";

    echo "<p align=\"center\">";
    echo "<small>The vault is used to store your downloadable links,like images, mp3's, games  etc...<br/>WARNING: if you used it to wapsites links they will got deleted and you'll lose some Credits, if you used it for ranking sites links like 2wap, mradar, you'll be banned</small><br/><br/>";
    echo "<form method=\"post\" action=\"genproc.php?action=addvlt&amp;sid=$sid\">";
    echo "Item Name:<input name=\"viname\" maxlength=\"50\"/><br/>";
    echo "Item Url:<input name=\"vilink\" maxlength=\"255\"/><br/>";
  echo "<input type=\"submit\" name=\"Submit\" value=\"Add\"/><br/>";
  echo "</form>";
      

    $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 "<br/><br/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
    echo "</p>";
    echo xhtmlfoot();
}
//////////////////////////////////////////Guestbook

else if($action=="signgb")
{
$who=$_GET["who"];
addonline(getuid_sid($sid),"Signing a guestbook - xHTML","");
if(!cansigngb(getuid_sid($sid), $who))
    {
        $pstyle = gettheme($sid);
    echo xhtmlhead("Sign a Guestbook",$pstyle);
      echo "<p align=\"center\">";
      echo "You cant Sign this user guestbook<br/><br/>";
      echo "<a href=\"index.php?action=main&amp;sid=$sid\">Home</a>";
      echo "</p>";
      echo xhtmlfoot();

      exit();
    }
    

        $pstyle = gettheme($sid);
    echo xhtmlhead("Sign Guestbook",$pstyle);
    echo "<onevent type=\"onenterforward\">";
  echo "<refresh>
        <setvar name=\"msgtxt\" value=\"\"/>
        
   ";
  echo "</refresh></onevent>";

    echo "<p align=\"center\">";
    echo "<form method=\"post\" action=\"genproc.php?action=signgb&amp;sid=$sid\">";
    echo "Text:<input name=\"msgtxt\" maxlength=\"500\"/><br/>";
    echo "<input type=\"hidden\" name=\"who\" value=\"$who\"/>";
    echo "<input type=\"submit\" name=\"Submit\" value=\"Sign\"/><br/>";
    echo "</form>";

    $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 "<br/><br/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
    echo "</p>";
    echo xhtmlfoot();
}

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

  addonline(getuid_sid($sid),"Online List - xHTML","index.php?action=$action");
$pstyle = gettheme($sid);
    echo xhtmlhead("Online List",$pstyle);


  //////ALL LISTS SCRIPT <<

    if($page=="" || $page<=0)$page=1;
    $num_items = getnumonline(); //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;

    //changable sql
    $sql = "SELECT
            a.name, b.place, b.userid, sex FROM ibwf_users a
            INNER JOIN ibwf_online b ON a.id = b.userid
            GROUP BY 1,2
            LIMIT $limit_start, $items_per_page
    ";
    echo "<p><small>";
    $mols = mysql_fetch_array(mysql_query("SELECT name, value FROM ibwf_settings WHERE id='2'"));
    print "Most online: <b>$mols[1]</b><br/>";
    $mols = mysql_fetch_array(mysql_query("SELECT ppl, dtm FROM ibwf_mpot WHERE ddt='".date("d m y")."'"));
    print "Most online today only: <b>$mols[0]</b><br/>";
    $items = mysql_query($sql);
    echo mysql_error();
    while ($item = mysql_fetch_array($items))
    {
      if ($item[3]=="M"){
      $icon = "<img src=\"images/male.gif\" alt=\"M\"/>";
      }else
      if ($item[3]=="F"){
      $icon = "<img src=\"images/female.gif\" alt=\"F\"/>";
      }
      $lnk = "<a href=\"index.php?action=viewuser&amp;who=$item[2]&amp;sid=$sid\">$item[0]</a>";
      echo "$icon $lnk - $item[1] <br/>";
    }
    echo "</small></p>";
    echo "<p align=\"center\">";
    if($page>1)
    {
      $ppage = $page-1;
      echo "<a href=\"index.php?action=online&amp;page=$ppage&amp;sid=$sid\">&#171;PREV</a> ";
    }
    if($page<$num_pages)
    {
      $npage = $page+1;
      echo "<a href=\"index.php?action=online&amp;page=$npage&amp;sid=$sid\">Next&#187;</a>";
    }
    echo "<br/>$page/$num_pages<br/>";
    if($num_pages>2)
    {
      echo getjumper($action, $sid,"index");
    }
    echo "</p>";
  ////// UNTILL HERE >>

  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=\"lists.php?action=longon&amp;sid=$sid\">&#187;Longest Online</a><br/>";
	 echo "<a href=\"index.php?action=chat&amp;sid=$sid\">&#187;Chat Rooms</a><br/>";
  echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
  echo xhtmlfoot();
}
else if($action=="viewpl")
{
  $who = $_GET["who"];
  addonline(getuid_sid($sid),"Viewing a poll - xHTML","");
$pstyle = gettheme($sid);
    echo xhtmlhead("View A Poll",$pstyle);
    echo "<p>";
    $uid = getuid_sid($sid);
    $pollid = mysql_fetch_array(mysql_query("SELECT pollid FROM ibwf_users WHERE id='".$who."'"));
    if($pollid[0]>0)
    {
        $polli = mysql_fetch_array(mysql_query("SELECT id, pqst, opt1, opt2, opt3, opt4, opt5, pdt FROM ibwf_polls WHERE id='".$pollid[0]."'"));
        if(trim($polli[1])!="")
        {
            $qst = parsepm($polli[1], $sid);
            echo $qst."<br/><br/>";
            $vdone = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE uid='".$uid."' AND pid='".$pollid[0]."'"));
            $nov = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."'"));
            $nov = $nov[0];
            if($vdone[0]>0)
            {
              $voted= true;
            }else{
              $voted = false;
            }
            $opt1 = $polli[2];
            if (trim($opt1)!="")
            {
              $opt1 = htmlspecialchars($opt1);
              $nov1 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='1'"));
              $nov1 = $nov1[0];
              if($nov>0)
              {
              $per = floor(($nov1/$nov)*100);
              $rests = "Votes: $nov1($per%)";
              }else{
                $rests = "Votes: 0(0%)";
              }
                if($voted)
                {
                  $lnk = "1.$opt1 <small>$rests</small><br/>";
                }else{
              $lnk = "1.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=1\">$opt1</a> <small>$rests</small><br/>";
              }
              echo "$lnk";
            }
            $opt2 = $polli[3];
            if (trim($opt2)!="")
            {
              $opt2 = htmlspecialchars($opt2);
              $nov2 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='2'"));
              $nov2 = $nov2[0];
              if($nov>0)
              {
              $per = floor(($nov2/$nov)*100);
              $rests = "Votes: $nov2($per%)";
              }else{
                $rests = "Votes: 0(0%)";
              }
              if($voted)
                {
                  $lnk = "2.$opt2 <small>$rests</small><br/>";
                }else{
              $lnk = "2.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=2\">$opt2</a> <small>$rests</small><br/>";
              }
              echo "$lnk";
            }
            $opt3 = $polli[4];
            if (trim($opt3)!="")
            {
              $opt3 = htmlspecialchars($opt3);
              $nov3 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='3'"));
              $nov3 = $nov3[0];
              if($nov>0)
              {
              $per = floor(($nov3/$nov)*100);
              $rests = "Votes: $nov3($per%)";
              }else{
                $rests = "Votes: 0(0%)";
              }
              if($voted)
                {
                  $lnk = "3.$opt3 <small>$rests</small><br/>";
                }else{
              $lnk = "3.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=3\">$opt3</a> <small>$rests</small><br/>";
              }
              echo "$lnk";
            }
            $opt4 = $polli[5];
            if (trim($opt4)!="")
            {
              $opt4 = htmlspecialchars($opt4);
              $nov4 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='4'"));
              $nov4 = $nov4[0];
              if($nov>0)
              {
              $per = floor(($nov4/$nov)*100);
              $rests = "Votes: $nov4($per%)";
              }else{
                $rests = "Votes: 0(0%)";
              }
              if($voted)
                {
                  $lnk = "4.$opt4 <small>$rests</small><br/>";
                }else{
              $lnk = "4.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=4\">$opt4</a> <small>$rests</small><br/>";
              }
              echo "$lnk";
            }
            $opt5 = $polli[6];
            if (trim($opt5)!="")
            {
              $opt5 = htmlspecialchars($opt5);
              $nov5 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='5'"));
              $nov5 = $nov5[0];
              if($nov>0)
              {
              $per = floor(($nov5/$nov)*100);
              $rests = "Votes: $nov5($per%)";
              }else{
                $rests = "Votes: 0(0%)";
              }
              if($voted)
                {
                  $lnk = "5.$opt5 <small>$rests</small><br/>";
                }else{
              $lnk = "5.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=5\">$opt5</a> <small>$rests</small><br/>";
              }
              echo "$lnk";
            }
            echo "<small>".date("d m y - H:i",$polli[7])."</small>";
        }else{
            echo "<img src=\"images/notok.gif\" alt=\"x\"/>This poll doesn't exist";
        }
    }else{
        echo "<img src=\"images/notok.gif\" alt=\"x\"/>This user have no poll";
    }
    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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
  echo xhtmlfoot();
    
}

else if($action=="viewtpl")
{
  $who = $_GET["who"];
  addonline(getuid_sid($sid),"Viewing a poll - xHTML","");
$pstyle = gettheme($sid);
    echo xhtmlhead("View A Poll",$pstyle);
    echo "<p>";
    $uid = getuid_sid($sid);
    $pollid = mysql_fetch_array(mysql_query("SELECT pollid FROM ibwf_topics WHERE id='".$who."'"));
    if($pollid[0]>0)
    {
        $polli = mysql_fetch_array(mysql_query("SELECT id, pqst, opt1, opt2, opt3, opt4, opt5, pdt FROM ibwf_polls WHERE id='".$pollid[0]."'"));
        if(trim($polli[1])!="")
        {
            $qst = parsepm($polli[1], $sid);
            echo $qst."<br/><br/>";
            $vdone = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE uid='".$uid."' AND pid='".$pollid[0]."'"));
            $nov = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."'"));
            $nov = $nov[0];
            if($vdone[0]>0)
            {
              $voted= true;
            }else{
              $voted = false;
            }
            $opt1 = $polli[2];
            if (trim($opt1)!="")
            {
              $opt1 = htmlspecialchars($opt1);
              $nov1 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='1'"));
              $nov1 = $nov1[0];
              if($nov>0)
              {
              $per = floor(($nov1/$nov)*100);
              $rests = "Votes: $nov1($per%)";
              }else{
                $rests = "Votes: 0(0%)";
              }
                if($voted)
                {
                  $lnk = "1.$opt1 <small>$rests</small><br/>";
                }else{
              $lnk = "1.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=1\">$opt1</a> <small>$rests</small><br/>";
              }
              echo "$lnk";
            }
            $opt2 = $polli[3];
            if (trim($opt2)!="")
            {
              $opt2 = htmlspecialchars($opt2);
              $nov2 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='2'"));
              $nov2 = $nov2[0];
              if($nov>0)
              {
              $per = floor(($nov2/$nov)*100);
              $rests = "Votes: $nov2($per%)";
              }else{
                $rests = "Votes: 0(0%)";
              }
              if($voted)
                {
                  $lnk = "2.$opt2 <small>$rests</small><br/>";
                }else{
              $lnk = "2.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=2\">$opt2</a> <small>$rests</small><br/>";
              }
              echo "$lnk";
            }
            $opt3 = $polli[4];
            if (trim($opt3)!="")
            {
              $opt3 = htmlspecialchars($opt3);
              $nov3 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='3'"));
              $nov3 = $nov3[0];
              if($nov>0)
              {
              $per = floor(($nov3/$nov)*100);
              $rests = "Votes: $nov3($per%)";
              }else{
                $rests = "Votes: 0(0%)";
              }
              if($voted)
                {
                  $lnk = "3.$opt3 <small>$rests</small><br/>";
                }else{
              $lnk = "3.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=3\">$opt3</a> <small>$rests</small><br/>";
              }
              echo "$lnk";
            }
            $opt4 = $polli[5];
            if (trim($opt4)!="")
            {
              $opt4 = htmlspecialchars($opt4);
              $nov4 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='4'"));
              $nov4 = $nov4[0];
              if($nov>0)
              {
              $per = floor(($nov4/$nov)*100);
              $rests = "Votes: $nov4($per%)";
              }else{
                $rests = "Votes: 0(0%)";
              }
              if($voted)
                {
                  $lnk = "4.$opt4 <small>$rests</small><br/>";
                }else{
              $lnk = "4.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=4\">$opt4</a> <small>$rests</small><br/>";
              }
              echo "$lnk";
            }
            $opt5 = $polli[6];
            if (trim($opt5)!="")
            {
              $opt5 = htmlspecialchars($opt5);
              $nov5 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_presults WHERE pid='".$pollid[0]."' AND ans='5'"));
              $nov5 = $nov5[0];
              if($nov>0)
              {
              $per = floor(($nov5/$nov)*100);
              $rests = "Votes: $nov5($per%)";
              }else{
                $rests = "Votes: 0(0%)";
              }
              if($voted)
                {
                  $lnk = "5.$opt5 <small>$rests</small><br/>";
                }else{
              $lnk = "5.<a href=\"genproc.php?action=votepl&amp;sid=$sid&amp;plid=$pollid[0]&amp;ans=5\">$opt5</a> <small>$rests</small><br/>";
              }
              echo "$lnk";
            }
            echo "<small>".date("d m y - H:i",$polli[7])."</small>";
        }else{
            echo "<img src=\"images/notok.gif\" alt=\"x\"/>This poll doesn't exist";
        }
    }else{
        echo "<img src=\"images/notok.gif\" alt=\"x\"/>This user have no poll";
    }
    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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
  echo xhtmlfoot();

}
else if($action=="stfol")
{

  addonline(getuid_sid($sid),"Staff online list - xHTML","index.php?action=$action");
$pstyle = gettheme($sid);
    echo xhtmlhead("Staff Online",$pstyle);


  //////ALL LISTS SCRIPT <<

    if($page=="" || $page<=0)$page=1;
    $timeout = 180;
  $timeon = (time() - $timeadjust)  - $timeout;
  $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE perm>'0' AND lastact>'".$timeon."'"));
    $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;
    //changable sql
    $sql = "
    SELECT name, perm, id FROM ibwf_users WHERE perm>'0' AND lastact>'".$timeon."'
            LIMIT $limit_start, $items_per_page
    ";
    echo "<p><small>";
    $items = mysql_query($sql);
    echo mysql_error();
    while ($item = mysql_fetch_array($items))
    {
      $lnk = "<a href=\"index.php?action=viewuser&amp;who=$item[2]&amp;sid=$sid\">$item[0]</a>";
      if($item[1]==1)
      {
        $item[1] = "Moderator!";
        $icon = "<img src=\"images/mod.gif\" alt=\"M\"/>";
      }
      else if($item[1]==2)
      {
        $item[1] = "Admin!";
        $icon = "<img src=\"images/hadmin.gif\" alt=\"A\"/>";
      }
      else if($item[1]==3)
      {
        $item[1] = "Head Admin!";
        $icon = "<img src=\"images/admin.gif\" alt=\"O\"/>";
		 }
      else if($item[1]==4)
      {
        $item[1] = "Owner!";
        $icon = "<img src=\"images/owner.gif\" alt=\"O\"/>";
      }
      echo "$icon $lnk - $item[1] <br/>";
    }
    echo "</small></p>";
    echo "<p align=\"center\">";
    if($page>1)
    {
      $ppage = $page-1;
      echo "<a href=\"index.php?action=$action&amp;page=$ppage&amp;sid=$sid\">&#171;PREV</a> ";
    }
    if($page<$num_pages)
    {
      $npage = $page+1;
      echo "<a href=\"index.php?action=$action&amp;page=$npage&amp;sid=$sid\">Next&#187;</a>";
    }
    echo "<br/>$page/$num_pages<br/>";
    if($num_pages>2)
    {
      echo getjumper($action, $sid,"index");
    }
    echo "</p>";
  ////// UNTILL HERE >>

  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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
  echo xhtmlfoot();
}
//////////////////////////VIP Online Begin
else if($action=="vipol")
{

  addonline(getuid_sid($sid),"V.I.P online list - xHTML","index.php?action=$action");
$pstyle = gettheme($sid);
    echo xhtmlhead("V.I.P's Online",$pstyle);


  //////ALL LISTS SCRIPT <<

    if($page=="" || $page<=0)$page=1;
    $timeout = 180;
  $timeon = (time() - $timeadjust)  - $timeout;
  $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE specialid>'0' AND lastact>'".$timeon."'"));
    $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;
    //changable sql
    $sql = "SELECT name, specialid, id FROM ibwf_users WHERE specialid>'0' AND lastact>'".$timeon."' LIMIT $limit_start, $items_per_page";
    echo "<p><small>";
    $items = mysql_query($sql);
    echo mysql_error();
    while ($item = mysql_fetch_array($items))
    {
      $lnk = "<a href=\"index.php?action=viewuser&amp;who=$item[2]&amp;sid=$sid\">$item[0]</a>";
        if($item[1]=='1')
        {
          $tit = "Arawap Millionaire!";
        }
        if($item[1]=='2')
        {
          $tit = "Arawap Quiz Master!";
        }
        if($item[1]=='8')
        {
          $tit = "Arawap Prince!";
        }
        if($item[1]=='9')
        {
          $tit = "Arawap Princess!";
        }
       echo "$lnk - $tit <br/>";
    }
    echo "</small></p>";
    echo "<p align=\"center\">";
    if($page>1)
    {
      $ppage = $page-1;
      echo "<a href=\"index.php?action=$action&amp;page=$ppage&amp;sid=$sid\">&#171;PREV</a> ";
    }
    if($page<$num_pages)
    {
      $npage = $page+1;
      echo "<a href=\"index.php?action=$action&amp;page=$npage&amp;sid=$sid\">Next&#187;</a>";
    }
    echo "<br/>$page/$num_pages<br/>";
    if($num_pages>2)
    {
      echo getjumper($action, $sid,"index");
    }
    echo "</p>";
  ////// UNTILL HERE >>

  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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
  echo xhtmlfoot();
}
//////////////////////////VIP ONLINE END


else if($action=="chbmsg")
{
  addonline(getuid_sid($sid),"Buddy Message - xHTML","");
$pstyle = gettheme($sid);
    echo xhtmlhead("Buddy Message",$pstyle);
    echo "<onevent type=\"onenterforward\">";
    $cmsg = htmlspecialchars(getbudmsg(getuid_sid($sid)));
    echo "<refresh>
        <setvar name=\"bmsg\" value=\"$cmsg\"/>";
    echo "</refresh></onevent>";
    echo "<p align=\"center\">";
    echo "<form method=\"post\" action=\"genproc.php?action=upbmsg&amp;sid=$sid\">";
    echo "Text:<input name=\"bmsg\" maxlength=\"100\" value=\"$cmsg\"/><br/>";
    echo "<input type=\"hidden\" name=\"who\" value=\"$who\"/>";
    echo "<input type=\"submit\" name=\"Submit\" value=\"Update\"/><br/>";
    echo "</form>";

            echo "<br/><br/>";
 echo "<a href=\"lists.php?action=buds&amp;sid=$sid\">";
echo "Buddies List</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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
  echo xhtmlfoot();
}

/////////////////////////////////viewuser profile

else if($action=="viewuser")
{
 $whonick = getnick_uid($who);addonline(getuid_sid($sid),"xHTML-Viewing Profile of $whonick","index.php?action=viewuser&amp;who=$who");
  $pstyle = gettheme($sid);
    echo xhtmlhead($whonick." Profile",$pstyle);
  echo "<p align=\"center\">";
  if($who==""||$who==0)
  {
    $mnick = $_POST["mnick"];
    $who = getuid_nick($mnick);
  }
  $whonick = getnick_uid($who);
  if($whonick!="")
  {
  echo "$whonick's Profile<br/>";
  echo "<small>";
  $noi = mysql_fetch_array(mysql_query("SELECT lastact FROM ibwf_users WHERE id='".$who."'"));$var1 = date("His",$noi[0]);$var2 = time();$var21 = date("His",$var2);$var3 = $var21 - $var1;$var4 = date("s",$var3);echo "Idle: ";$remain = time() - $noi[0];$idle = gettimemsg($remain);echo "$idle<br/>"; 



$arawap = mysql_fetch_array(mysql_query("SELECT id,
lastseen, lastdet FROM ibwf_users WHERE
id='".$who."'"));
     if(isonline($arawap[0]))
   {
$sitelocation = mysql_fetch_array(mysql_query("SELECT
place FROM ibwf_online WHERE userid='".$who."'"));
     $iml = "Where: $sitelocation[0]";
   }else{
       $iml = "Offline: Last Seen at $arawap[1]";
    }
 echo "$iml";
if($arawap[2])
{
  echo " <a href=\"$arawap[2]&amp;sid=$sid\">go
there</a>";
}


  echo "<br/><a href=\"inbox.php?action=sendpm&amp;who=$who&amp;sid=$sid\">Send PM</a><br/><br/>";
  if(cansee(getuid_sid($sid), $who))
  {
    
    $unol = mysql_fetch_array(mysql_query("SELECT lastpnreas FROM ibwf_users WHERE id='".$who."'"));
    if($unol[0]!="")
    {
      echo "Last Penalty Reason: $unol[0]<br/>";
    }
    $unol = mysql_fetch_array(mysql_query("SELECT lastplreas FROM ibwf_users WHERE id='".$who."'"));
    if($unol[0]!="")
    {
      echo "Last Credits Reason: $unol[0]<br/>";
    }
  }
  $uid = getuid_sid($sid);
  if(budres($uid, $who)==0)
  {
    echo "<a href=\"genproc.php?action=bud&amp;who=$who&amp;sid=$sid&amp;todo=add\">Add to buddy list</a><br/>";
  }else if(budres($uid, $who)==1)
  {
    echo "Buddy request in the queue<br/>";
  }else if(budres($uid, $who)==2)
  {
    echo "<a href=\"genproc.php?action=bud&amp;who=$who&amp;sid=$sid&amp;todo=del\">Remove From buddy list</a><br/>";
  }
  $ires = ignoreres($uid, $who);
  if(es==2)
  {
    echo "<a href=\"genproc.php?action=ign&amp;who=$who&amp;sid=$sid&amp;todo=del\">Remove From Ignore list</a><br/>";
  }else if($ires==1)
  {
    echo "<a href=\"genproc.php?action=ign&amp;who=$who&amp;sid=$sid&amp;todo=add\">Add to Ignore list</a><br/>";
  }
  //echo "<a href=\"userfun.php?action=profile&amp;who=$who&amp;sid=$sid\">Fun and Games</a><br/>";
  $married=mysql_fetch_array(mysql_query("SELECT * from
ibwf_married WHERE frmuid='".$who."' OR touid='".$who."'"));

  if($married['frmuid']==$who)

  {

                  if($married['agreed']==1)

                               {

                                               if($married['complete']==1)

                                                               {


$unick=getnick_uid($who);


$mnick=getnick_uid($married['touid']);


echo "<strong>$unick is Married To $mnick</strong><br/><br/>";

                                                               }

                               }

  }else{

                  if($married['agreed']==1)

                               {

                                               if($married['complete']==1)

                                                               {


$unick=getnick_uid($who);


$mnick=getnick_uid($married['frmuid']);


echo "<strong>$unick is Married To $mnick</strong><br/>";

                                                               }

                               }

  }
  $avlink = getavatar($who);
  if ($avlink=="")
  { 
  echo "<br/><img src=\"images/nopic.jpg\" alt=\"avatar\"/>";
  }else{
  echo "<br/><img src=\"$avlink\" alt=\"avatar\"/>";
  }
  echo "</small>";
  echo "</p>";
  echo "<p>";
  echo "<small>";
  echo "Member's ID: <b>$who</b><br/>";
  echo "Status: <b>".getstatus($who)."</b><br/>";
  $nopl = mysql_fetch_array(mysql_query("SELECT sex, birthday, location FROM ibwf_users WHERE id='".$who."'"));
  $uage = getage($nopl[1]);
  if($nopl[0]=='M')
  {
    $usex = "Male";
  }else if($nopl[0]=='F'){
    $usex = "Female";
  }else{
    $usex = "Shemale";
  }
  $nopl[2] = htmlspecialchars($nopl[2]);
  echo "A/S/L: <b>$uage/$usex/$nopl[2]</b><br/>";
  $unol = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE authorid='".$who."'"));
  $tlink = "<a href=\"lists.php?action=tbuid&amp;sid=$sid&amp;who=$who\">$unol[0]</a>";
  echo "Topics: <b>$tlink</b><br/>";
  $unop = mysql_fetch_array(mysql_query("SELECT posts FROM ibwf_users WHERE id='".$who."'"));
  $unol = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE uid='".$who."'"));
  $plink = "<a href=\"lists.php?action=uposts&amp;sid=$sid&amp;who=$who\">$unol[0]</a>";
  echo "Posts: <b>$plink/$unop[0]</b><br/>";
   $unpm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE touid='".$who."' AND unread>0"));
  $unread = mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT unread) FROM ibwf_private WHERE byuid='".$uid."' AND touid='".$who."'"));
  if($unpm[0]==0)
  {
  echo "Unread PM's: None<br/>";
  }else{
  echo "Unread PM's: $unpm[0], $unread[0] from u<br/>";
  }
  $nopl = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$who."'"));
  echo "Credits: <b>$nopl[0]</b><br/>";
  $nopl = mysql_fetch_array(mysql_query("SELECT chmsgs FROM ibwf_users WHERE id='".$who."'"));
  echo "Chat Posts: <b>$nopl[0]</b><br/>";
  $nopl = mysql_fetch_array(mysql_query("SELECT battlep FROM ibwf_users WHERE id='".$who."'"));
  echo "Battle Points: <b>$nopl[0]</b><br/>";
  $judg = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_judges WHERE uid='".$who."'"));
  if($judg[0]>0)
  {
    echo "<b>Battle Board Judge</b><br/>";
  }
  $nout = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_shouts WHERE shouter='".$who."'"));
  $nopl = mysql_fetch_array(mysql_query("SELECT shouts FROM ibwf_users WHERE id='".$who."'"));
  echo "Shouts: <b><a href=\"lists.php?action=shouts&amp;sid=$sid&amp;who=$who\">$nout[0]</a>/$nopl[0]</b><br/>";
  $nopl = mysql_fetch_array(mysql_query("SELECT regdate FROM ibwf_users WHERE id='".$who."'"));
  $jdt = date("d m y-H:i:s",$nopl[0]);
  echo "Joined M: <b>$jdt</b><br/>";
  $nopl = mysql_fetch_array(mysql_query("SELECT lastact FROM ibwf_users WHERE id='".$who."'"));
  $jdt = date("d m y-H:i:s",$nopl[0]);
  echo "Last Active: <b>$jdt</b><br/>";
  $nopl = mysql_fetch_array(mysql_query("SELECT lastvst FROM ibwf_users WHERE id='".$who."'"));
  $jdt = date("d m y-H:i:s",$nopl[0]);
  echo "Last Visit: <b>$jdt</b><br/>";
  
  $totaltimeonline = mysql_fetch_array(mysql_query("SELECT tottimeonl FROM ibwf_users WHERE id='".$who."'"));  
$num = $totaltimeonline[0]/86400;
$days = intval($num);
$num2 = ($num - $days)*24;
$hours = intval($num2);
$num3 = ($num2 - $hours)*60;
$mins = intval($num3);
$num4 = ($num3 - $mins)*60;
$secs = intval($num4);

echo "Time Online: ";
if(($days==0) and ($hours==0) and ($mins==0)){
  echo "<b>$secs</b> seconds<br/>";
}else
if(($days==0) and ($hours==0)){
  echo "<b>$mins</b> mins, ";
  echo "<b>$secs</b> seconds<br/>";
}else
if(($days==0)){
  echo "<b>$hours</b> hours, ";
  echo "<b>$mins</b> mins, ";
  echo "<b>$secs</b> seconds<br/>";
}else{
  echo "<b>$days</b> days, ";
  echo "<b>$hours</b> hours, ";
  echo "<b>$mins</b> mins, ";
  echo "<b>$secs</b> seconds<br/>";
}
  
  $nopl = mysql_fetch_array(mysql_query("SELECT browserm FROM ibwf_users WHERE id='".$who."'"));
  echo "Browser: <b>$nopl[0]</b><br/>";
  $nopl = mysql_fetch_array(mysql_query("SELECT email FROM ibwf_users WHERE id='".$who."'"));
  echo "E-mail: <b>$nopl[0]</b><br/>";
  $nopl = mysql_fetch_array(mysql_query("SELECT site FROM ibwf_users WHERE id='".$who."'"));
  $nopl[0] = strtolower($nopl[0]);
  echo "Phone No: <a href=\"wtai://wp/mc;$nopl[0]\">$nopl[0]</a><br/>";
  $nopl = mysql_fetch_array(mysql_query("SELECT signature FROM ibwf_users WHERE id='".$who."'"));
  $sign = parsepm($nopl[0], $sid);
  echo "Signature: $sign<br/>";
   $prof = mysql_fetch_array(mysql_query("SELECT views FROM ibwf_users WHERE id='".$who."'")); $vws = $prof[0]+1; mysql_query("UPDATE ibwf_users SET views='".$vws."'WHERE  id='".$who."'"); echo "No. of times profile viewed:<b> $prof[0]</b><br/>";
  if(ismod(getuid_sid($sid)))
   {
     $uipadd = mysql_fetch_array(mysql_query("SELECT ipadd FROM ibwf_users WHERE id='".$who."'"));
     echo "IP:<a href=\"lists.php?action=byip&amp;sid=$sid&amp;who=$who\">$uipadd[0]</a><br/>";
     $nob = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE (uid='".$who."' OR tid='".$who."') AND agreed='1'"));
	 echo "Buddies: $nob[0]<br/>";
   }
  echo "<br/><a href=\"uinfo.php?who=$who&amp;sid=$sid\">More Information</a><br/>";
  echo "<a href=\"users?$whonick\">$whonick's Personal Wap Site</a><br/>";
    echo "<a href=\"index.php?action=prop&amp;who=$who&amp;sid=$sid\">$whonick's Property!</a><br/>";
   echo "<a href=\"index.php?action=plusses&amp;who=$who&amp;sid=$sid\">Share Credits</a><br/><br/>";
  echo "</small>";
  echo "</p>";
   echo "<p align=\"center\">";
   $noi = mysql_fetch_array(mysql_query("SELECT pollid FROM ibwf_users WHERE id='".$who."'"));
   if($noi[0]>0)
   {
   echo "<a href=\"index.php?action=viewpl&amp;who=$who&amp;sid=$sid\">Poll</a><br/>";
 }
 $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubs WHERE owner='".$who."'"));
   if($noi[0]>0)
   {
   echo "<a href=\"lists.php?action=ucl&amp;who=$who&amp;sid=$sid\">Clubs($noi[0])</a><br/>";
 }
 $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE uid='".$who."'"));
   if($noi[0]>0)
   {
   echo "<a href=\"lists.php?action=clm&amp;who=$who&amp;sid=$sid\">Member In $noi[0] Clubs</a><br/>";
   }
   $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_blogs WHERE bowner='".$who."'"));
   if($noi[0]>0)
   {
   echo "<a href=\"lists.php?action=blogs&amp;who=$who&amp;sid=$sid\">Blogs($noi[0])</a><br/>";
 }
 $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_vault WHERE uid='".$who."'"));
   if($noi[0]>0)
   {
   echo "<a href=\"lists.php?action=vault&amp;who=$who&amp;sid=$sid\">Vault($noi[0])</a><br/>";
   }
   $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_gbook WHERE gbowner='".$who."'"));
   echo "<a href=\"lists.php?action=gbook&amp;who=$who&amp;sid=$sid\">Guestbook($noi[0])</a><br/>";
   $judg = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_judges WHERE uid='".getuid_sid($sid)."'"));
   if(ismod(getuid_sid($sid))||$judg[0]>0)
   {
    echo "<a href=\"index.php?action=batp&amp;who=$who&amp;sid=$sid\">Battle Points</a><br/>";
   }
   
   if(ismod(getuid_sid($sid)))
   {
     echo "<a href=\"mcppl.php?action=user&amp;who=$who&amp;sid=$sid&amp;who=$who\">Mod CP</a><br/>";
   }
   }else{
     echo "<img src=\"images/notok.gif\" alt=\"X\"/> Member dos not exist<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 "<br/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
  echo xhtmlfoot();

}



else if($action=="prop")
{
 $whonick = getnick_uid($who);
  addonline(getuid_sid($sid),"$whonick's Property","");

$pstyle = gettheme($sid);
    echo xhtmlhead("user Property",$pstyle);
  echo "<p align=\"center\">";
  
  $nick = getnick_sid($sid);
  $whonick = getnick_uid($who);
  
  echo "<i><b><u><small>$whonick's Property:</small></u></b></i><br/>";

  echo "</p>";
  echo "<p>";
  
     $sql = "SELECT itemid FROM ibwf_shop_Inventory WHERE uid='".$who."'";

    $items = mysql_query($sql);
    echo mysql_error();
    if(mysql_num_rows($items)>0)
    {
    while ($item = mysql_fetch_array($items))
    {
    $shopitem = mysql_fetch_array(mysql_query("SELECT itemid, itemname, itemshopid FROM ibwf_shop WHERE itemid='".$item[0]."'"));
	
    echo "$shopitem[1], ";
    if($shopitem[2]=='1'){
    
    }
   
   
  }
 }
    
    
    echo "</p>";
  ////// UNTILL HERE >> 
  echo "<p align=\"center\">";
  echo "<br/><a href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$who\">";
$whonick = getnick_uid($who);
echo "Back to $whonick's Profile</a><br/>";
  echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Home</a>";
  echo "</p>";
    echo xhtmlfoot();
  }
////////////////////////////////////////// uxset
else if($action=="uxset")
{
    addonline(getuid_sid($sid),"Extended Settings - xHTML","");
$pstyle = gettheme($sid);
    echo xhtmlhead("Extended Settings",$pstyle);
    echo "<p>";
    echo "<a href=\"index.php?action=uadd&amp;sid=$sid\">&#187;My Address</a><br/>";
    echo "<a href=\"index.php?action=uper&amp;sid=$sid\">&#187;Personality</a><br/>";
    //echo "<a href=\"index.php?action=gmset&amp;sid=$sid\">&#187;Gmail Settings</a><br/>";
    echo "<a href=\"index.php?action=umin&amp;sid=$sid\">&#187;More about me</a><br/>";
    echo "<a href=\"index.php?action=upre&amp;sid=$sid\">&#187;Preferences</a><br/>";
    
    
    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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo xhtmlfoot();
}

//////////////////////////////////////////User Address

else if($action=="uadd")
{
    addonline(getuid_sid($sid),"My Address - xHTML","");
$pstyle = gettheme($sid);
    echo xhtmlhead("My Address",$pstyle);
    echo "<onevent type=\"onenterforward\">";
    $ainfo = mysql_fetch_array(mysql_query("SELECT country, city, street, phoneno, timezone FROM ibwf_xinfo WHERE uid='".getuid_sid($sid)."'"));
    echo "<refresh>
        <setvar name=\"ucon\" value=\"$ainfo[0]\"/>
        <setvar name=\"ucit\" value=\"$ainfo[1]\"/>
        <setvar name=\"ustr\" value=\"$ainfo[2]\"/>
        <setvar name=\"utzn\" value=\"$ainfo[4]\"/>
        <setvar name=\"uphn\" value=\"$ainfo[3]\"/>";
    echo "</refresh></onevent>";
    echo "<p>";
    echo "<small><img src=\"images/point.gif\" alt=\"!\"/>Go to Preferences and choose buddies only if you want only your buddies to see your street and phone number<br/>";
    echo "<img src=\"images/point.gif\" alt=\"!\"/>If you don't anyone to see these information just don't type them<br/>";
    echo "<img src=\"images/point.gif\" alt=\"!\"/>Timezone is required to get your e-mails from G-Mail account in your local time.<br/>";
    echo "<img src=\"images/point.gif\" alt=\"!\"/>Example on timezone is 2 for +2 hours on GMT, or -2.5 for -2:30 on GMT<br/>";
    echo "<img src=\"images/point.gif\" alt=\"!\"/>These info. will help you to meet friends and dates from where do you live<br/><br/></small>";
    
    echo "<form method=\"post\" action=\"genproc.php?action=uadd&amp;sid=$sid\">";
    echo "Contry: <input name=\"ucon\" maxlength=\"50\" value=\"$ainfo[0]\"/><br/>";
    echo "City: <input name=\"ucit\" maxlength=\"50\" value=\"$ainfo[1]\"/><br/>";
    echo "Street: <input name=\"ustr\" maxlength=\"50\" value=\"$ainfo[2]\"/><br/>";
    echo "Timezone<small>(e.g +2 or -2.5)</small>: <input name=\"utzn\" size=\"5\" value=\"$ainfo[4]\" maxlength=\"5\"/><br/>";
    echo "Phone No.: <input name=\"uphn\" maxlength=\"20\" value=\"$ainfo[3]\"/><br/>";
    echo "<input type=\"submit\" name=\"Submit\" value=\"Submit\"/><br/>";
    echo "</form>";
    
    echo "</p>";
    echo "<p align=\"center\">";
    echo "<a href=\"index.php?action=uxset&amp;sid=$sid\">";
echo "Extended Settings</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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo xhtmlfoot();
}


//////////////////////////////////////////User Preferences

else if($action=="upre")
{
    addonline(getuid_sid($sid),"Preferences - xHTML","");
$pstyle = gettheme($sid);
    echo xhtmlhead("Preferences",$pstyle);
    echo "<onevent type=\"onenterforward\">";
    $ainfo = mysql_fetch_array(mysql_query("SELECT sitedscr, budsonly, sexpre FROM ibwf_xinfo WHERE uid='".getuid_sid($sid)."'"));
    echo "<refresh>
        <setvar name=\"usds\" value=\"$ainfo[0]\"/>
        <setvar name=\"ubon\" value=\"$ainfo[1]\"/>
        <setvar name=\"usxp\" value=\"$ainfo[2]\"/>";
    echo "</refresh></onevent>";
    echo "<p>";
    echo "<small><img src=\"images/point.gif\" alt=\"!\"/>Your site already set in your normal settings<br/>";
    echo "<img src=\"images/point.gif\" alt=\"!\"/>Set buddies only to yes, so only your buddies can see your phone number, street, and real name<br/>";
    echo "<img src=\"images/point.gif\" alt=\"!\"/>Sex preference will help the correct people to find you<br/><br/></small>";
    
     if($theme[0]=="1"){
    echo "<option value=\"1\" selected=\"1\">Arawap Default</option>";
    }else{
    echo "<option value=\"1\">White (Default)</option>";
    }
    
    echo "<form method=\"post\" action=\"genproc.php?action=upre&amp;sid=$sid\">";
    echo "Site description: <input name=\"usds\" maxlength=\"200\" value=\"$ainfo[0]\"/><br/>";
    echo "Buddies Only:";
    echo "<select name=\"ubon\" value=\"$ainfo[1]\">";
    if($ainfo[1]=="1"){
    echo "<option value=\"1\" selected=\"1\">Yes</option>";
    }else{
    echo "<option value=\"1\">Yes</option>";
    }
    if($ainfo[1]=="0"){
    echo "<option value=\"0\" selected=\"0\">No</option>";
    }else{
    echo "<option value=\"0\">No</option>";
    }
    echo "</select>";
    echo "<br/>Sex Preference:";
    echo "<select name=\"usxp\" value=\"$ainfo[2]\">";
    if($ainfo[2]=="F"){
    echo "<option value=\"F\" selected=\"F\">Females</option>";
    }else{
    echo "<option value=\"F\">Females</option>";
    }
    if($ainfo[2]=="M"){
    echo "<option value=\"M\" selected=\"M\">Males</option>";
    }else{
    echo "<option value=\"M\">Males</option>";
    }
    if($ainfo[2]=="B"){
    echo "<option value=\"B\" selected=\"B\">Both</option>";
    }else{
    echo "<option value=\"B\">Both</option>";
    }
    echo "</select>";
    echo "<br/><input type=\"submit\" name=\"Submit\" value=\"Submit\"/><br/>";
    echo "</form>";
   
    echo "</p>";
    echo "<p align=\"center\">";
    echo "<a href=\"index.php?action=uxset&amp;sid=$sid\">";
echo "Extended Settings</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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo xhtmlfoot();
}

//////////////////////////////////////////User Personaliy

else if($action=="uper")
{
    addonline(getuid_sid($sid),"Personality - xHTML","");
$pstyle = gettheme($sid);
    echo xhtmlhead("Personality",$pstyle);
    echo "<onevent type=\"onenterforward\">";
    $ainfo = mysql_fetch_array(mysql_query("SELECT height, weight, realname, racerel, eyescolor, profession, hairtype FROM ibwf_xinfo WHERE uid='".getuid_sid($sid)."'"));
    echo "<refresh>
        <setvar name=\"uhig\" value=\"$ainfo[0]\"/>
        <setvar name=\"uwgt\" value=\"$ainfo[1]\"/>
        <setvar name=\"urln\" value=\"$ainfo[2]\"/>
        <setvar name=\"ueor\" value=\"$ainfo[3]\"/>
        <setvar name=\"ueys\" value=\"$ainfo[4]\"/>
        <setvar name=\"uher\" value=\"$ainfo[6]\"/>
        <setvar name=\"upro\" value=\"$ainfo[5]\"/>";
    echo "</refresh></onevent>";
    echo "<p>";
    
    echo "<form method=\"post\" action=\"genproc.php?action=uper&amp;sid=$sid\">";
    echo "Height: <input name=\"uhig\" maxlength=\"10\" value=\"$ainfo[0]\"/><br/>";
    echo "Weight: <input name=\"uwgt\" maxlength=\"10\" value=\"$ainfo[1]\"/><br/>";
    echo "Real Name: <input name=\"urln\" maxlength=\"100\" value=\"$ainfo[2]\"/><br/>";
    echo "Ethnic Origin: <input name=\"ueor\" maxlength=\"100\" value=\"$ainfo[3]\"/><br/>";
    echo "Eyes: <input name=\"ueys\" maxlength=\"10\" value=\"$ainfo[4]\"/><br/>";
    echo "Hair: <input name=\"uher\" maxlength=\"50\" value=\"$ainfo[6]\"/><br/>";
    echo "Profession: <input name=\"upro\" maxlength=\"100\" value=\"$ainfo[5]\"/><br/>";
    echo "<input type=\"submit\" name=\"Submit\" value=\"Submit\"/><br/>";
    echo "</form>";
    
    echo "</p>";
    echo "<p align=\"center\">";
    echo "<a href=\"index.php?action=uxset&amp;sid=$sid\">";
echo "Extended Settings</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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo xhtmlfoot();
}

//////////////////////////////////////////User Personaliy

else if($action=="umin")
{
    addonline(getuid_sid($sid),"More About Me - xHTML","");
$pstyle = gettheme($sid);
    echo xhtmlhead("More About Me",$pstyle);
    echo "<onevent type=\"onenterforward\">";
    $ainfo = mysql_fetch_array(mysql_query("SELECT likes, deslikes, habitsb, habitsg, favsport, favmusic, moretext FROM ibwf_xinfo WHERE uid='".getuid_sid($sid)."'"));
    echo "<refresh>
        <setvar name=\"ulik\" value=\"$ainfo[0]\"/>
        <setvar name=\"udlk\" value=\"$ainfo[1]\"/>
        <setvar name=\"ubht\" value=\"$ainfo[2]\"/>
        <setvar name=\"ught\" value=\"$ainfo[3]\"/>
        <setvar name=\"ufsp\" value=\"$ainfo[4]\"/>
        <setvar name=\"ufmc\" value=\"$ainfo[5]\"/>
        <setvar name=\"umtx\" value=\"$ainfo[6]\"/>";
    echo "</refresh></onevent>";
    echo "<p>";
    
    echo "<form method=\"post\" action=\"genproc.php?action=umin&amp;sid=$sid\">";
    echo "Likes: <input name=\"ulik\" maxlength=\"250\" value=\"$ainfo[0]\"/><br/>";
    echo "Dislikes: <input name=\"udlk\" maxlength=\"250\" value=\"$ainfo[1]\"/><br/>";
    echo "Bad Habbits: <input name=\"ubht\" maxlength=\"250\" value=\"$ainfo[2]\"/><br/>";
    echo "Good Habbits: <input name=\"ught\" maxlength=\"250\" value=\"$ainfo[3]\"/><br/>";
    echo "Favorite Sports: <input name=\"ufsp\" maxlength=\"100\" value=\"$ainfo[4]\"/><br/>";
    echo "Favorite Music: <input name=\"ufmc\" maxlength=\"100\" value=\"$ainfo[5]\"/><br/>";
    echo "More Text: <input name=\"umtx\" maxlength=\"500\" value=\"$ainfo[6]\"/><br/>";
    echo "<input type=\"submit\" name=\"Submit\" value=\"Submit\"/><br/>";
    echo "</form>";
    
    echo "</p>";
    echo "<p align=\"center\">";
    echo "<a href=\"index.php?action=uxset&amp;sid=$sid\">";
echo "Extended Settings</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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo xhtmlfoot();
}

//////////////////////////////////////////G-Mail Settings

else if($action=="gmset")
{
    addonline(getuid_sid($sid),"GMail Settings - xHTML","");
$pstyle = gettheme($sid);
    echo xhtmlhead("GMail Settings",$pstyle);
    echo "<onevent type=\"onenterforward\">";
    $ainfo = mysql_fetch_array(mysql_query("SELECT gmailun, gmailpw, gmailchk FROM ibwf_xinfo WHERE uid='".getuid_sid($sid)."'"));
    echo "<refresh>
        <setvar name=\"ugun\" value=\"$ainfo[0]\"/>
        <setvar name=\"ugpw\" value=\"$ainfo[1]\"/>
        <setvar name=\"ugch\" value=\"$ainfo[2]\"/>";
    echo "</refresh></onevent>";
    echo "<p>";
    echo "<small><img src=\"images/point.gif\" alt=\"!\"/>Set these values only if you want to be auto-logged in your gmail account<br/>";
    echo "<img src=\"images/point.gif\" alt=\"!\"/>Put in the checking field the time you want arawap to check your g-mail account<br/>";
    echo "<img src=\"images/point.gif\" alt=\"!\"/>Putting less than 20 minutes could slow your navigation throw arawap, suggested period is 30 minutes<br/>";
    echo "<img src=\"images/point.gif\" alt=\"!\"/>Valid values 0 - 99 minutes, 0 will check your e-mail with every action you make in arawap<br/><br/></small>";
    echo '
    G-Mail Username: <input name="ugun" maxlength="100"/><br/>
    G-Mail Password: <input name="ugpw" maxlength="200"/><br/>
    G-Mail Checking: <input name="ugch" format="*N" size="2" maxlength="2"/><br/>
    ';
    echo "<anchor>Submit";
    echo "<go href=\"genproc.php?action=gmset&amp;sid=$sid\" method=\"post\">";
    echo "<postfield name=\"ugun\" value=\"$(ugun)\"/>";
    echo "<postfield name=\"ugpw\" value=\"$(ugpw)\"/>";
    echo "<postfield name=\"ugch\" value=\"$(ugch)\"/>";
    echo "</go></anchor>";
    echo "</p>";
    echo "<p align=\"center\">";
    echo "<a href=\"index.php?action=uxset&amp;sid=$sid\">";
echo "Extended Settings</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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo xhtmlfoot();
}


else if($action=="chpreqref")

{

               $id=$_GET["id"];



   addonline(getuid_sid($sid),"WAP - Chapel","index.php?action=$action");

  $pstyle = gettheme($sid);
      echo xhtmlheadchat("Ara-Chapel",$pstyle);

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

               echo "<u><b>AraWap Chapel</b></u>";

               echo "</p>";

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

               $dbinfo=mysql_fetch_array(mysql_query("SELECT * FROM
ibwf_married WHERE id='".$id."'"));

               $frmnick=getnick_uid($dbinfo["frmuid"]);

               echo "Aww, We are sorry to hear about You Decision, your
proposer has been informed of your decison, thank you";

               $dbinfo2=mysql_query("DELETE FROM ibwf_married WHERE
id='".$id."'");

               $tonick=getnick_uid($dbinfo["touid"]);



               $byuid = getuid_sid($sid);

               $person = getnick_sid($sid);

               $who=$dbinfo["frmuid"];

               $pmtext="Sorry, $tonick has refused your proposal. we are
sorry to hear this, but feel free to try again at a later date";



               $tm = time();

               $res = mysql_query("INSERT INTO ibwf_private SET
text='".$pmtext."', byuid='".$byuid."', touid='".$who."',
timesent='".$tm."'");



               echo "</p>";

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

   echo "<small>Please Note: This Marriage IS NOT Legally
Binding</small><br/>";

               echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img
src=\"images/home.gif\" alt=\"*\"/>";

   echo "Home</a>";

               echo "</p>";

               // DO NOT REMOVE THE LINE BELOW - DJSteve

              
			      echo "<p align=\"center\">";
			   
		  echo "Copyrights: @Djsteve ";
echo "</p>";

 echo xhtmlfoot();

}

else if($action=="chpreqacc")

{

               $id=$_GET["id"];



   addonline(getuid_sid($sid),"WAP - Chapel","index.php?action=$action");

$pstyle = gettheme($sid);
      echo xhtmlheadchat("Ara-Chapel",$pstyle);

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

               echo "<u><b>AraWap Chapel</b></u>";

               echo "</p>";

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

               $dbinfo=mysql_fetch_array(mysql_query("SELECT * FROM
ibwf_married WHERE id='".$id."'"));

               $frmnick=getnick_uid($dbinfo["frmuid"]);

               echo "Congratulations!. Your Marriage To $frmnick Is
Complete. We Hope You Are Both Happy in your new Relationship";

               $dbinfo2=mysql_query("UPDATE ibwf_married SET agreed='1',
complete='1' WHERE id='".$id."'");

               $tonick=getnick_uid($dbinfo["touid"]);



               $byuid = getuid_sid($sid);

               $person = getnick_sid($sid);

               $who=$dbinfo["frmuid"];

               $pmtext="cheers2.  Congratulations!. Your Marriage To $tonick Is
Complete. We Hope You Are Both Happy in your new Relationship";



               $tm = time();

               $res = mysql_query("INSERT INTO ibwf_private SET
text='".$pmtext."', byuid='".$byuid."', touid='".$who."',
timesent='".$tm."'");



               echo "</p>";

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

   echo "<small>Please Note: This Marriage IS NOT Legally
Binding</small><br/>";

               echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img
src=\"images/home.gif\" alt=\"*\"/>";

   echo "Home</a>";

               echo "</p>";

               // DO NOT REMOVE THE LINE BELOW - DJSteve

          echo "<p align=\"center\">";
			   
	 echo "Copyrights:@Djsteve ";
echo "</p>";


 echo xhtmlfoot();

}

else if($action=="chapel")

{

   addonline(getuid_sid($sid),"WAP - Chapel","index.php?action=$action");

$pstyle = gettheme($sid);
      echo xhtmlheadchat("Ara-Chapel",$pstyle);

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

               echo "<u><b>AraWap Chapel</b></u><br/>";
echo "<img src=\"smilies/pop.gif\"
alt=\"*\"/>";
               echo "</p>";

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

               echo "Welcome To AraWaps Online Chapel. <br/>Here You Can
Get Married Online In Front Of Our Resident vicar PlasmA";

               echo "</p>";

               $uid=getuid_sid($sid);

               $chkcode=mysql_fetch_array(mysql_query("SELECT id FROM
ibwf_married WHERE touid='".$uid."'"));

               if($chkcode[0]>0)

                               {


$marriedinfo=mysql_fetch_array(mysql_query("SELECT * FROM ibwf_married WHERE
touid='".$uid."'"));

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


$tonick=getnick_uid($marriedinfo['touid']);


$frmnick=getnick_uid($marriedinfo['frmuid']);


$mf=mysql_fetch_array(mysql_query("SELECT sex FROM ibwf_users WHERE
id='".$marriedinfo['frmnick']."'"));

                                               if($mf[0]=="M")

                                               {

                                                               $sex=="Him";


$husb=="Husband";

                                                               }else{

                                                               $sex=="Her";


$husb=="Wife";

                                               }

                                               $i=$marriedinfo["ID"];

                                               echo "<strong>Marriage
Between $tonick and $frmnick</strong><br/><br/>";

                                               echo "Your Only one step
away from Marrying your true love. all you need to do is read and accept the
vows below<br/><br/>";

                                               echo "$tonick, do you take
$frmnick to be your wedded $husb to live together in marriage. Do you
promise to love, comfort, honor and keep $sex<br/>";

                                               echo "For better or worse,
for richer or poorer, in sickness and in health. And forsaking all others,
be faithful only to<br/>";

                                               echo "$sex so long as you
both shall live?<br/><br/>";

                                               echo "<a
href=\"index.php?action=chpreqacc&amp;sid=$sid&amp;id=$i\">I Do</a><br/>";

                                               echo "<a
href=\"index.php?action=chpreqref&amp;sid=$sid&amp;id=$i\">Sorry, I
Dont</a><br/>";

                                               echo "</p>";

                               }else{

                                               $nick=getnick_sid($sid);

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

                                               echo "To Begin Please Enter
The Nickname Of The User You Want to Marry, A PM will be sent<br/>";

                                               echo "To them asking if they
wish to marry you and inviting them to the chapel to complete the
service.<br/>";

                                               echo "By Sending the message
below you agree to the below vows also";

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

                                               echo "$nick, do you take
[user] to be your wedded [wife/husband] to live together in marriage. Do you
promise to love, comfort, honor and keep [him/her]<br/>";

                                               echo "For better or worse,
for richer or poorer, in sickness and in health. And forsaking all others,
be faithful only to<br/>";

                                               echo "[him/her] so long as
you both shall live?<br/><br/>";

                                               echo "Username:<br/>";
echo "<form action=\"index.php?action=chpsndreq&amp;sid=$sid\" method=\"post\">";
                                               echo "<input name=\"marusr\"
maxlength=\"25\"/><br/>";

                                               

                                             echo "<input type=\"submit\" value=\"I Do\"/>";  
echo "</form>";

                                               echo "</p>";

                               }

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

               echo "<small>Please Note: This Marriage IS NOT Legally
Binding</small><br/>";

                   echo "<a
href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\"
alt=\"*\"/>";

       echo "Home</a>";

                               echo "</p>";

               // DO NOT REMOVE THE LINE BELOW - DJSteve

             
			   
		   echo "<p align=\"center\">";
			   
		 echo "Copyrights: @Djsteve ";
		 echo "</p>";



 echo xhtmlfoot();

}

else if($action=="chpsndreq")

{

   addonline(getuid_sid($sid),"WAP - Chapel","index.php?action=$action");

$pstyle = gettheme($sid);
      echo xhtmlheadchat("Ara-Chapel",$pstyle);

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

               echo "<u><b>AraWap Chapel</b></u>";

               echo "</p>";

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

               echo "Welcome To AraWaps Online Chapel. <br/>Here You Can
Get Married Online In Front Of Our Resident vicar";

               echo "</p>";

               $marusr = $_POST["marusr"];

               $who = getuid_nick($marusr);

               $whonick = getnick_uid($who);

               if($who=="")

               {

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

               echo "Sorry this user does not exist, Please Try Again";

   echo "<br/><br/><a href=\"index.php?action=main&amp;sid=$sid\"><img
src=\"images/home.gif\" alt=\"*\"/>";

               echo "Home</a>";

               echo "</p>";

               // DO NOT REMOVE THE LINE BELOW - DJSteve

   echo "<p align=\"center\">";
			   
		 echo "Copyrights: @Djsteve ";
		 echo "</p>";



              echo xhtmlfoot();

               exit;

               }



                  $byuid = getuid_sid($sid);

                  $person = getnick_sid($sid);

  $sql=mysql_query("INSERT INTO ibwf_married SET frmuid='".$byuid."',
touid='".$who."'");

  $sql2=mysql_fetch_array(mysql_query("SELECT id FROM ibwf_married WHERE
frmuid='".$byuid."' AND touid='".$who."'"));

  $pmtext="firstmove. $person would like to To ask For your hand in marriage, to
accept or refuse visit the chapel link in the site extras page";



  $tm = time();

               $res = mysql_query("INSERT INTO ibwf_private SET
text='".$pmtext."', byuid='".$byuid."', touid='".$who."',
timesent='".$tm."'");

 if($res)

 {

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

   echo "<img src=\"images/ok.gif\" alt=\"O\"/>";

   echo "Marriage Request was sent successfully to $whonick<br/> please
wait for a response</p>";

 }else{

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

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

   echo "Can't Send Request to $whonick</p>";

 }

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

   echo "<small>Please Note: This Marriage IS NOT Legally
Binding</small><br/>";

               echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img
src=\"images/home.gif\" alt=\"*\"/>";

   echo "Home</a>";

               echo "</p>";

               // DO NOT REMOVE THE LINE BELOW - DJSteve

              echo "<p align=\"center\">";
		 echo "Copyrights:@Djsteve ";
		 echo "</p>";



 echo xhtmlfoot();

}


//////////////////////////////////////////Give credits

else if($action=="plusses")
{
  $who = $_GET["who"];
  addonline(getuid_sid($sid),"Sharing credits","");
$pstyle = gettheme($sid);
      echo xhtmlheadchat("Arawap",$pstyle);   
   echo "<p align=\"center\">";
  echo "<b>Give Credits To ".getnick_uid($who)."</b><br/><br/>";
  $gps = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users
WHERE id='".getuid_sid($sid)."'"));
  echo "You have $gps[0] Credits<br/><br/>";
  echo "Credits to give<br/>";
echo "<form action=\"genproc.php?action=plusses&amp;sid=$sid&amp;who=$who\" method=\"post\">";
  echo "<input name=\"ptg\" format=\"*N\" maxlength=\"3\"/>";
echo "<input type=\"submit\" value=\"Give\"/>";  
echo "</form>";
  echo "<br/><br/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo xhtmlfoot();
}


//////////////////////////////////////////Give Game Plusses

else if($action=="givegp")
{
  $who = $_GET["who"];
  addonline(getuid_sid($sid),"Giving Game Plusses","");
$pstyle = gettheme($sid);
      echo xhtmlheadchat("Arawap",$pstyle);   
   echo "<p align=\"center\">";
  echo "<b>Give GPs To ".getnick_uid($who)."</b><br/><br/>";
  $gps = mysql_fetch_array(mysql_query("SELECT gplus FROM ibwf_users WHERE id='".getuid_sid($sid)."'"));
  echo "You have $gps[0] GP's<br/><br/>";
  echo "GP's to give<br/>";
echo "<form action=\"genproc.php?action=givegp&amp;sid=$sid&amp;who=$who\" method=\"post\">";
  echo "<input name=\"ptg\" format=\"*N\" maxlength=\"2\"/>";
echo "<input type=\"submit\" value=\"Give\"/>";  
echo "</form>";
  echo "<br/><br/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo xhtmlfoot();
}

//////////////////////////////////////////Give Battle points

else if($action=="batp")
{
  $who = $_GET["who"];
  addonline(getuid_sid($sid),"Giving Battle Points - xHTML","");
    $pstyle = gettheme($sid);
    echo xhtmlhead("Give BP",$pstyle);
    echo "<onevent type=\"onenterforward\">";
    echo "<refresh>
        <setvar name=\"tfbp\" value=\"0\"/>";
    echo "</refresh></onevent>";
  echo "<p align=\"center\">";
  $judg = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_judges WHERE uid='".getuid_sid($sid)."'"));
  if(ismod(getuid_sid($sid))||$judg[0]>0)
  {


  echo "<b>Give/Take BPs To ".getnick_uid($who)."</b><br/><br/>";
  echo "<input name=\"tfbp\" format=\"*N\" maxlength=\"2\"/>";
  echo "<br/><anchor>Add";
  echo "<go href=\"genproc.php?action=batp&amp;sid=$sid&amp;who=$who\" method=\"post\">";
  echo "<postfield name=\"ptbp\" value=\"$(tfbp)\"/>";
  echo "<postfield name=\"giv\" value=\"1\"/>";
  echo "</go></anchor><br/>";
  echo "<anchor>Remove";
  echo "<go href=\"genproc.php?action=batp&amp;sid=$sid&amp;who=$who\" method=\"post\">";
  echo "<postfield name=\"ptbp\" value=\"$(tfbp)\"/>";
  echo "<postfield name=\"giv\" value=\"0\"/>";
  echo "</go></anchor><br/><br/>";
  }else{
    echo "You Can't Do This";
  }
    $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 "<br/><br/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
  echo xhtmlfoot();
}

//////////////////////////////////////////Post Options

else if($action=="pstopt")
{
  $pid = $_GET["pid"];
  $page = $_GET["page"];
  $fid = $_GET["fid"];
    addonline(getuid_sid($sid),"Post Options - xHTML","");
    $pinfo= mysql_fetch_array(mysql_query("SELECT uid,tid, text  FROM ibwf_posts WHERE id='".$pid."'"));
    $trid = $pinfo[0];
    $tid = $pinfo[1];
    $ptext = htmlspecialchars($pinfo[2]);
    $pstyle = gettheme($sid);
    echo xhtmlhead("Post Options",$pstyle);
    echo "<onevent type=\"onenterforward\">";
    echo "<refresh>
        <setvar name=\"ptext\" value=\"$ptext\"/>";
    echo "</refresh></onevent>";
  echo "<p align=\"center\">";
  echo "<b>Post Options</b>";
  
  echo "</p>";
  echo "<p>";
  $trnick = getnick_uid($trid);
  echo ";<a href=\"inbox.php?action=sendpm&amp;sid=$sid&amp;who=$trid\">&#187;Send PM to $trnick</a><br/>";
  echo "<a href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$trid\">&#187;View $trnick's Profile</a><br/>";
  //echo "<a href=\"index.php?action=post&amp;sid=$sid&amp;tid=$tid&amp;qut=$pid\">&#187;Quote</a><br/>";
  echo "<a href=\"genproc.php?action=rpost&amp;sid=$sid&amp;pid=$pid\">&#187;Report</a><br/>";
  echo "<a href=\"index.php?action=viewtpc&amp;sid=$sid&amp;tid=$tid&amp;page=$page\">&#171;Back to topic</a><br/><br/>";
  if(ismod(getuid_sid($sid)))
  {
    
     echo "<form method=\"post\" action=\"mprocpl.php?action=edtpst&amp;sid=$sid&amp;pid=$pid\">"; 
     echo "Text: <input name=\"ptext\" value=\"$ptext\" maxlength=\"500\"/> ";
     echo "<input type=\"submit\" name=\"Submit\" value=\"Edit\"/><br/>";
     echo "</form>"; 
     
echo "<br/><a href=\"mprocpl.php?action=delp&amp;sid=$sid&amp;pid=$pid\">&#187;DELETE</a><br/>";
  }
  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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
  echo xhtmlfoot();
}

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&amp;sid=$sid&amp;who=$trid\">&#187;Send PM to $trnick</a><br/>";
  echo "<a href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$trid\">&#187;View $trnick's Profile</a><br/>";
  //echo "<a href=\"index.php?action=post&amp;sid=$sid&amp;tid=$tid&amp;qut=$pid\">&#187;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&amp;sid=$sid&amp;tid=$tid\">&#187;Add Poll</a><br/>";
}
}else{
  if(ismod($uid))
  {
    echo "<a href=\"genproc.php?action=dltpl&amp;sid=$sid&amp;tid=$tid\">&#187;Delete Poll</a><br/>";
    }
}
  echo "<a href=\"genproc.php?action=rtpc&amp;sid=$sid&amp;tid=$tid\">&#187;Report</a><br/>";
  echo "<a href=\"index.php?action=viewtpc&amp;sid=$sid&amp;tid=$tid&amp;page=1\">&#171;Back to topic</a><br/>";
  if(ismod(getuid_sid($sid)))
  {
    echo "<form method=\"post\" action=\"mprocpl.php?action=rentpc&amp;sid=$sid&amp;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&amp;sid=$sid&amp;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&amp;sid=$sid&amp;tid=$tid\">&#187;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&amp;sid=$sid&amp;tid=$tid&amp;tdo=$cact\">&#187;$ctxt</a><br/>";
    if($tinfo[4]=='1')
    {
      $ptxt = "Unpin";
      $pact = "0";
    }else{
        $ptxt = "Pin";
      $pact = "1";
    }
  echo "<a href=\"mprocpl.php?action=pint&amp;sid=$sid&amp;tid=$tid&amp;tdo=$pact\">&#187;$ptxt</a><br/>";
  //echo "<a href=\"index.php?action=post&amp;sid=$sid&amp;tid=$tid&amp;qut=$pid\">&#187;Quote</a><br/>";
  echo "<br/>Move to:<br/>";
  echo "<form method=\"post\" action=\"mprocpl.php?action=mvt&amp;sid=$sid&amp;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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
  echo xhtmlfoot();
}
else if ($action=="chat")           {
        addonline(getuid_sid($sid),"Chat Menu - xHTML","index.php?action=$action");
        $pstyle = gettheme($sid);
    echo xhtmlhead("Chat Menu",$pstyle);
        echo "<p align=\"center\">";
        echo "<img src=\"images/chat.gif\" alt=\"*\"/><br/>";
        
        echo "<br/>";
        

        	$unreadinbox=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE unread='1' AND touid='".getuid_sid($sid)."'"));
        $pmtotl=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE touid='".getuid_sid($sid)."'"));
        $unrd="(".$unreadinbox[0]."/".$pmtotl[0].")";
        echo "<a href=\"inbox.php?action=main&amp;sid=$sid&amp;page=1\">Inbox$unrd</a><br/><br/> ";
        echo "<a href=\"index.php?action=uchat&amp;sid=$sid\">Users Rooms</a><br/><br/>";
        $rooms = mysql_query("SELECT id, name, perms, mage, chposts FROM ibwf_rooms WHERE static='1' AND clubid='0'");
        while ($room= mysql_fetch_array($rooms))
        {
          
          if(canenter($room[0], $sid))
          {
            $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline WHERE rid='".$room[0]."'"));
            echo "<a href=\"chat.php?sid=$sid&amp;rid=$room[0]\">$room[1]($noi[0])</a><br/>";
          }
          
        }
        	

        echo "<br/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>Home</a><br/>";
        echo "</p>";
        echo xhtmlfoot();
                                           }
else if ($action=="uchat")           {
addonline(getuid_sid($sid),"Chat Menu - xHTML","");
$pstyle = gettheme($sid);
    echo xhtmlhead("Chat Menu",$pstyle);
        echo "<p align=\"center\">";
        echo "<img src=\"images/chat.gif\" alt=\"*\"/><br/>";

        echo "<br/>";


        	$unreadinbox=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE unread='1' AND touid='".getuid_sid($sid)."'"));
        $pmtotl=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE touid='".getuid_sid($sid)."'"));
        $unrd="(".$unreadinbox[0]."/".$pmtotl[0].")";
        echo "<a href=\"inbox.php?action=main&amp;sid=$sid&amp;page=1\">Inbox$unrd</a><br/><br/> ";
        echo "<a href=\"index.php?action=chat&amp;sid=$sid\">Public Rooms</a><br/>";
        echo "<a href=\"index.php?action=mkroom&amp;sid=$sid\">Create Room</a><br/><br/>";
        $rooms = mysql_query("SELECT id, name, pass FROM ibwf_rooms WHERE static='0'");
        $co=0;
        while ($room= mysql_fetch_array($rooms))
        {
            $co++;
          if(canenter($room[0], $sid))
          {
            $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline WHERE rid='".$room[0]."'"));
            if($room[2]=="")
            {
            echo "<a href=\"chat.php?sid=$sid&amp;rid=$room[0]\">".htmlspecialchars($room[1])."($noi[0])</a><br/>";
            }else{
              echo "<br/><input format=\"*x\" name=\"rpw$co\" maxlength=\"10\"/><br/>";
              echo "<anchor>";
              echo htmlspecialchars($room[1]);
              echo "($noi[0])";
              echo "<go href=\"chat.php\" method=\"get\">";
              echo "<postfield name=\"rid\" value=\"$room[0]\"/>";
              echo "<postfield name=\"sid\" value=\"$sid\"/>";
              echo "<postfield name=\"rpw\" value=\"$(rpw$co)\"/>";
              echo "</go></anchor><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 "<br/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
        echo "</p>";
        echo xhtmlfoot();
                                           }
else if($action=="mkroom")
{
    addonline(getuid_sid($sid),"Creating Chatroom - xHTML","");
$pstyle = gettheme($sid);
    echo xhtmlhead("Creating Room",$pstyle);
        echo "<p>";
        echo "<small><img src=\"images/point.gif\" alt=\"!\"/>Leave password empty if you dont want to lock the room</small><br/>";
        echo "<small><img src=\"images/point.gif\" alt=\"!\"/>Don't make the password too personal, it's visible in the database</small><br/><br/>";
        echo "Room Name: <input name=\"rname\" maxlength=\"30\"/><br/>";
        echo "Password: <input name=\"rpass\" format=\"*x\" maxlength=\"10\"/><br/>";
        echo "<anchor>Create";
        echo "<go href=\"genproc.php?action=mkroom&amp;sid=$sid\" method=\"post\">";
        echo "<postfield name=\"rname\" value=\"$(rname)\"/>";
        echo "<postfield name=\"rpass\" value=\"$(rpass)\"/>";
        echo "</go></anchor>";
        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=chat&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/chat.gif\" alt=\"*\"/>Chatrooms</a><br/>";
    echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
        echo "</p>";
        echo xhtmlfoot();
}

else if ($action=="formmenu")           {
addonline(getuid_sid($sid),"Forum Index - xHTML","index.php?action=$action");
$pstyle = gettheme($sid);
    echo xhtmlhead("Arawap Forums",$pstyle);
    
  echo "<p align=\"center\"><small>";  
  $tmsg = getpmcount(getuid_sid($sid));
  $umsg = getunreadpm(getuid_sid($sid));
  
  if($umsg==1)
  {
  echo "<a href=\"inbox.php?action=main&amp;sid=$sid\">Inbox($umsg New Message)</a> <br/><br/>";
  }
  if($umsg>1)
  {
  echo "<a href=\"inbox.php?action=main&amp;sid=$sid\">Inbox($umsg New Messages)</a> <br/><br/>";
  }  
  echo "</small></p>";
  
  echo "<p><small>";
  echo "<u><i>Forum <b>Categories:</b></i></u><br/>";
  $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;sid=$sid&amp;cid=$fcat[0]\">$iml$fcat[1]</a><br/>";
    echo "$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/><small>";
    while($forum=mysql_fetch_array($forums))
        {
      if(canaccess(getuid_sid($sid),$forum[0]))
      {
        
      echo "<a href=\"index.php?action=viewfrm&amp;sid=$sid&amp;fid=$forum[0]\">$forum[1]</a>, ";
      }
    }
    echo "</small>";
    }else if(getfview()==20)
    {
      echo "<form method=\"get\" action=\"index.php\">";
      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>";
      
      $rets .= "<input type=\"hidden\" name=\"action\" value=\"viewfrm\"/>";
      $rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";     
      echo "<input type=\"submit\" name=\"Submit\" value=\"[GO]\"/><br/>";
      echo "</form>";
  
    }
    
  }
  $norm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users"));
  $nops = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts"));
  echo "<br/><br/><b>$norm[0]</b> users have made a total of <b>$nops[0]</b> posts<br/><br/>";
  echo "</small></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 "<br/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
  echo xhtmlfoot();
    }
                                       
                                       
                                           
else if ($action=="funm")
 {
addonline(getuid_sid($sid),"Fun/Games Menu - xHTML","index.php?action=$action");
$pstyle = gettheme($sid);
    echo xhtmlhead("Fun/Games Menu",$pstyle);
        echo "<p align=\"center\"><small>";
        echo "<img src=\"images/roll.gif\" alt=\"*\"/><br/>";
        echo "Hello, so you want to play some games and have fun? well you came into the right place";
        echo "</small></p>";
        echo "<p><small>";
        echo "<i><u>Just For Fun</u></i><br/>";
        echo "<a href=\"Arawapbabe.php?sid=$sid\">&#187;Arawap Babe</a><br/>";
        echo "<a href=\"hangman/index.php?sid=$sid\">&#187;Hangman</a><br/>";
        echo "<a href=\"games.php?action=fci&amp;sid=$sid\">&#187;Fortune Cookie</a><br/>";
        echo "<i><u>Win Some Credits</u></i><br/>";
        echo "<a href=\"games.php?action=guessgm&amp;sid=$sid\">&#187;Guess The Number</a><br/>";
        echo "<a href=\"games.php?action=casinoi&amp;sid=$sid\">&#187;Casino</a><br/>";
        echo "<a href=\"games.php?action=lottoi&amp;sid=$sid\">&#187;Lotto</a><br/>";
        echo "<i><u>Meet New Friends</u></i><br/>";
        echo "<a href=\"games.php?action=mixabud&amp;sid=$sid\">&#187;Mix a Buddy</a><br/>";
        echo "<a href=\"games.php?action=mixabudguy&amp;sid=$sid\">&#187;Mix a Guy (For Girls Only)</a><br/>";
        echo "<a href=\"games.php?action=mixabudgirl&amp;sid=$sid\">&#187;Mix a Girl (For Guys Only)</a><br/>";
        //echo "&#187;Dares Box<br/>";
        echo "</small></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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
        echo "</p>";
        echo xhtmlfoot();
}

else if ($action=="partners")
 {
addonline(getuid_sid($sid),"Partner List - xHTML","");
$pstyle = gettheme($sid);
    echo xhtmlhead("Partners",$pstyle);
        echo "<p align=\"center\"><small>";
        echo "Arawap Partners<br/><br/>";
        echo "</small></p>";
        echo "<p><small>";
        echo "<a href=\"http://toxic.sosx.org\">Toxic Wap</a><br/>"; 
        echo "<a href=\"http://technokid.net\">Super Tech</a><br/>";    
        echo "</small></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 "<br/><a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
        echo "</p>";
        echo xhtmlfoot();
}

///////////////////////////////view blog

else if($action=="viewblog")
{
  $bid = $_GET["bid"];
  addonline(getuid_sid($sid),"Viewing Blog - xHTML","");
$pstyle = gettheme($sid);
    echo xhtmlhead("View Blog",$pstyle);
  echo "<p>";

  $pminfo = mysql_fetch_array(mysql_query("SELECT btext, bname, bgdate,bowner, id FROM ibwf_blogs WHERE id='".$bid."'"));
    $bttl = htmlspecialchars($pminfo[1]);
    $btxt = parsemsg($pminfo[0], $sid);
    $bnick = getnick_uid($pminfo[3]);
  $vbbl = "<a href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$pminfo[3]\">$bnick</a><br/>";
  echo "Club ID: <b>$bid</b><br/>";
    echo "<b>$bttl</b> by: $vbbl<br/>";
  echo "$btxt<br/>";
  $tmstamp = $pminfo[2];
  $tmdt = date("d m y - h:i:s", $tmstamp);
  echo "<small>$tmdt</small><br/><br/>";
  $vb = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_brate WHERE uid='".$uid."' AND blogid='".$bid."'"));
  if($vb[0]==0)
  {
  echo "<select name=\"brate\">";
  echo "<option value=\"1\">1</option>";
  echo "<option value=\"2\">2</option>";
  echo "<option value=\"3\">3</option>";
  echo "<option value=\"4\">4</option>";
  echo "<option value=\"5\">5</option>";
  echo "</select><br/>";
  echo "<anchor>Rate";
  echo "<go href=\"genproc.php?action=rateb&amp;sid=$sid&amp;bid=$pminfo[4]\" method=\"post\">";
  echo "<postfield name=\"brate\" value=\"$(brate)\"/>";
  echo "</go></anchor>";
  }else{
    $rinfo = mysql_fetch_array(mysql_query("SELECT COUNT(*) as nofr, SUM(brate) as nofp FROM ibwf_brate WHERE blogid='".$bid."'"));
    $ther = $rinfo[1]/$rinfo[0];
    echo "Rate: $ther - Points: $rinfo[1]";
  }
  echo "</p>";
  echo "<p align=\"center\">";
  echo "<a href=\"lists.php?action=allbl&amp;sid=$sid\">Back to Blogs</a><br/>";
  $bnick = getnick_uid($pminfo[3]);
  echo "<a href=\"lists.php?action=blogs&amp;sid=$sid&amp;who=$pminfo[3]\">Back to $bnick's Blogs</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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    echo xhtmlfoot();

}


/////////////////////////////////ADMIN CP
else if($action=="admincp")
{
  addonline(getuid_sid($sid),"Admin CP - xHTML","");
    $pstyle = gettheme($sid);
    echo xhtmlhead("Admin CP!",$pstyle);
  echo "<p align=\"center\">";
  echo "<b>Admin CP</b>";
  echo "</p>";
  echo "<p><small>";
  if(isadmin(getuid_sid($sid)))
  {
    echo "<a href=\"admincp.php?action=general&amp;sid=$sid\">&#187;General Settings</a><br/>";
    echo "<a href=\"admincp.php?action=fcats&amp;sid=$sid\">&#187;Forum Categories</a><br/>";
    echo "<a href=\"admincp.php?action=forums&amp;sid=$sid\">&#187;Forums</a><br/>";
    echo "<a href=\"admincp.php?action=ugroups&amp;sid=$sid\">&#187;User groups</a><br/>";
    echo "<a href=\"admincp.php?action=addperm&amp;sid=$sid\">&#187;Add permissions</a><br/>";
    echo "<a href=\"admincp.php?action=chuinfo&amp;sid=$sid\">&#187;Change user info</a><br/>";
    echo "<a href=\"admincp.php?action=manrss&amp;sid=$sid\">&#187;Manage RSS Sources</a><br/>";
	echo "<a href=\"users/themes.php?sid=$sid\">&#187;Add Theme</a><br/>";
    echo "<a href=\"admincp.php?action=addsml&amp;sid=$sid\">&#187;Add Smilies</a><br/>";
    echo "<a href=\"admincp.php?action=addavt&amp;sid=$sid\">&#187;Add Avatar</a><br/>";
    echo "<a href=\"admincp.php?action=chrooms&amp;sid=$sid\">&#187;Chatrooms</a><br/>";
    if($uid==1) {
    echo "<a href=\"admincp.php?action=clrdta&amp;sid=$sid\">&#187;Clear Data</a><br/>";
    }
  }else{
    echo "You are not an Admin";
  }
  echo "</small></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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
  echo xhtmlfoot();
}
/////////////////////////////////Terms of use
else if($action=="terms")
{
  $uid =getuid_sid($sid);
  if($uid>0)
  {
  addonline(getuid_sid($sid),"Terms of use - xHTML","index.php?action=$action");
  $pstyle = gettheme($sid);
    echo xhtmlhead("Terms Of Use",$pstyle);
  }
$pstyle = gettheme1("1");
    echo xhtmlhead("Terms Of Use",$pstyle);
  echo "<p><small>";
  echo "<img src=\"images/point.gif\" alt=\"!\"/>Posts containing racism, links to other sites, spamming, flooding, adult content, hacking will be deleted immediately, and the posters will get warned or banned<br/>";
  echo "<img src=\"images/point.gif\" alt=\"!\"/>chatting, discriminating, posting off topics, posting useless posts (smilies only or one word post), and free posting results to delete the posts, substracting plusses and banning in some cases<br/>";
  echo "<img src=\"images/point.gif\" alt=\"!\"/>Registering more than one nickname, could result to delete all your accounts<br/>";
  echo "<img src=\"images/point.gif\" alt=\"!\"/>Never give your account password to anyone, except in some extreme cases and the admins should be informed about it<br/>";
  echo "<img src=\"images/point.gif\" alt=\"!\"/>Faking your personal information (like age, sex, location etc..) just to gain access to hidden forums or any other reason could result on banning, or a warning at least<br/>";
  echo "<img src=\"images/point.gif\" alt=\"!\"/>Females harassment, and racism will results on banning for 7 days at least without a warning, and an IP-Ban if this behavior continued<br/>";
  echo "<img src=\"images/point.gif\" alt=\"!\"/>Bumping topics (keep posting in them by the author of the topic just to keep it in first page and not for a good reason) will cause these topics to be deleted and the penalty could vary between warning, substracting plusses, or even a ban<br/>";
  echo "<img src=\"images/point.gif\" alt=\"!\"/>You can only speak in english in forums, and all the chatrooms except (International, afrikaans and mad room)<br/>";
  echo "<img src=\"images/point.gif\" alt=\"!\"/>Please report any spams, this is the only thing that we want from you for our free services<br/>";
  echo "<img src=\"images/point.gif\" alt=\"!\"/>No smoking in public, next to the pregnant ladies, or next to babies hehe<br/>";
  echo "<img src=\"images/point.gif\" alt=\"!\"/>The most important rule is to have fun here and enjoy your stay ;)<br/>";
  echo "<br/>Remeber, these rules were made for protecting you before protecting us, if you think they are a little restrictive then read <a href=\"lists.php?action=faqs&amp;sid=$sid\">our F.A.Qs</a> or ask any online staff member(only if you logged in), Thank you so much<br/>";
  echo "</small></p>";
  echo "<p align=\"center\">";
  if($uid>0)
  {
  $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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
}else{
    echo "<a href=\"index.php\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
}
  echo "</p>";
  echo xhtmlfoot();
}





////////////////////////////////Terms of use
else if($action=="fsite")
{
  $uid =getuid_sid($sid);
  if($uid>0)
  {
  addonline(getuid_sid($sid),"Free Site - xHTML","index.php?action=$action");
  $pstyle = gettheme($sid);
    echo xhtmlhead("Site for free",$pstyle);
  }
$pstyle = gettheme1("1");
    echo xhtmlhead("Site for free",$pstyle);
  echo "<p><small>";
  
  
  echo "<b>Get your own Personal Site for free!</b><br/><br/>";

echo "When you sign up to arawap as a member we automatically create a site for you, this is totally 
free and will cost you nothing more than your support to us<br/><br/>The more you update your settings in your
 CPanel after loging in to arawapnet, the more you update your site<br/><br/>after signup you can go to 
http://arawapnet/users?yournickname to view your site, you can also change the colours (themes) of your 
site to suit you likes<br/><br/>Updating your site has never been easier, simply login to your arawapnet 
account, then point your browser to CPanel, all the settings you need is found there<br/><br/>We are currently 
working on making the Personal sites better with more features to keep you, the arawap user, happy!<br/>
<br/>Enjoy Arawap.net<br/>";
  
  
  
  
  echo "</small></p>";
  echo "<p align=\"center\">";
  if($uid>0)
  {
  $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&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
echo "Home</a>";
}else{
    echo "<a href=\"index.php\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
}
  echo "</p>";
  echo xhtmlfoot();
}



else if($action=="logout")
{
  $uid =getuid_sid($sid);
  $whonick = getnick_uid($uid);
  addonline(getuid_sid($sid),"loddeg out - xHTML","index.php?action=$action");
$pstyle = gettheme($sid);
    echo xhtmlhead("Log Out",$pstyle);
  echo "<p>";
  echo "<b>$whonick</b> are you sure you want to log out?<br/><br/>";
  echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/notok.gif\" alt=\"No\"/>";
  echo "No</a><br/>";
  echo "<a href=\"index.php?action=logoutyes&amp;sid=$sid\"><img src=\"images/ok.gif\" alt=\"Yes\"/>";
  echo "Yes</a>";
  echo "</p>";
  echo xhtmlfoot();
}
else if($action=="logoutyes")
{
  $uid =getuid_sid($sid);
  $whonick = getnick_uid($uid);
  addonline(getuid_sid($sid),"Wants to Log Out - xHTML","");
        $pstyle = gettheme($sid);
    echo xhtmlhead("Log Out",$pstyle);
  echo "<p align=\"center\">";
  echo "Good bye <b>$whonick</b><br/><br/>";
  echo "<small>Whe hope you had a great time here, and hope to see you soon</small>";
  $logoutses = mysql_query("DELETE FROM ibwf_ses WHERE uid='".$uid."'");
  $logoutonline = mysql_query("DELETE FROM ibwf_online WHERE userid='".$uid."'");  
  echo "<br/><br/><a href=\"http://Arawap.net\"><img src=\"images/ok.gif\" alt=\"OK\"/>";
  echo "Click Here To Continue</a>";
  echo "</p>";
  echo xhtmlfoot();
}
else{
  /////////////////////////Main Page Here
      $pstyle = gettheme1("1");
      echo xhtmlhead("Arawap",$pstyle);
  echo "<p align=\"center\">";

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

  echo "<small>Welcome to the fastest growing community ever</small><br/>";
echo "<small><b>http://arawap.net</b></small><br/>";
  echo "<small>Sinhala kama agayana Ape wap Kalaawa..<br/>NOW u can set ur language to Sinhala!</small>";
echo "<br/><small><a href=\"index.php?action=fsite&amp;sid=$sid\">get OWN w@p Site for FREE!!</a></small><br/><br/>";
  echo "Register now and get acces to live chats, forums, polls, games, downloads and alot more. Come inside and see for yourself!!!<br/><br/>";
  echo "Not registered yet?<br/>";
  echo "<a href=\"register.php?action=register\">Register Now!!</a><br/><br/>";

  echo "</p>";
  echo "<p>";
  echo "<form method=\"get\" action=\"login.php\">";
  echo "<small>UserName:</small> <input name=\"loguid\" format=\"*x\" maxlength=\"30\"/><br/>";
  echo "<small>Password:</small> <input type=\"password\" name=\"logpwd\"  maxlength=\"30\"/><br/>";
  echo "<input type=\"submit\" name=\"Submit\" value=\"Log In\"/><br/>";
  echo "</form>";
  echo "</p>";
  echo "<p>";
  echo "<br/><br/>";
  echo "<small>";
  echo "<a href=\"index.php?action=terms&amp;sid=$sid\">Terms Of Use</a><br/><br/>";
  $onu = getnumonline() + 15;
  echo "Members Inside: $onu<br/>";
  $norm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users"));
  echo "Registered Members: <b>$norm[0]</b><br/>";
  echo "Call/ sMs us if U have any Logging Problems or anything else U want to know,<br/><a href=\"wtai://wp/mc;00393207131479\"> 00393207131479 </a>";
  
  
  
  echo "<br/></small>";
  echo "</p>";
  echo "<p align=\"center\">";
  echo "<small>";
 echo "Original Wap Script by:<br/>";
	echo "<a href=\"http://lavalair.net\">IrisBlaze</a>";
echo "<br/><a href=\"http://arawap.freehostia.com/copyrights.php\">copyrights!</a></small></p>";

  echo "<p align=\"center\"><small><b> ARAWAP 2007</b></small>";

  echo "</p>";
  echo xhtmlfoot();
}


?>