View file chat spall script/web/inbxproc.htm

File size: 24.25Kb
<?
// -------------------------------------------------------------------------------------
$EnableGZipEncoding = true;
// -------------------------------------------------------------------------------------
// Helper function to detect if GZip is supported by client!
// If not supported the tricks are pointless
function acceptsGZip(){
    $accept = str_replace(" ","",
        strtolower($_SERVER['HTTP_ACCEPT_ENCODING'])
    );
    $accept = explode(",",$accept);
    return in_array("gzip",$accept);
}
// -------------------------------------------------------------------------------------
function playWithHtml($OutputHtml){
    // This will mess up HTML code like my site has done!
    // View the source to understand! All ENTERs are removed.
    // If your site has PREformated code this will break it!
    // Use regexp to find it and save it and place it back ...
    // or just uncomment the next line to keep enters
    // return $OutputHtml;
    return preg_replace("/\s+/"," ",$OutputHtml);
}
// -------------------------------------------------------------------------------------
function obOutputHandler($OutputHtml){
    global $EnableGZipEncoding;
    //-- Play with HTML before output
    $OutputHtml = playWithHtml($OutputHtml);
    //-- If GZIP not supported compression is pointless.
    // If headers were sent we can not signal GZIP encoding as
    // we will mess it all up so better drop it here!
    // If you disable GZip encoding to use plain output buffering we stop here too!
    if(!acceptsGZip() || headers_sent() || !$EnableGZipEncoding) return $OutputHtml;
    //-- We signal GZIP compression and dump encoded data
    header("Content-Encoding: gzip");
    return gzencode($OutputHtml);
}
// This code has to be before any output from your site!
// If output exists uncompressed HTML will be delivered!
ob_start("obOutputHandler");
// -------------------------------------------------------------------------------------
?>
<?php
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
//header('Content-type: application/vnd.wap.xhtml+xml'); 
echo "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">";
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
include("config.php");
include("core.php");
connectdb();
$action = mysql_real_escape_string($_GET["action"]);
$sid = mysql_real_escape_string($_GET["sid"]);
$pmtext = mysql_real_escape_string($_POST["pmtext"]);
$who = mysql_real_escape_string($_GET["who"]);
$lastloc=mysql_real_escape_string($_GET["lstloc"]);
$sitename = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='sitename'"));
$sitename = $sitename[0];
$uid = getuid_sid($sid);
if($lastloc=="cht"){
	$rid= $_GET["rid"];
    $rooms = mysql_fetch_array(mysql_query("SELECT id, name FROM ibwf_rooms WHERE id='".$rid."'"));
    $rname = $rooms[1];
}
if(islogged($sid)==false)
{
      echo "<head>";
      echo "<title>Error!!!</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/white_medium.css\">";
      echo "</head>";
      echo "<body>";
      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 "</body>";
      echo "</html>";
      exit();
}

if($action=="sendpm")
{
       
echo "<head>";
  echo "<title>Inbox</title>";
  echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
  echo "</head>";
  echo "<body>";
echo "<p align=\"center\">";



 echo("Inbox");
echo "</p>";  
echo "<p align=\"center\">";
  $whonick = getnick_uid($who);
  $byuid = getuid_sid($sid);
  $tm = (time() - $timeadjust);
  $lastpm = mysql_fetch_array(mysql_query("SELECT MAX(timesent) FROM ibwf_private WHERE byuid='".$byuid."'"));
  $pmfl = $lastpm[0]+getpmaf();
  if($byuid==1)$pmfl=0;
  if($pmfl<$tm)
  {
    if(!isblocked($pmtext,$byuid))
    {
    if((!isignored($byuid, $who))&&(!istrashed($byuid)))
    {
  $res = mysql_query("INSERT INTO ibwf_private SET text='".$pmtext."', byuid='".$byuid."', touid='".$who."', timesent='".$tm."'");
  }else{
    $res = true;
  }
  if($res)
  {

    echo "<img src=\"../images/ok.gif\" alt=\"O\"/>";
    echo "PM was sent successfully to ";
	echo "<a href=\"index.php?action=viewuser&amp;who=$who&amp;sid=$sid\">$whonick</a><br/><br/>";
    echo parsepm($pmtext, $sid);

  }else{
    echo "<img src=\"../images/notok.gif\" alt=\"X\"/>";
    echo "Can't Send PM to $whonick<br/><br/>";
  }
  }else{
    $bantime = (time() - $timeadjust) + (7*24*60*60) ;
    echo "<img src=\"images/notok.gif\" alt=\"X\"/>";
    echo "Can't Send PM to $whonick<br/><br/>";
    echo "You just sent a link to one of the crapiest sites on earth<br/> The members of these sites spam here a lot, so go to that site and stay there if you don't like it here<br/> as a result of your stupid action:<br/>1. you have lost your sheild<br/>2. you have lost all your Credits<br/>3. You are BANNED!";
    mysql_query("INSERT INTO ibwf_metpenaltiespl SET uid='".$byuid."', penalty='1', exid='1', timeto='".$bantime."', pnreas='Banned: Automatic Ban for spamming for a crap site'");
    mysql_query("UPDATE ibwf_users SET plusses='0', shield='0' WHERE id='".$byuid."'");
    mysql_query("INSERT INTO ibwf_private SET text='".$pmtext."', byuid='".$byuid."', touid='1', timesent='".$tm."'");
  }
  }else{
    $rema = $pmfl - $tm;
    echo "<img src=\"../images/notok.gif\" alt=\"X\"/>";
    echo "Flood control: $rema Seconds<br/><br/>";
  }
   echo "<br/><br/>";
   if($page=="" || $page<=0)$page=1;
    $myid = getuid_sid($sid);
    $doit=false;
    $num_items = getpmcount($myid); //changable
    $items_per_page= 1
;
    $num_pages = ceil($num_items/$items_per_page);
    if($page>$num_pages)$page= $num_pages;
    $limit_start = ($page-1)*$items_per_page;


$sql = "SELECT
            a.name, b.id, b.byuid, b.unread, b.starred FROM ibwf_users a
            INNER JOIN ibwf_private b ON a.id = b.byuid
            WHERE b.touid='".$myid."' AND b.unread='1'
            ORDER BY b.timesent
            LIMIT $limit_start, $items_per_page
    ";

     $items = mysql_query($sql);


    echo mysql_error();
    while ($item = mysql_fetch_array($items))
    {
      if($item[3]=="1")
      {
        $iml = "<img src=\"../images/npm.gif\" alt=\"+\"/>";
      }else{
        if($item[4]=="1")
        {
            $iml = "<img src=\"../images/spm.gif\" alt=\"*\"/>";
        }else{

        $iml = "<img src=\"../images/opm.gif\" alt=\"-\"/>";
        }
      }

      $lnk = "<a href=\"inbox.php?action=readpm&amp;pmid=$item[1]&amp;sid=$sid\">$iml $item[0]</a>";
      echo "$lnk<br/>";
    }

  echo "<a href=\"inbox.php?action=main&amp;sid=$sid\">Back to inbox</a><br/>";
   echo "<a href=\"index.php?action=chat&amp;sid=$sid\">Back to Chat</a><br/>";
 echo "<a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
        echo "</p>";
  echo "</body>";
}
else if($action=="sendpopup")
{
  echo "<head>";
  echo "<title>Send Popup</title>";
  echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
  echo "</head>";
  echo "<body>";
  echo "<p align=\"center\">";
  $pmid = $_GET["pmid"];
  $whonick = getnick_uid($who);
  $byuid = getuid_sid($sid);
  $tm = time();
  $lastpm = mysql_fetch_array(mysql_query("SELECT MAX(timesent) FROM ibwf_popups WHERE byuid='".$byuid."'"));
  $pmfl = $lastpm[0]+getpmaf();
  $pmurd = mysql_query("UPDATE ibwf_popups SET unread='0' WHERE id='".$pmid."'");

  if($byuid==1)$pmfl=0;
  if($pmfl>$tm)
  {
  $rema = $pmfl - $tm;
  echo "<img src=\"../images/notok.gif\" alt=\"X\"/>";
  echo "Flood control: $rema Seconds<br/><br/>";
  echo "<a accesskey=\"9\" href=\"lists.php?action=buds&amp;sid=$sid\">Buddylist</a><br/>";
  echo "<a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p></body></html>";
  exit();
  }
  $uid = getuid_sid($sid);
  if (!arebuds($uid, $who))
  {
  echo "$whonick is not in ur buddy list<br/><br/>";
  echo "<a accesskey=\"9\" href=\"lists.php?action=buds&amp;sid=$sid\">Buddylist</a><br/>";
  echo "<a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p></body></html>";
  exit();
  }
  if(!popupson($who))
  {
  echo "$whonick has there popups disabled<br/><br/>";
  echo "<a accesskey=\"9\" href=\"lists.php?action=buds&amp;sid=$sid\">Buddylist</a><br/>";
  echo "<a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p></body></html>";
  exit();
  }
if(isignored($uid, $who))
    {
    echo "<img src=\"../images/notok.gif\" alt=\"X\"/>";
    echo "Failed Sending Pop-up To $whonick they hav u on ignore...<br/><br/>";
    echo "<a accesskey=\"9\" href=\"lists.php?action=buds&amp;sid=$sid\">Buddylist</a><br/>";
    echo "<a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
    echo "</p></body></html>";
    exit();
    }
else if(isblocked($pmtext,$byuid))
    {
    $bantime = time() + (28*24*60*60);
    echo "<img src=\"../images/notok.gif\" alt=\"X\"/>";
    echo "Can't Send PM to $whonick<br/><br/>";
    echo "You just sent a link to one of the crapiest sites on earth<br/> The members of these sites spam here a lot, so go to that site and stay there if you don't like it here<br/> as a result of your stupid action:<br/>1. you have lost your sheild<br/>2. you have lost all your plusses<br/>3. You are BANNED!";
        $user = getnick_sid($sid);
    mysql_query("INSERT INTO ibwf_mlog SET action='autoban', details='<b>Wap Desire</b> auto banned $user for spamming thru popups', actdt='".time()."'"); 
    mysql_query("INSERT INTO ibwf_penalties SET uid='".$byuid."', penalty='1', exid='2', timeto='".$bantime."', pnreas='Banned: Automatic Ban for spamming for a crap site'");
    mysql_query("UPDATE ibwf_users SET plusses='0', shield='0' WHERE id='".$byuid."'");
    mysql_query("INSERT INTO ibwf_popups SET text='".$pmtext."', byuid='".$byuid."', touid='1', timesent='".$tm."'");
    mysql_query("INSERT INTO ibwf_private SET text='[b](forwarded spam via popups)[/b][br/]".$pmtext."', byuid='".$byuid."', touid='1', timesent='".$tm."'");
    echo "</p></body></html>";
    exit();
    }
  $res = mysql_query("INSERT INTO ibwf_popups SET text='".$pmtext."', byuid='".$byuid."', touid='".$who."', timesent='".$tm."'");
  if($res)
  {

    echo "<img src=\"../images/ok.gif\" alt=\"O\"/>";
    echo "Pop-up was sent successfully to $whonick<br/><br/>";
    echo parsepm($pmtext, $sid);
    }else{
    echo "<img src=\"../images/notok.gif\" alt=\"X\"/>";
    echo "Failed Sending Pop-up To $whonick<br/><br/>";
  }
  $uid = getuid_sid($sid);
  $location = mysql_fetch_array(mysql_query("SELECT placedet FROM ibwf_online WHERE userid='".$uid."'"));
  		   $loca = $location[0];
  		   echo "<br/><b>1 </b><a accesskey=\"1\" href=\"$loca&amp;sid=$sid\">ok!</a><br/>";
	  echo "<br/><a accesskey=\"4\" href=\"index.php?action=popdisable&amp;sid=$sid\">Disable Pop-Ups</a><br/>";
     if($lastloc=="cht"){
	        echo "<a accesskey=\"5\" href=\"chat.php?sid=$sid&amp;rid=$rid\">Back To $rname</a><br/>";
}
  echo "<a accesskey=\"6\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
  echo "<a accesskey=\"7\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
  echo "<a accesskey=\"8\" href=\"index.php?action=chat&amp;sid=$sid\">Chat</a><br/>";
  
  echo "<a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
    echo "</p></body>";
    }
else if($action=="rptpop")
    {
  echo "<head>";
  echo "<title>Reporting Popup</title>";
  echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
  echo "</head>";
  echo "<body>";
  echo "<p align=\"center\">";
        addonline(getuid_sid($sid),"Reporting Popup","");
    $pminfo = mysql_fetch_array(mysql_query("SELECT text, byuid, touid, reported FROM ibwf_popups WHERE id='".$pmid."'"));

        if(getuid_sid($sid)==$pminfo[2])
        {
          if($pminfo[3]=="0")
          {
          $str = mysql_query("UPDATE ibwf_popups SET reported='1' WHERE id='".$pmid."' ");
          if($str)
          {
            echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Popup reported to mods successfully<br/><br/>";
          }else{
            echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Can't report Popup at the moment<br/><br/>";
          }
          }else{
            echo "<img src=\"../images/notok.gif\" alt=\"X\"/>This Popup is already reported<br/><br/>";
          }
        }else{
          echo "<img src=\"../images/notok.gif\" alt=\"X\"/>This Popup ain't yours<br/><br/>";
        }
  echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
    echo "</p></body>";
    }
else if($action=="sendto")
{
  echo "<head>";
  echo "<title>Inbox</title>";
  echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
  echo "</head>";
  echo "<body>";
  echo "<p align=\"center\">";
  $pmtou = $_POST["who"];
  $who = getuid_nick($pmtou);
    if($who==0)
    {
      echo "<img src=\"../images/notok.gif\" alt=\"x\"/>User Does Not exist<br/>";
    }else{
$whonick = getnick_uid($who);
  $byuid = getuid_sid($sid);
  $tm = time();
  $lastpm = mysql_fetch_array(mysql_query("SELECT MAX(timesent) FROM ibwf_private WHERE byuid='".$byuid."'"));
  $pmfl = $lastpm[0]+getpmaf();
  if($pmfl<$tm)
  {
    if(!isblocked($pmtext,$byuid))
    {
    if((!isignored($byuid, $who))&&(!istrashed($byuid)))
    {
  $res = mysql_query("INSERT INTO ibwf_private SET text='".$pmtext."', byuid='".$byuid."', touid='".$who."', timesent='".$tm."'");
  }else{
    $res = true;
  }
  if($res)
  {
    echo "<img src=\"../images/ok.gif\" alt=\"O\"/>";
    echo "Inbox was sent successfully to $whonick<br/><br/>";
    echo parsepm($pmtext, $sid);

  }else{
    echo "<img src=\"../images/notok.gif\" alt=\"X\"/>";
    echo "Can't Send Inbox to $whonick<br/><br/>";
  }
  }else{
   $bantime = time() + (7*24*60*60);
    echo "<img src=\"../images/notok.gif\" alt=\"X\"/>";
    echo "Can't Send Inbox to $whonick<br/><br/>";
    echo "You just sent a link to one of the crapiest sites on earth<br/> The members of these sites spam here a lot, so go to that site and stay there if you don't like it here<br/> as a result of your stupid action:<br/>1. you have lost your sheild<br/>2. you have lost all your plusses<br/>3. You are BANNED!";
  $user = getnick_uid($sid);
    mysql_query("INSERT INTO ibwf_mlog SET action='autoban', details='<b>Wap Desire</b> auto banned $user for spamming inbox', actdt='".time()."'");
    mysql_query("INSERT INTO ibwf_penalties SET uid='".$byuid."', penalty='1', exid='2', timeto='".$bantime."', pnreas='Banned: Automatic Ban for spamming for a crap site'");
    mysql_query("UPDATE ibwf_users SET plusses='0', shield='0' WHERE id='".$byuid."'");
    mysql_query("INSERT INTO ibwf_private SET text='".$pmtext."', byuid='".$byuid."', touid='1', timesent='".$tm."', reported='1'");
    exit();
  }
  }else{
    $rema = $pmfl - $tm;
    echo "<img src=\"../images/notok.gif\" alt=\"X\"/>";
    echo "Flood control: $rema Seconds<br/><br/>";
  }

    }
  
  echo "<br/><a accesskey=\"6\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
  echo "<a accesskey=\"7\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
  echo "<a accesskey=\"8\" href=\"index.php?action=chat&amp;sid=$sid\">Chat</a><br/>";
  
  echo "<a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p>";
    echo "</body>";
}
else if($action=="proc")
{
    $pmact = $_POST["pmact"];
    $pact = explode("-",$pmact);
    $pmid = $pact[1];
    $pact = $pact[0];
    echo "<head>";
    echo "<title>Inbox</title>";
    echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
    echo "</head>";
    echo "<body>";
    echo "<p align=\"center\">";
    $pminfo = mysql_fetch_array(mysql_query("SELECT text, byuid, touid, reported FROM ibwf_private WHERE id='".$pmid."'"));
    if($pact=="rep")
    {
      addonline(getuid_sid($sid),"Sending Inbox","inbox.php?action=main");
       
      $whonick = getnick_uid($pminfo[1]);
  echo "Send Inbox to $whonick<br/><br/>";
     if($lastloc=="cht"){
  		echo "<form action=\"inbxproc.php?action=sendpm&amp;who=$pminfo[1]&amp;sid=$sid&amp;lstloc=cht&amp;rid=$rid\" method=\"post\">";
 }else{
  echo "<form action=\"inbxproc.php?action=sendpm&amp;who=$pminfo[1]&amp;sid=$sid\" method=\"post\">";
}
  echo "<input name=\"pmtext\" maxlength=\"500\"/><br/>";
  echo "<input type=\"Submit\" name=\"send\" Value=\"Send\"></form>";

    }else if($pact=="del")
    {
        addonline(getuid_sid($sid),"Deleting Inbox","");
        if(getuid_sid($sid)==$pminfo[2])
        {
          if($pminfo[3]=="1")
          {
            
            echo "<img src=\"../images/notok.gif\" alt=\"X\"/>This Inbox is reported, thus it can't be deleted";
          }else{
          $del = mysql_query("DELETE FROM ibwf_private WHERE id='".$pmid."' ");
          if($del)
          {
            echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Inbox deleted successfully";
          }else{
            echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Can't Delete Inbox at the moment";
          }
          }

        }else{
          echo "<img src=\"../images/notok.gif\" alt=\"X\"/>This Inbox ain't yours";
        }
    }else if($pact=="str")
    {
        addonline(getuid_sid($sid),"Starring Inbox","");
        if(getuid_sid($sid)==$pminfo[2])
        {
          $str = mysql_query("UPDATE ibwf_private SET starred='1' WHERE id='".$pmid."' ");
          if($str)
          {
            echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Inbox starred successfully";
          }else{
            echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Can't star Inbox at the moment";
          }
        }else{
          echo "<img src=\"../images/notok.gif\" alt=\"X\"/>This Inbox ain't yours";
        }
    }else if($pact=="ust")
    {
        addonline(getuid_sid($sid),"Unstarring Inbox","");
        if(getuid_sid($sid)==$pminfo[2])
        {
          $str = mysql_query("UPDATE ibwf_private SET starred='0' WHERE id='".$pmid."' ");
          if($str)
          {
            echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Inbox unstarred successfully";
          }else{
            echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Can't unstar Inbox at the moment";
          }
        }else{
          echo "<img src=\"../images/notok.gif\" alt=\"X\"/>This Inbox ain't yours";
        }
    }else if($pact=="rpt")
    {
        addonline(getuid_sid($sid),"Reporting Inbox","");
        if(getuid_sid($sid)==$pminfo[2])
        {
          if($pminfo[3]=="0")
          {
          $str = mysql_query("UPDATE ibwf_private SET reported='1' WHERE id='".$pmid."' ");
          if($str)
          {
            echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Inbox reported to mods successfully";
          }else{
            echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Can't report Inbox at the moment";
          }
          }else{
            echo "<img src=\"../images/notok.gif\" alt=\"X\"/>This Inbox is already reported";
          }
        }else{
          echo "<img src=\"../images/notok.gif\" alt=\"X\"/>This Inbox ain't yours";
        }
    }
	else if($pact=="frd")
    {
        addonline(getuid_sid($sid),"Forwarding Inbox","");
        if(getuid_sid($sid)==$pminfo[2]||getuid_sid($sid)==$pminfo[1])
        {
  echo "<form action=\"inbxproc.php?action=frdpm&amp;sid=$sid\" method=\"post\">";  
  echo "Forward to e-mail:<br/><br/>";
  echo "<input name=\"email\" maxlength=\"250\"/><br/><input type=\"hidden\" value=\"$pmid\" name=\"pmid\"><br/>";
  echo "<input type=\"Submit\" name=\"forward\" Value=\"Forward\"></form>";
        }else{
          echo "<img src=\"../images/notok.gif\" alt=\"X\"/>This Inbox ain't yours";
        }
    }
	else if($pact=="dnl")
    {
        addonline(getuid_sid($sid),"Downloading Inbox","");
        if(getuid_sid($sid)==$pminfo[2]||getuid_sid($sid)==$pminfo[1])
        {
          echo "<img src=\"../images/ok.gif\" alt=\"X\"/>request processed successfully<br/><br/>";
		  echo "<a href=\"rwdpm.php?action=dpm&amp;pmid=$pmid&amp;sid=$sid\">Download Inbox</a>";
        }else{
          echo "<img src=\"../images/notok.gif\" alt=\"X\"/>This Inbox ain't yours";
        }
    }
    if($lastloc=="cht"){
	        echo "<br/><b>5 </b><a accesskey=\"5\" href=\"chat.php?sid=$sid&amp;rid=$rid\">Back To $rname</a><br/>";
    }
  echo "<br/><a accesskey=\"6\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
  echo "<a accesskey=\"7\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
  echo "<a accesskey=\"8\" href=\"index.php?action=chat&amp;sid=$sid\">Chat</a><br/>";
  
  echo "<a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p></body>";
}
else if($action=="proall")
{
  $pact = $_POST["pmact"];
  echo "<head>";
  echo "<title>Inbox</title>";
  echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
  echo "</head>";
  echo "<body>";
  echo "<p align=\"center\">";
  addonline(getuid_sid($sid),"Deleting Inboxes","");
  $uid = getuid_sid($sid);
  $del = mysql_query("DELETE FROM ibwf_private WHERE touid='".$uid."' AND reported !='1' AND unread='0' AND starred='0'");
  if($del)
  {
  echo "<img src=\"../images/ok.gif\" alt=\"O\"/>All Inboxes Deleted Successfully";
  }else{
  echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Can't Delete Inboxes At The Moment";
  }
  echo "<br/><br/><a accesskey=\"6\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
  echo "<a accesskey=\"7\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
  echo "<a accesskey=\"8\" href=\"index.php?action=chat&amp;sid=$sid\">Chat</a><br/>";
  
  echo "<a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p>";
  echo "</body>";
    
  }
else if($action=="frdpm")
{
	$email = $_POST["email"];
	$pmid = $_POST["pmid"];
  addonline(getuid_sid($sid),"Forwarding Inbox","");
  echo "<head>";
  echo "<title>Inbox</title>";
  echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
  echo "</head>";
  echo "<body>";
  echo "<p align=\"center\">";

  $pminfo = mysql_fetch_array(mysql_query("SELECT text, byuid, timesent,touid, reported FROM ibwf_private WHERE id='".$pmid."'"));
  
  
  if(($pminfo[3]==getuid_sid($sid))||($pminfo[1]==getuid_sid($sid)))
  {
  $from_head = "From: noreplay@$sitename";
  $subject = "Inbox By ".getnick_uid($pminfo[1])." To ".getnick_uid($pminfo[3])." ($sitename)";
  $content = "Date: ".date("l d/m/y H:i:s", $pminfo[2])."\n\n";
  $content .= $pminfo[0]."\n------------------------\n";
  $content .= "$sitename: The best wap community!";
  mail($email, $subject, $content, $from_head);
 echo "<img src=\"../images/ok.gif\" alt=\"X\"/>Inbox forwarded to $email";
  }else{
    echo "<img src=\"../images/notok.gif\" alt=\"X\"/>This Inbox ain't yours";
  }
  echo "<br/><br/><a accesskey=\"6\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
  echo "<a accesskey=\"7\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
  echo "<a accesskey=\"8\" href=\"index.php?action=chat&amp;sid=$sid\">Chat</a><br/>";
  
  echo "<a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p>";
    echo "</body>";

}

  else{
    addonline(getuid_sid($sid),"Lost in inbox lol","");
  echo "<head>";
  echo "<title>Error!!!</title>";
  echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
  echo "</head>";
  echo "<body>";
  echo "<p align=\"center\">";
  echo "I don't know how did you get into here, but there's nothing to show<br/><br/>";
  echo "<br/><a accesskey=\"6\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a><br/>";
  echo "<a accesskey=\"7\" href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
  echo "<a accesskey=\"8\" href=\"index.php?action=chat&amp;sid=$sid\">Chat</a><br/>";
  
  echo "<a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p></body>";
}
?>
</html>