View file wapirate/xhtml/captainsafecore.php

File size: 106.79Kb
<?php

if(!get_magic_quotes_gpc()){

$_GET = array_map('trim', $_GET);

$_POST = array_map('trim', $_POST);

$_COOKIE = array_map('trim', $_COOKIE);

$_GET = array_map('addslashes', $_GET);

$_POST = array_map('addslashes', $_POST);

$_COOKIE = array_map('addslashes', $_COOKIE);

}

function connectdb(){

global $dbname, $dbuser, $dbhost, $xpzrgrdbpass;

$conms = @mysql_connect($dbhost,$dbuser,$xpzrgrdbpass);

if(!$conms) return false;

$condb = @mysql_select_db($dbname);

if(!$condb) return false;

return true;

}

///////////////////////////////////gzip

function print_gzipped_page() {

    global $HTTP_ACCEPT_ENCODING;

    if( headers_sent() ){

        $encoding = false;

    }elseif( strpos($HTTP_ACCEPT_ENCODING, 'x-gzip') !== false ){

        $encoding = 'x-gzip';

    }elseif( strpos($HTTP_ACCEPT_ENCODING,'gzip') !== false ){

        $encoding = 'gzip';

    }else{

        $encoding = false;

    }

    if( $encoding ){

        $contents = ob_get_contents();

        ob_end_clean();

        header('Content-Encoding: '.$encoding);

        print("\x1f\x8b\x08\x00\x00\x00\x00\x00");

        $size = strlen($contents);

        $contents = gzcompress($contents, 9);

        $contents = substr($contents, 0, $size);

        print($contents);

        exit();

    }else{

        ob_end_flush();

        exit();

    }

}

////////////////////////anti sql injection

function delhtml($str){ 

return mysql_real_escape_string($str); 

}

function check_injection($sid,$uip,$ubr,$ref) 

  { 

    $badchars = array("DROP", "SELECT", "UPDATE", "DELETE", "INSERT" , "UNION", "WHERE", "FROM", "OR 1", "hidemyperm"); 

   

    foreach($_REQUEST  as $value) 

    { 

      if(in_array(strtoupper($value), $badchars)) 

      { 

if($sid!=""){

$uid = getuid_sid($sid);

$who = getnick_uid($uid);

addonline(getuid_sid($sid),"Walking The Plank!","");

$timeto = 9999*24*60*60;

$ptime = $timeto + time();

mysql_query("INSERT INTO ibwf_penalties SET uid='".$uid."', penalty='2', exid='407', timeto='".$ptime."', pnreas='Auto Ban (Wannabe Hacker) :2fuck', ipadd='".$uip."', browserm='".$ubr."'");

mysql_query("UPDATE ibwf_users SET lastpnreas='Wannabe Hacker :2fuck', shield='0' WHERE id='".$uid."'");

mysql_query("INSERT INTO ibwf_mlog SET action='Sql Injection', details='<b>".$who."</b> Tried Injecting Sql', actdt='".time()."'");

}else{

mysql_query("INSERT INTO ibwf_mlog SET action='Sql Injection', details='<b>".$ubr." ".$uip."</b> Tried Injecting Sql from ".$ref."', actdt='".time()."'");

}

    header('Location:http://fuckoff.com'); 

    exit();

      } 

      else 

      { 

        $check = preg_split("//", $value, -1, PREG_SPLIT_OFFSET_CAPTURE); 

        foreach($check as $char) 

        { 

         if(in_array(strtoupper($char), $badchars)) 

          { 

if($sid!=""){

$uid = getuid_sid($sid);

$whnick = getnick_uid($uid);

addonline(getuid_sid($sid),"Walking The Plank!","");

$timeto = 9999*24*60*60;

$ptime = $timeto + time();

mysql_query("INSERT INTO ibwf_penalties SET uid='".$uid."', penalty='2', exid='407', timeto='".$ptime."', pnreas='Auto Ban (Wannabe Hacker) :2fuck', ipadd='".$uip."', browserm='".$ubr."'");

mysql_query("UPDATE ibwf_users SET lastpnreas='Wannabe Hacker :2fuck', shield='0' WHERE id='".$uid."'");

mysql_query("INSERT INTO ibwf_mlog SET action='Sql Injection', details='<b>".$who."</b> Tried Injecting Sql', actdt='".time()."'");

}else{

mysql_query("INSERT INTO ibwf_mlog SET action='Sql Injection', details='<b>".$ubr." ".$uip."</b> Tried Injecting Sql from ".$ref."', actdt='".time()."'");

}

    header('Location:http://fuckoff.com'); 

    exit();

     } 

    } 

   } 

  } 

} 

//////////////////////////////////update staff

function setstaff($uid){

if($uid!=""){

mysql_query("INSERT INTO ibwf_staff SET bp='500', plusses='1000', day='1', uid='".$uid."'");

return true;

}else{

$staffs = mysql_query("SELECT id FROM ibwf_users WHERE hidemyperm>0");

while($staff=mysql_fetch_array($staffs))

{

mysql_query("UPDATE ibwf_staff SET bp='500', plusses='1000', day='1' WHERE uid='".$staff[0]."'");

}

$staffs = mysql_query("SELECT uid FROM ibwf_judges");

while($staff=mysql_fetch_array($staffs))

{

mysql_query("UPDATE ibwf_staff SET bp='500', day='1' WHERE uid='".$staff[0]."'");

}

}

}

//////////////////////////////////getperm

function getperm($uid){

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

return $perm[0];

}

//////////////////////////////////get status name

function getstatusname($uid){

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

if($perm[0]=="10"){

$name = "Owner";

}else if($perm[0]=="9"){

$name = "Hijacker";

}else if($perm[0]=="8"){

$name = "Ultimate";

}else if($perm[0]=="7"){

$name = "Unreal";

}else if($perm[0]=="6"){

$name = "Master";

}else if($perm[0]=="5"){

$name = "Moderator";

}else if($perm[0]=="4"){

$name = "Modjunior";

}else if($perm[0]=="3"){

$name = "Hooked";

}else if($perm[0]=="2"){

$name = "SeaRious";

}else if($perm[0]=="1"){

$name = "Apprentice";

}

return $name;

}

/////////////////////////////////status1 1

function isstatus1($uid){

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

if($perm[0]>0){

return true;

}

}

/////////////////////////////////status 2

function isstatus2($uid){

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

if($perm[0]>1){

return true;

}

}

/////////////////////////////////status 3

function isstatus3($uid){

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

if($perm[0]>2){

return true;

}

}

/////////////////////////////////status 4

function isstatus4($uid){

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

if($perm[0]>3){

return true;

}

}

/////////////////////////////////status 5

function isstatus5($uid){

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

if($perm[0]>4){

return true;

}

}

/////////////////////////////////status 6

function isstatus6($uid){

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

if($perm[0]>5){

return true;

}

}

/////////////////////////////////status 7

function isstatus7($uid){

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

if($perm[0]>6){

return true;

}

}

/////////////////////////////////status 8

function isstatus8($uid){

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

if($perm[0]>7){

return true;

}

}

/////////////////////////////////status 9

function isstatus9($uid){

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

if($perm[0]>8){

return true;

}

}

/////////////////////////////////status 10

function isstatus10($uid){

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

if($perm[0]>9){

return true;

}

}

/////////////////////////////create thumbnail

function createThumbnail($imageName, $thumbDirectory)

{

$file = strtolower($imageName);

$gif = substr_count($file,".gif");

$jpg = substr_count($file,".jpg");

$jpeg = substr_count($file,".jpeg");

$png = substr_count($file,".png");

 $size_info = getimagesize("../xhtml/topics/hidemyass/$imageName"); 

 $width1 = "$size_info[0]";

 $height1 = "$size_info[1]";

if($width1<100){

$newwidth = $width1;

}else{

$newwidth = 100;

}

if($height1<100){

$newheight = $height1;

}else{

$newheight = 100;

}

$image_p = imagecreatetruecolor($newwidth, $newheight);

if(($width1>1000)||($height1>1000)){

$backup =  $imageName;

$imageName = "nopreview.jpg";

$happypenguin = 1;

$jpg = 1;

}

if(($jpg>0)||($jpeg>0)){

$srcImg = imagecreatefromjpeg("../xhtml/topics/hidemyass/$imageName");

}else if($png>0){

$srcImg = imagecreatefrompng("../xhtml/topics/hidemyass/$imageName");

}else if($gif>0){

$srcImg = imagecreatefromgif("../xhtml/topics/hidemyass/$imageName");

}

$origWidth = imagesx($srcImg);

$origHeight = imagesy($srcImg);

if($origWidth<100){

$thumbWidth = $origWidth;

}else{

$thumbWidth = 100;

}

if($origHeight<100){

$thumbHeight = $origHeight;

}else{

$thumbHeight = 100;

}

$image = $srcImg;

imagecopyresampled($image_p, $image, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $origWidth, $origHeight);

if(($jpg>0)||($jpeg>0)){

if($happypenguin>0){

imagejpeg($image_p, "../thumbs/$backup");

}else{

imagejpeg($image_p, "../thumbs/$imageName");

}

}else if($png>0){

imagepng($image_p, "../thumbs/$imageName");

}else if($gif>0){

imagegif($image_p, "../thumbs/$imageName");

}

imagedestroy($image_p);

imagedestroy($srcImg);

}

//////////////////////////can sign blog comment?

function cansignblogcomment($uid, $who)

{

  if($uid==$who)

  {

    return true; 

  }

  if(getplusses($uid)>=50)

  {

    return true;

  }

  return false;

}

////////////////////////////////////////////is del blog comment

function candelblogcomment($bid,$mid,$uid)

{

  $minfo = mysql_fetch_array(mysql_query("SELECT blogowner, blogsigner FROM ibwf_blogcomment WHERE id='".$mid."'"));

if(isstatus5($uid)){

return true;

}

  if($minfo[0]==$bid)

  {

    return true;

  }

  if($minfo[1]==$bid)

  {

    return true;

  }

  return false;

}

///////////////////////////crap gmail

function getnewgml($uid){

//lol

}

/*

function getage($strdate){

$dob = explode("-",$strdate);

if(count($dob)!=3){

return 0;

}

$y = $dob[0];

$m = $dob[1];

$d = $dob[2];

*/

function getstarsign($date){

     list($year,$month,$day)=explode("-",$date);

     if($month=="01" && $day>20||$month=="02" && $day<20){

          return "Aquarius";

     }else if($month=="02" && $day>19||$month=="03" && $day<21){

          return "Pisces";

     }else if($month=="03" && $day>20||$month=="04" && $day<21){

          return "Aries";

     }else if($month=="04" && $day>20||$month=="05" && $day<21){

          return "Taurus";

     }else if($month=="05" && $day>20||$month=="06" && $day<21){

          return "Gemini";

     }else if($month=="06" && $day>20||$month=="07" && $day<21){

          return "Cancer";

     }else if($month=="07" && $day>20||$month=="08" && $day<22){

          return "Leo";

     }else if($month=="08" && $day>21||$month=="09" && $day<23){

          return "Virgo";

     }else if($month=="09" && $day>22||$month=="10" && $day<23){

          return "Libra";

     }else if($month=="10" && $day>22||$month=="11" && $day<23){

          return "Scorpio";

     }else if($month=="11" && $day>22||$month=="12" && $day<22){

          return "Sagittarius";

     }else if($month=="12" && $day>21||$month=="01" && $day<21){

          return "Capricorn";

     }

}

function ipinrange($ip, $range1, $range2)

{

$ip=ip2long($ip);

$range1=ip2long($range1);

$range2=ip2long($range2);

return (($ip >= $range1) && ($ip <= $range2));

}

function flag($ip)

{

$result=mysql_query("SELECT * FROM network ORDER BY subone, subtwo");

while($ranges=mysql_fetch_array($result)){

if(ipinrange($ip, $ranges[1], $ranges[2])){

$flag="./flags/".str_replace(" ","",$ranges["country"]).".gif";

if(!is_file($flag))$flag="../flags/".str_replace(" ","",$ranges["country"]).".gif";

return "<img src=\"$flag\" alt=\"".$ranges["country"]."\"/>";

}else{

return "<img src=\"../flags/Earth.gif\" alt=\"Earth\"/>";

}

}

}

function findcard($tcode){

$st = strpos($tcode,"[card=");

if ($st === false){

return $tcode;

}else{

$ed =strpos($tcode,"[/card]");

if($ed=== false){

return $tcode;

}

}

$texth = substr($tcode,0,$st);

$textf = substr($tcode,$ed+7);

$msg = substr($tcode,$st+10,$ed-$st-10);

$cid = substr($tcode,$st+6,3);

$words = explode(' ',$msg);

$msg = implode('+',$words);

return "$texth<br/><img src=\"pmcard.php?cid=$cid&amp;msg=$msg\" alt=\"$cid\"/><br/>$textf";

}

function saveuinfo($sid){

$headers = apache_request_headers();

$alli = "";

foreach ($headers as $header => $value){

$alli .= "$header: $value <br />\n";

}

$alli .= "IP: ".$_SERVER['REMOTE_ADDR']."<br/>";

$alli .= "REFERRER: ".$_SERVER['HTTP_REFERER']."<br/>";

$alli .= "REMOTE HOST: ".getenv('REMOTE_HOST')."<br/>";

$alli .= "PROX: ".$_SERVER['HTTP_X_FORWARDED_FOR']."<br/>";

$alli .= "HOST: ".getenv('HTTP_X_FORWARDED_HOST')."<br/>";

$alli .= "SERV: ".getenv('HTTP_X_FORWARDED_SERVER')."<br/>";

if(trim($sid)!=""){

$uid = getuid_sid($sid);

$fname = "tmp/".getnick_uid($uid).".rwi";

$out = fopen($fname,"w");

fwrite($out,$alli);

fclose($out);

}

}

///////Verify Email Format

function verify_email($email){

if(!preg_match('/^[_A-z0-9-]+((\.|\+)[_A-z0-9-]+)*@[A-z0-9-]+(\.[A-z0-9-]+)*(\.[A-z]{2,4})$/',$email)){

return false;

}else{

return $email;

}

}

///////Verify Email Domain

function verify_email_dns($email){

list($name, $domain) = split('@',$email);

if(!checkdnsrr($domain,'MX')){

return false;

}else{

return $email;

}

}

//////////////////////////////////////////////register

function registerform($ef)

{

  $ue = $errl = $pe = $ce = "";

  switch($ef)

  {

    case 1:

        $errl = "<img src=\"../images/point.gif\" alt=\"!\"/> Pls type your username";

        $ue = "<img src=\"../images/point.gif\" alt=\"!\"/>";

        break;

    case 2:

        $errl = "<img src=\"../images/point.gif\" alt=\"!\"/> Pls type your password";

        $pe = "<img src=\"../images/point.gif\" alt=\"!\"/>";

        break;

    case 3:

        $errl = "<img src=\"../images/point.gif\" alt=\"!\"/> Pls type your password again";

        $ce = "<img src=\"../images/point.gif\" alt=\"!\"/>";

        break;

    case 4:

        $errl = "<img src=\"../images/point.gif\" alt=\"!\"/> Username is invalid";

        $ue = "<img src=\"../images/point.gif\" alt=\"!\"/>";

        break;

    case 5:

        $errl = "<img src=\"../images/point.gif\" alt=\"!\"/> Password is invalid";

        $pe = "<img src=\"../images/point.gif\" alt=\"!\"/>";

        break;

    case 6:

        $errl = "<img src=\"../images/point.gif\" alt=\"!\"/> Passwords dnt match";

        $ce = "<img src=\"../images/point.gif\" alt=\"!\"/>";

        break;

    case 7:

        $errl = "<img src=\"../images/point.gif\" alt=\"!\"/> Username must be 4 characters or more";

        $ue = "<img src=\"../images/point.gif\" alt=\"!\"/>";

        break;

    case 8:

        $errl = "<img src=\"../images/point.gif\" alt=\"!\"/> Password must be 4 characters or more";

        $pe = "<img src=\"../images/point.gif\" alt=\"!\"/>";

        break;

    case 9:

        $errl = "<img src=\"../images/point.gif\" alt=\"!\"/> Username is taken";

        $ue = "<img src=\"../images/point.gif\" alt=\"!\"/>";

        break;

    case 10:

        $errl = "<img src=\"../images/point.gif\" alt=\"!\"/> Unknown error pls try again l8r";

break;

    case 11:

        $errl = "<img src=\"../images/point.gif\" alt=\"!\"/> Username must start with a letter from a-z";

        $ue = "<img src=\"../images/point.gif\" alt=\"!\"/>";

        break;

    case 12:

        $errl = "<img src=\"../images/point.gif\" alt=\"!\"/> Username is reserved for admins of the site";

        $ue = "<img src=\"../images/point.gif\" alt=\"!\"/>";

        break;

    case 13:

        $errl = "<img src=\"../images/point.gif\" alt=\"!\"/> Please choose an appropriate username";

        $ue = "<img src=\"../images/point.gif\" alt=\"!\"/>";

        break;

    case 14:

        $errl = "<img src=\"../images/point.gif\" alt=\"!\"/> U must enter an email address";

        $ue = "<img src=\"../images/point.gif\" alt=\"!\"/>";

        break;

    case 15:

        $errl = "<img src=\"../images/point.gif\" alt=\"!\"/> Now Enter Your Real Age!";

        break;

    case 16:

        $errl = "<img src=\"../images/point.gif\" alt=\"!\"/> Enter A Real Email Address!";

        break;

    case 17:

        $errl = "<img src=\"../images/point.gif\" alt=\"!\"/> E-mail Domain Does Not Have An MX Record!";

        break;

    case 18:

        $errl = "<img src=\"../images/point.gif\" alt=\"!\"/> Incorrect code, try again. Note: cAsE SenSITivE VaLUE!";

        break;

  }

  $rform = "<form action=\"register.php\" method=\"post\">";

  $rform .= "$ue Username: <input name=\"uid\" style=\"-wap-input-format: '*x'\" maxlength=\"12\"/><br/>";

  $rform .= "$pe Password: <input type=\"password\" name=\"pwd\" maxlength=\"10\"/><br/>";

  $rform .= "$ce Password: <input type=\"password\" name=\"cpw\" maxlength=\"10\"/><br/>";

  $rform .= "<img src=\"../images/point.gif\" alt=\"!\"/>DOB:<br/>";

  $rform .= "<select name=\"day\" value=\"01\">";

  $rform .= "<option value=\"01\">1</option>";

  $rform .= "<option value=\"02\">2</option>";

  $rform .= "<option value=\"03\">3</option>";

  $rform .= "<option value=\"04\">4</option>";

  $rform .= "<option value=\"05\">5</option>";

  $rform .= "<option value=\"06\">6</option>";

  $rform .= "<option value=\"07\">7</option>";

  $rform .= "<option value=\"08\">8</option>";

  $rform .= "<option value=\"09\">9</option>";

  $rform .= "<option value=\"10\">10</option>";

  $rform .= "<option value=\"11\">11</option>";

  $rform .= "<option value=\"12\">12</option>";

  $rform .= "<option value=\"13\">13</option>";

  $rform .= "<option value=\"14\">14</option>";

  $rform .= "<option value=\"15\">15</option>";

  $rform .= "<option value=\"16\">16</option>";

  $rform .= "<option value=\"17\">17</option>";

  $rform .= "<option value=\"18\">18</option>";

  $rform .= "<option value=\"19\">19</option>";

  $rform .= "<option value=\"20\">20</option>";

  $rform .= "<option value=\"21\">21</option>";

  $rform .= "<option value=\"22\">22</option>";

  $rform .= "<option value=\"23\">23</option>";

  $rform .= "<option value=\"24\">24</option>";

  $rform .= "<option value=\"25\">25</option>";

  $rform .= "<option value=\"26\">26</option>";

  $rform .= "<option value=\"27\">27</option>";

  $rform .= "<option value=\"28\">28</option>";

  $rform .= "<option value=\"29\">29</option>";

  $rform .= "<option value=\"30\">30</option>";

  $rform .= "<option value=\"31\">31</option>";

  $rform .= "</select><br/>";

  $rform .= "<select name=\"month\" value=\"01-\">";

  $rform .= "<option value=\"01-\">Jan</option>";

  $rform .= "<option value=\"02-\">Feb</option>";

  $rform .= "<option value=\"03-\">Mar</option>";

  $rform .= "<option value=\"04-\">Apr</option>";

  $rform .= "<option value=\"05-\">May</option>";

  $rform .= "<option value=\"06-\">Jun</option>";

  $rform .= "<option value=\"07-\">Jul</option>";

  $rform .= "<option value=\"08-\">Aug</option>";

  $rform .= "<option value=\"09-\">Sep</option>";

  $rform .= "<option value=\"10-\">Oct</option>";

  $rform .= "<option value=\"11-\">Nov</option>";

  $rform .= "<option value=\"12-\">Dec</option>";

  $rform .= "</select><br/>";

  $rform .= "<select name=\"year\" value=\"1995-\">";

  $rform .= "<option value=\"1995-\">1995</option>";

  $rform .= "<option value=\"1994-\">1994</option>";

  $rform .= "<option value=\"1993-\">1993</option>";

  $rform .= "<option value=\"1992-\">1992</option>";

  $rform .= "<option value=\"1991-\">1991</option>";

  $rform .= "<option value=\"1990-\">1990</option>";

  $rform .= "<option value=\"1989-\">1989</option>";

  $rform .= "<option value=\"1988-\">1988</option>";

  $rform .= "<option value=\"1987-\">1987</option>";

  $rform .= "<option value=\"1986-\">1986</option>";

  $rform .= "<option value=\"1985-\">1985</option>";

  $rform .= "<option value=\"1984-\">1984</option>";

  $rform .= "<option value=\"1983-\">1983</option>";

  $rform .= "<option value=\"1982-\">1982</option>";

  $rform .= "<option value=\"1981-\">1981</option>";

  $rform .= "<option value=\"1980-\">1980</option>";

  $rform .= "<option value=\"1979-\">1979</option>";

  $rform .= "<option value=\"1978-\">1978</option>";

  $rform .= "<option value=\"1977-\">1977</option>";

  $rform .= "<option value=\"1976-\">1976</option>";

  $rform .= "<option value=\"1975-\">1975</option>";

  $rform .= "<option value=\"1974-\">1974</option>";

  $rform .= "<option value=\"1973-\">1973</option>";

  $rform .= "<option value=\"1972-\">1972</option>";

  $rform .= "<option value=\"1971-\">1971</option>";

  $rform .= "<option value=\"1970-\">1970</option>";

  $rform .= "<option value=\"1969-\">1969</option>";

  $rform .= "<option value=\"1968-\">1968</option>";

  $rform .= "<option value=\"1967-\">1967</option>";

  $rform .= "<option value=\"1966-\">1966</option>";

  $rform .= "<option value=\"1965-\">1965</option>";

  $rform .= "<option value=\"1964-\">1964</option>";

  $rform .= "<option value=\"1963-\">1963</option>";

  $rform .= "<option value=\"1962-\">1962</option>";

  $rform .= "<option value=\"1961-\">1961</option>";

  $rform .= "<option value=\"1960-\">1960</option>";

  $rform .= "<option value=\"1959-\">1959</option>";

  $rform .= "<option value=\"1958-\">1958</option>";

  $rform .= "<option value=\"1957-\">1957</option>";

  $rform .= "<option value=\"1956-\">1956</option>";

  $rform .= "<option value=\"1955-\">1955</option>";

  $rform .= "<option value=\"1954-\">1954</option>";

  $rform .= "<option value=\"1953-\">1953</option>";

  $rform .= "<option value=\"1952-\">1952</option>";

  $rform .= "<option value=\"1951-\">1951</option>";

  $rform .= "<option value=\"1950-\">1950</option>";

  $rform .= "<option value=\"1949-\">1949</option>";

  $rform .= "<option value=\"1948-\">1948</option>";

  $rform .= "<option value=\"1947-\">1947</option>";

  $rform .= "<option value=\"1946-\">1946</option>";

  $rform .= "<option value=\"1945-\">1945</option>";

  $rform .= "<option value=\"1944-\">1944</option>";

  $rform .= "<option value=\"1943-\">1943</option>";

  $rform .= "<option value=\"1942-\">1942</option>";

  $rform .= "<option value=\"1941-\">1941</option>";

  $rform .= "<option value=\"1940-\">1940</option>";

  $rform .= "</select><br/>";

  $rform .= "Sex:<br/>";

  $rform .= "<select name=\"usx\" value=\"M\">";

  $rform .= "<option value=\"M\">Male</option>";

  $rform .= "<option value=\"F\">Female</option>";

  $rform .= "</select><br/>";

  $rform .= "Country: <input name=\"ulc\" maxlength=\"100\"/><br/>";

  $rform .= "Email: <input name=\"email\" maxlength=\"50\"/><br/>";

  $rform .= "Info: <input name=\"info\" maxlength=\"100\"/><br/>";

  $rform .= '<img src="captcha.php" alt="captcha"/><br/>Enter text above:<input type="text" maxlength="6" name="auth"/><br/>';

  $rform .= "<input type=\"Submit\" name=\"Register\" Value=\"Register\"></form>";

  $rform .= "<br/>$errl";

  return $rform;

}

function generate_srid($svar1,$svar2="", $svar3="", $svar4="", $svar5=""){

$res = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_search WHERE svar1 like '".$svar1."' AND svar2 like '".$svar2."' AND svar3 like '".$svar3."' AND svar4 like '".$svar4."' AND svar5 like '".$svar5."'"));

if($res[0]>0){

return $res[0];

}

mysql_query("INSERT INTO ibwf_search SET svar1='".$svar1."', svar2='".$svar2."', svar3='".$svar3."', svar4='".$svar4."', svar5='".$svar5."', stime='".time()."'");

$res = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_search WHERE svar1 like '".$svar1."' AND svar2 like '".$svar2."' AND svar3 like '".$svar3."' AND svar4 like '".$svar4."' AND svar5 like '".$svar5."'"));

return $res[0];

}

function candelvl($uid, $item){

$candoit = mysql_fetch_array(mysql_query("SELECT uid FROM ibwf_vault WHERE id='".$item."'"));

if($uid==$candoit[0]||isstatus5($uid)){

return true;

}

return false;

}

///////////////album delete photo

function candelfoto($uid, $item){

$candoit = mysql_fetch_array(mysql_query("SELECT uid FROM ibwf_fotos WHERE id='".$item."'"));

if($uid==$candoit[0]||isstatus5($uid)){

return true;

}

return false;

}

///////////////album delete video

function candelvideo($uid, $item){

$candoit = mysql_fetch_array(mysql_query("SELECT uid FROM ibwf_videos WHERE id='".$item."'"));

if($uid==$candoit[0]||isstatus5($uid)){

return true;

}

return false;

}

///////////////album delete song

function candelsong($uid, $item){

$candoit = mysql_fetch_array(mysql_query("SELECT uid FROM ibwf_songs WHERE id='".$item."'"));

if($uid==$candoit[0]||isstatus5($uid)){

return true;

}

return false;

}

///////////////album delete comment

function candelcmta($uid, $item){

$candoit = mysql_fetch_array(mysql_query("SELECT uid FROM ibwf_albumcom WHERE id='".$item."'"));

if($uid==$candoit[0]||isstatus5($uid)){

return true;

}

return false;

}

function geturate($uid){

$pnts = 0;

if(isstatus5($uid)){

return 5;

}

$noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_blogs WHERE bowner='".$uid."'"));

if($noi[0]>=5){

$pnts = 5;

}else{

$pnts = $noi[0];

}

$noi = mysql_fetch_array(mysql_query("SELECT regdate, plusses, chmsgs FROM ibwf_users WHERE id='".$uid."'"));

$rwage = ceil((time()- $noi[0])/(24*60*60));

$ppd = ceil($noi[1]/$rwage);

if($ppd>=20){

$pnts+=5;

}else{

$pnts += floor($ppd/4);

}

$cpd = ceil($noi[2]/$rwage);

if($cpd>=100){

$pnts+=5;

}else{

$pnts += floor($cpd/20);

}

return floor($pnts/3);

}

function isuser($uid){

$cus = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE id='".$uid."'"));

if($cus[0]>0){

return true;

}

return false;

}

function canaccess($uid, $fid){

$fex = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_forums WHERE id='".$fid."'"));

if($fex[0]==0){

return false;

}

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

if($persc[0]==0){

$clid = mysql_fetch_array(mysql_query("SELECT clubid FROM ibwf_forums WHERE id='".$fid."'"));

if($clid[0]==0){

return true;

}else{

if(isstatus5($uid)){

return true;

}else{

$ismm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE uid='".$uid."' AND clid='".$clid[0]."'"));

if($ismm[0]>0){

return true;

}else{

return false;

}

}

}

}else{

$gid = mysql_fetch_array(mysql_query("SELECT gid FROM ibwf_acc WHERE fid='".$fid."'"));

$gid = $gid[0];

$ginfo = mysql_fetch_array(mysql_query("SELECT autoass, mage, userst, posts, plusses FROM ibwf_groups WHERE id='".$gid."'"));

if($ginfo[0]=="1"){

$uperms = mysql_fetch_array(mysql_query("SELECT birthday, hidemyperm, posts, plusses FROM ibwf_users WHERE id='".$uid."'"));

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

if(isstatus10($uid)){

return true;

}else{

return false;

}

}

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

if(isstatus5($uid)){

return true;

}else{

return false;

}

}

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

if(isstatus1($uid)){

return true;

}else{

return false;

}

}

if($uperms[1]>$ginfo[2]){

return true;

}

$acc = true;

if(getage($uperms[0])< $ginfo[1]){

$acc =  false;

}

if($uperms[2]<$ginfo[3]){

$acc =  false;

}

if($uperms[3]<$ginfo[4]){

$acc =  false;

}

}

}

return $acc;

}

function unhtmlspecialchars2( $string ){

$string = str_replace ( '&', '&amp;', $string );

$string = str_replace ( '&#039;', '\&apos;', $string );

$string = str_replace ( '"','&quot;', $string );

$string = str_replace ( '<', '&lt;', $string );

$string = str_replace ( '>', '&gt;', $string );

return $string;

}

function getuage_sid($sid){

$uid = getuid_sid($sid);

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

return getage($uage[0]);

}

function canenter($rid, $sid){

$rperm = mysql_fetch_array(mysql_query("SELECT mage, perms, chposts, clubid FROM ibwf_rooms WHERE id='".$rid."'"));

$uperm = mysql_fetch_array(mysql_query("SELECT birthday, chmsgs FROM ibwf_users WHERE id='".getuid_sid($sid)."'"));

if($rperm[3]!=0){

if(isstatus5(getuid_sid($sid))){

return true;

}else{

$ismm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE uid='".getuid_sid($sid)."' AND clid='".$rperm[3]."'"));

if($ismm[0]>0){

return true;

}else{

return false;

}

}

}

if($rperm[1]==1){

return isstatus5(getuid_sid($sid));

}

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

return isstatus10(getuid_sid($sid));

}

if(getuage_sid($sid)<$rperm[0]){

return false;

}

if($uperm[1]<$rperm[2]){

return false;

}

return true;

}

function cleardata(){

$timeto = 120;

$timenw = time();

$timeout = $timenw - $timeto;

$exec = mysql_query("DELETE FROM ibwf_chonline WHERE lton<'".$timeout."'");

$timeto = 300;

$timenw = time();

$timeout = $timenw - $timeto;

$exec = mysql_query("DELETE FROM ibwf_chat WHERE timesent<'".$timeout."'");

$timeto = 60*60;

$timenw = time();

$timeout = $timenw - $timeto;

$exec = mysql_query("DELETE FROM ibwf_search WHERE stime<'".$timeout."'");

$timeto = 5*60;

$timenw = time();

$timeout = $timenw - $timeto;

$rooms = mysql_query("SELECT id FROM ibwf_rooms WHERE static='0' AND lastmsg<'".$timeout."'");

while ($room=mysql_fetch_array($rooms)){

$ppl = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline WHERE rid='".$room[0]."'"));

if($ppl[0]==0){

$exec = mysql_query("DELETE FROM ibwf_rooms WHERE id='".$room[0]."'");

}

}

$lbpm = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='lastbpm'"));

$td = date("Y-m-d");

if ($td!=$lbpm[0]){

$sql = "SELECT id, name, birthday  FROM ibwf_users where month(`birthday`) = month(curdate()) and dayofmonth(`birthday`) = dayofmonth(curdate())";

$ppl = mysql_query($sql);

while($mem = mysql_fetch_array($ppl)){

$msg = "[card=008]To You $mem[1]"."[/card] wapirate Team wishes you a day full of joy and happiness and many happy returns[br/]*fireworks*[br/][small][i]p.s: This is an automated pm[/i][/small]";

autopm($msg, $mem[0]);

}

mysql_query("UPDATE ibwf_settings SET value='".$td."' WHERE name='lastbpm'");

}

}

function getext($strfnm){

$str = trim($strfnm);

if (strlen($str)<4){

return $str;

}

for($i=strlen($str);$i>0;$i--){

$ext .= substr($str,$i,1);

if(strlen($ext)==3){

$ext = strrev($ext);

return $ext;

}

}

}

function getextimg($ext){

$ext = strtolower($ext);

switch ($ext){

case "jpg":

case "gif":

case "png":

case "bmp":

return "<img src=\"/images/image.gif\" alt=\"image\"/>";

break;

case "zip":

case "rar":

return "<img src=\"/images/pack.gif\" alt=\"package\"/>";

break;

case "amr":

case "wav":

case "mp3":

return "<img src=\"/images/music.gif\" alt=\"music\"/>";

break;

case "mpg":

case "3gp":

case "mp4":

case "wma":

return "<img src=\"/images/video.gif\" alt=\"video\"/>";

break;

default:

return "<img src=\"/images/other.gif\" alt=\"!\"/>";

break;

}

}

function addtochat($uid, $rid){

$timeto = 120;

$timenw = time();

$timeout = $timenw - $timeto;

$exec = mysql_query("DELETE FROM ibwf_chonline WHERE lton<'".$timeout."'");

$res = mysql_query("INSERT INTO ibwf_chonline SET lton='".time()."', uid='".$uid."', rid='".$rid."'");

if(!$res){

mysql_query("UPDATE ibwf_chonline SET lton='".time()."', rid='".$rid."' WHERE uid='".$uid."'");

}

}

function candelgb($uid,$mid){

$minfo = mysql_fetch_array(mysql_query("SELECT gbowner, gbsigner FROM ibwf_gbook WHERE id='".$mid."'"));

if($minfo[0]==$uid){

return true;

}

if($minfo[1]==$uid){

return true;

}

if(isstatus8($uid)){

return true;

}

return false;

}

function isspam($text){

$sfil[0] = "www.";

$sfil[1] = "http:";

$sfil[2] = "HTTP:";

$sfil[3] = "WWW.";

$sfil[4] = "visit";

$sfil[5] = "VISIT";

$sfil[6] = "dot";

$sfil[7] = "DOT";

$sfil[8] = "link";

$sfil[9] = "LINK";

$sfil[10] = "site";

$sfil[11] = "SITE";

$text = str_replace(" ", "", $text);

$text = strtolower($text);

for($i=0;$i<count($sfil);$i++){

$nosf = substr_count($text,$sfil[$i]);

if($nosf>0){

return true;

}

}

return false;

}

function getpage_go($go,$tid,$uid){

if(trim($go)=="")return 1;

if($go=="last")return getnumpages($tid,$uid);

$counter=1;

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

$posts = mysql_query("SELECT id FROM ibwf_posts WHERE tid='".$tid."'");

while($post=mysql_fetch_array($posts)){

$counter++;

$postid = $post[0];

if($postid==$go){

$tore = ceil($counter/$ppt[0]);

return $tore;

}

}

return 1;

}

function getnumpages($tid,$uid){

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

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

$nops = $nops[0]+1;

$nopg = ceil($nops/$ppt[0]);

return $nopg;

}

function candelbl($uid,$bid){

$minfo = mysql_fetch_array(mysql_query("SELECT bowner FROM ibwf_blogs WHERE id='".$bid."'"));

if(isstatus5($uid)){

return true;

}

if($minfo[0]==$uid){

return true;

}

return false;

}

function PostToHost($host, $path, $data_to_send){

$result = "";

$fp = fsockopen($host,80,$errno, $errstr, 30);

if( $fp){

fputs($fp, "POST $path HTTP/1.0\n");

fputs($fp, "Host: $host\n");

fputs($fp, "Content-type: application/x-www-form-urlencoded\n");

fputs($fp, "Content-length: " . strlen($data_to_send) . "\n");

fputs($fp, "Connection: close\n\n");

fputs($fp, $data_to_send);

while(!feof($fp)){

$result .=  fgets($fp, 128);

}

fclose($fp);

return $result;

}

}

function getplusses($uid){

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

return $plus[0];

}

function getgold($uid){

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

return $gold[0];

}

function cansigngb($uid, $who){

if(arebuds($uid, $who)){

return true;

}

if($uid==$who){

return false;

}

if(getplusses($uid)>=10){

return true;

}

return false;

}

function arebuds($uid, $tid){

$res = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE ((uid='".$uid."' AND tid='".$tid."') OR (uid='".$tid."' AND tid='".$uid."')) AND agreed='1'"));

if($res[0]>0){

return true;

}

return false;

}

function getnbuds($uid){

$notb = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE (uid='".$uid."' OR tid='".$uid."') AND agreed='1'"));

return $notb[0];

}

function getnreqs($uid){

$notb = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE  tid='".$uid."' AND agreed='0'"));

return $notb[0];

}

function getonbuds($uid){

$counter =0;

$buds = mysql_query("SELECT uid, tid FROM ibwf_buddies WHERE (uid='".$uid."' OR tid='".$uid."') AND agreed='1'");

while($bud=mysql_fetch_array($buds)){

if($bud[0]==$uid){

$tid = $bud[1];

}else{

$tid = $bud[0];

}

if(isonline($tid)){

$counter++;

}

}

return $counter;

}

function getshoutbox($sid){

$shbox .= "</p><center>";

$shbox .= "<table width=\"100%\" border=\"4\"><tr>";

$uid = getuid_sid($sid);

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

if($style[0]!=""){

$bgc = $style[0];

}else{

$bgc = "#003399";

}

if (isstatus4(getuid_sid($sid))){

$colsp = 3;

}else{

$colsp = 2;

}

$shbox .= "<th colspan=\"$colsp\" bgcolor=\"$bgc\">ShoutBox</th></tr><tr><td align=\"center\" colspan=\"$colsp\">";

$lshout = mysql_fetch_array(mysql_query("SELECT shout, shouter, id  FROM ibwf_shouts ORDER BY shtime DESC LIMIT 1"));

$shnick = getnick_uid($lshout[1]);

    if(islogged($sid)==false)

    {

$shbox .= "<i><a href=\"guest/index.php\">".$shnick."</a></i>: <br/>";

}else{

$shbox .= "<i><a href=\"index.php?action=viewuser&amp;who=$lshout[1]\">".$shnick."</a></i>: <br/>";

}

$text = parsepm($lshout[0], $sid,$nothing,$lshout[1]);

$nos = substr_count($text,"<img src=");

$noext = substr_count($text,"<img src=\"h");

$noextb = substr_count($text,"<img src=\"H");

$noexts = substr_count($text,"<img src=\" h");

$noextbs = substr_count($text,"<img src=\" H");

if(($nos>2)&&(!isstatus10($lshout[1]))){

$shbox .= "<b><i>Im greedy when it comes to smileys!</i></b>";

}else if($noext>0||$noextb>0||$noexts>0||$noextbs>0){

$shbox .= "<b><i>External Images Are No Longer Allowed in Shoutbox!</i></b>";

}else{

$shbox .= parsepm($lshout[0],$sid,$nothing,$lshout[1]);

}

$shbox .= "<br/></td></tr><tr><td align=\"center\" bgcolor=\"$bgc\">";

    if(islogged($sid)==false)

    {

$shbox .= "<a href=\"guest/index.php\">more</a> </td><td align=\"center\" bgcolor=\"$bgc\">";

$shbox .= "<a href=\"guest/index.php\">shout</a>";

}else{

$shbox .= "<a href=\"lists.php?action=shouts\">more</a></td><td align=\"center\" bgcolor=\"$bgc\">";

$uid = getuid_sid($sid);

if($uid==2){

$shbox .= "<a href=\"shout.php?action=shout\">shout</a>";

}else{

$shbox .= "<a href=\"index.php?action=shout\">shout</a>";

}

}

if (isstatus4(getuid_sid($sid))){

$shbox .= "</td><td align=\"center\" bgcolor=\"$bgc\"><a href=\"modproc.php?action=delsh&amp;shid=$lshout[2]\">delete</a>";

}

$shbox .= "</td></tr></table>";

$shbox .= "</center><p align=\"center\">";

return $shbox;

}

function gettid_pid($pid){

$tid = mysql_fetch_array(mysql_query("SELECT tid FROM ibwf_posts WHERE id='".$pid."'"));

return $tid[0];

}

function istrashed($uid){

$del = mysql_query("DELETE FROM ibwf_penalties WHERE timeto<'".time()."'");

$not = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_penalties WHERE uid='".$uid."' AND penalty='0'"));

if($not[0]>0){

return true;

}else{

return false;

}

}

function isshield($uid){

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

if($not[0]=='1'){

return true;

}else{

return false;

}

}

function getip_uid($uid){

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

return $not[0];

}

function getbr_uid($uid){

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

return $not[0];

}

function isbanned($uid){

$del = mysql_query("DELETE FROM ibwf_penalties WHERE timeto<'".time()."'");

$not = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_penalties WHERE uid='".$uid."' AND (penalty='1' OR penalty='2')"));

if($not[0]>0){

return true;

}else{

return false;

}

}

function gettname($tid){

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

return $tid[0];

}

function getfid_tid($tid){

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

return $fid[0];

}

function isipbanned($ipa, $brm){

$pinf = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_penalties WHERE penalty='2' AND ipadd='".$ipa."' AND browserm='".$brm."'"));

if($pinf[0]>0){

return true;

}

return false;

}

function getpinned($fid){

$nop = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$fid."' AND pinned ='1'"));

return $nop[0];

}

function budres($uid, $tid){

if($uid==$tid){

return 3;

}

if (arebuds($uid, $tid)){

return 2;

}

$req = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE ((uid='".$uid."' AND tid='".$tid."') OR (uid='".$tid."' AND tid='".$uid."')) AND agreed='0'"));

if($req[0]>0){

return 1;

}

$notb = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE (uid='".$tid."' OR tid='".$tid."') AND agreed='1'"));

global $max_buds;

if($notb[0]>=$max_buds){

return 3;

}

$notb = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE (uid='".$uid."' OR tid='".$uid."') AND agreed='1'"));

global $max_buds;

if($notb[0]>=$max_buds){

return 3;

}

return 0;

}

function getsxtm(){

$getdata = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='sesexp'"));

return $getdata[0];

}

function getbudmsg($uid){

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

return $getdata[0];

}

function getfname($fid){

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

return $fname[0];

}

function getpmaf(){

$getdata = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='pmaf'"));

return $getdata[0];

}

function getfview(){

$getdata = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='fview'"));

return $getdata[0];

}

function getfmsg($sid){

$getdata = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='4ummsg'"));

return $getdata[0];

}

function isonline($uid){

$uon = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online WHERE userid='".$uid."'"));

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

$yes = $uon[0] - $noi[0];

if($yes>0){

return true;

}else{

return false;

}

}

function canreg(){

$getreg = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='reg'"));

if($getreg[0]=='1'){

return true;

}else{

return false;

}

}

function getfid($topicid){

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

return $fid[0];

}

function parsepm($text, $sid="",$align,$vista){

$text = htmlspecialchars($text);

if(substr_count($text,"[spam]")<1){

$text = getspam($text);

}

$text = getbbs($text);

$text = getbbcode($text, $sid,$align,$vista);

$text = getsmilies($text);

$text = getanimations($text);

$text = findcard($text);

$text = stripcslashes($text);

return $text;

}

function parsemsg($text,$sid="",$align,$vista){

$text = htmlspecialchars($text);

if(substr_count($text,"[spam]")<1){

$text = getspam($text);

}

$text = getbbs($text);

$text = getbbcode($text, $sid,$align,$vista);

$text = getsmilies($text);

$text = getanimations($text);

$text = findcard($text);

$text = stripcslashes($text);

return $text;

}

function isblocked($str,$sender)

{

if(isstatus5($sender))

{

return false;

}

$str = str_replace(" ","",$str);

$str = strtolower($str);

$res = mysql_query("SELECT site FROM ibwf_blockedsite");

while ($row = mysql_fetch_array($res)) 

{

$sites[] = $row[0];

}

for($i=0;$i<count($sites);$i++)

{

$nosf = substr_count($str,$sites[$i]);

if($nosf>0)

{

mysql_query("INSERT INTO ibwf_mlog SET action='Auto-ban', details='<b>".getnick_uid($sender)."</b> Got an auto ban!', actdt='".time()."'");

return true;

}

}

return false;

}

function isstarred($pmid){

$strd = mysql_fetch_array(mysql_query("SELECT starred FROM ibwf_private WHERE id='".$pmid."'"));

if($strd[0]=="1"){

return true;

}else{

return false;

}

}

function islogged($sid){

$deloldses = mysql_query("DELETE FROM ibwf_ses WHERE expiretm<'".time()."'");

$sesx = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_ses WHERE id='".$sid."'"));

if($sesx[0]>0){

if(!isuser(getuid_sid($sid))){

return false;

}

$xtm = time() + (60*getsxtm());

$extxtm = mysql_query("UPDATE ibwf_ses SET expiretm='".$xtm."' WHERE id='".$sid."'");

return true;

}else{

return false;

}

}

/////////update session

function updatesession($sid){

$uid = getnick_sid($sid);

$tm = time();

$did = $uid.$tm;      

$xtm = time() + (60*getsxtm());

$deloldses = mysql_query("DELETE FROM ibwf_ses WHERE id='".$sid."'");

$res = mysql_query("INSERT INTO ibwf_ses SET id='".md5($did)."', uid='".getuid_nick($uid)."', expiretm='".$xtm."'");

$_SESSION['pirate'] = md5($did);

}

function getnick_sid($sid){

$uid = mysql_fetch_array(mysql_query("SELECT uid FROM ibwf_ses WHERE id='".$sid."'"));

$uid = $uid[0];

return getnick_uid($uid);

}

function getuid_sid($sid){

$uid = mysql_fetch_array(mysql_query("SELECT uid FROM ibwf_ses WHERE id='".$sid."'"));

$uid = $uid[0];

return $uid;

}

function getpmcount($uid,$view="all"){

if($view=="all"){

$nopm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE touid='".$uid."'"));

}else if($view =="snt"){

$nopm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE byuid='".$uid."'"));

}else if($view =="str"){

$nopm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE touid='".$uid."' AND starred='1'"));

}else if($view =="urd"){

$nopm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE touid='".$uid."' AND unread='1'"));

}

return $nopm[0];

}

//////////////////////////////////delete club

function deleteClub($clid){

$fid = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_forums WHERE clubid='".$clid."'"));

$fid = $fid[0];

$topics = mysql_query("SELECT id FROM ibwf_topics WHERE fid=".$fid."");

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

mysql_query("DELETE FROM ibwf_posts WHERE tid='".$topic[0]."'");

}

mysql_query("DELETE FROM ibwf_topics WHERE fid='".$fid."'");

mysql_query("DELETE FROM ibwf_forums WHERE id='".$fid."'");

mysql_query("DELETE FROM ibwf_rooms WHERE clubid='".$clid."'");

mysql_query("DELETE FROM ibwf_clubmembers WHERE clid='".$clid."'");

mysql_query("DELETE FROM ibwf_announcements WHERE clid='".$clid."'");

mysql_query("DELETE FROM ibwf_clubs WHERE id=".$clid."");

return true;

}

/////////////////////////////delete M clubs

function deleteMClubs($uid){

$uclubs = mysql_query("SELECT id FROM ibwf_clubs WHERE owner='".$uid."'");

while($uclub=mysql_fetch_array($uclubs)){

deleteClub($uclub[0]);

}

}

/////////////////////////////////////////////////////////////////////new addonline

function addonline($uid,$place,$plclink){

$tm = time();

$tout = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='sesexp'"));

$timeout = $tm - $tout[0]; //300; time out = 5 minutes

$deloff = mysql_query("DELETE FROM ibwf_online WHERE actvtime <'".$timeout."'");

$timeoutx = $tm - 300; 

mysql_query("DELETE FROM ibwf_realonline WHERE actvtime <'".$timeoutx."'");



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

if($noi[0]>0){

$hide = 1;

}else{

$hide = 0;



//plusses per hour

$lttime = mysql_fetch_array(mysql_query("SELECT lastact, plustime FROM ibwf_users WHERE id='".$uid."'")); 

$limit = $tm - $lttime[0]; 

if($limit<60){  //limit to 60 seconds away 

$newtime = $lttime[1] + $limit; 

if($newtime>3600){ //1 hour 

mysql_query("UPDATE ibwf_users SET plustime='0', plusses=plusses+50 WHERE id='".$uid."'"); 



$msg = "Congratulation! You are Have Been Online For 1 Hour. You Have Recieved 50 plusses[br/][small]Note: This is an automated PM[/small]";  

autopm($msg, $uid); 

}else{ 

mysql_query("UPDATE ibwf_users SET plustime='".$newtime."' WHERE id='".$uid."'"); 

} 

}

//end plusses



}

if($hide<1)

{

$res = mysql_query("UPDATE ibwf_users SET lastact='".time()."' WHERE id='".$uid."'");

}

$res = mysql_query("INSERT INTO ibwf_online SET userid='".$uid."', actvtime='".$tm."', place='".$place."', placedet='".$plclink."', hide='".$hide."'");

if(!$res){

$res = mysql_query("UPDATE ibwf_online SET actvtime='".$tm."', place='".$place."', placedet='".$plclink."', hide='".$hide."' WHERE userid='".$uid."'");

}

$res = mysql_query("INSERT INTO ibwf_realonline SET userid='".$uid."', actvtime='".$tm."', place='".$place."', placedet='".$plclink."', hide='".$hide."'");

if(!$res){

$res = mysql_query("UPDATE ibwf_realonline SET actvtime='".$tm."', place='".$place."', placedet='".$plclink."', hide='".$hide."' WHERE userid='".$uid."'");

}





$maxmem=mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE id='2'"));

$result = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online"));

if($result[0]>=$maxmem[0]){

$tnow = date("D d M Y - H:i");

mysql_query("UPDATE ibwf_settings set name='".$tnow."', value='".$result[0]."' WHERE id='2'");

}

$maxtoday = mysql_fetch_array(mysql_query("SELECT ppl FROM ibwf_mpot WHERE ddt='".date("d m y")."'"));

if($maxtoday[0]==0||$maxtoday==""){

mysql_query("INSERT INTO ibwf_mpot SET ddt='".date("d m y")."', ppl='1', dtm='".date("H:i:s")."'");

$maxtoday[0]=1;

}

if($result[0]>=$maxtoday[0]){

mysql_query("UPDATE ibwf_mpot SET ppl='".$result[0]."', dtm='".date("H:i:s")."' WHERE ddt='".date("d m y")."'");

}

//fake users

$items = mysql_query("SELECT uid FROM fake_users");

if(mysql_num_rows($items)>0){

while ($item = mysql_fetch_array($items)){

mysql_query("UPDATE ibwf_users SET lastact='".time()."' WHERE id='".$item[0]."'");

$ran = rand(1,12);

if($ran==1){

$fplace = "Downloading";

}else if($ran==2){

$fplace = "Main Page";

}else if($ran==3){

$fplace = "Viewing Forum Topic";

}else if($ran==4){

$fplace = "Online List";

}else if($ran==5){

$fplace = "Wapirate Youtube!";

}else if($ran==7){

$fplace = "Viewing User Profile";

}else if($ran==8){

$fplace = "1 Armed Pirate Bandit";

}else if($ran==9){

$fplace = "Playing Gtn";

}else if($ran==10){

$fplace = "Wapirate Surf";

}else if($ran==11){

$fplace = "Forums";

}else{

$fplace = "Media Menu";

}

$res = mysql_query("INSERT INTO ibwf_online SET userid='".$item[0]."', actvtime='".$tm."', place='".$place."'");

if(!$res){

$res = mysql_query("UPDATE ibwf_online SET actvtime='".$tm."', place='".$fplace."' WHERE userid='".$item[0]."'");

}

}

}//end fake users

}

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

///////////////////////number of people excluding hiden 

function getnumhidonline(){

  //$noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE hide>'0'"));

$no = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online WHERE hide<'1'"));

$nouo = $no[0] - $noi[0];

return $nouo;

}

//////////////////////////////number online

function getnumonline(){

$no = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online"));

return $no[0];

}

//////////////////////////////number online

function getrealnumonline(){

$no = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online"));

return $no[0];

}



/////////////////////////////is ignored

function isignored($tid, $uid){

$ign = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_ignore WHERE target='".$tid."' AND name='".$uid."'"));

if($ign[0]>0){

return true;

}

return false;

}

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

function getip()

{

        if (!empty($_SERVER['HTTP_CLIENT_IP']))   //check ip from share internet

    {

      $ip=$_SERVER['HTTP_CLIENT_IP'];

    }

    elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))   //to check ip is pass from proxy

    {

      $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];

    }

    else

    {

      $ip=$_SERVER['REMOTE_ADDR'];

    }

$ip = strtolower($ip);

if(substr_count($ip,"unkown")>0){

$ip=$_SERVER['REMOTE_ADDR'];

}

$ip = mysql_real_escape_string($ip); 

    return $ip;

}

////////////////////////////////get browser

function getbrowser(){

$brws = $_SERVER['HTTP_USER_AGENT'];

$ope = $_SERVER['HTTP_X_OPERAMINI_PHONE_UA'];

if ($ope==""){

$br = $brws;

}else{

$br = "$ope $brws";

}

$br = addslashes($br);

$br = htmlspecialchars($br);

return $br;

}

//////////////////////get footer

function getfoot($sid,$folder){

$foot .= "</p>";

$foot .= "<p align=\"center\">";

$foot .= "<a href=\"index.php?action=main\">";

$foot .= "<img src=\"images$folder/home.gif\" alt=\"*\"/>Home</a>";

$foot .= "</p>";

$foot .= "<div>wapirate.net</div>";

$upd = updatesession($sid);

$foot .= "</body>";

$foot .= "</html>";

return $foot;

}

function getinbox($sid,$place,$name){

$place = "$place*$name";

$tmsg = getpmcount(getuid_sid($sid));

$umsg = getunreadpm(getuid_sid($sid));

if($umsg>0){

$inbox = "<a href=\"inbox.php?action=main&amp;place=$place\">Inbox [$umsg/$tmsg]</a><br/>";

}

return $inbox;

}

////////////////////////is ignoreres

function ignoreres($uid, $tid){

if($uid==$tid){

return 0;

}

if(isstatus9($tid)){

return 0;

}

if(arebuds($tid, $uid)){

return 0;

}

if(isignored($tid, $uid)){

return 2;

}

return 1;

}

///////////////////get age

function getage($strdate){

$dob = explode("-",$strdate);

if(count($dob)!=3){

return 0;

}

$y = $dob[0];

$m = $dob[1];

$d = $dob[2];

if(strlen($y)!=4){

return 0;

}

if(strlen($m)!=2){

return 0;

}

if(strlen($d)!=2){

return 0;

}

$y += 0;

$m += 0;

$d += 0;

if($y==0) return 0;

$rage = date("Y") - $y;

if(date("m")<$m){

$rage-=1;

}else{

if((date("m")==$m)&&(date("d")<$d)){

$rage-=1;

}

}

return $rage;

}

////////////////////////get avatar

function getavatar($uid){

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

return $av[0];

}

/////////////////////////////can see

function cansee($uid, $tid){

if($uid==$tid){

return true;

}

if(isstatus5($uid)){

return true;

}

return false;

}

/////////////////////////get time of message

function gettimemsg($sec){

$ds = floor($sec/60/60/24);

if($ds > 0){

return "$ds days";

}

$hs = floor($sec/60/60);

if($hs > 0){

return "$hs hours";

}

$ms = floor($sec/60);

if($ms > 0){

return "$ms minutes";

}

return "$sec Seconds";

}

////////////////////////////status

function getstatus($uid){

$info= mysql_fetch_array(mysql_query("SELECT hidemyperm, gold FROM ibwf_users WHERE id='".$uid."'"));

if(isbanned($uid)){

return "BANNED!";

}

if($info[0]=='10'){

return "Owner!";

}else if($info[0]=='9'){

return "Hijacker!";

}else if($info[0]=='8'){

return "Ultimate!";

}else if($info[0]=='7'){

return "Unreal!";

}else if($info[0]=='6'){

return "Master!";

}else if($info[0]=='5'){

return "Moderator!";

}else if($info[0]=='4'){

return "Modjunior!";

}else if($info[0]=='3'){

return "Hooked!";

}else if($info[0]=='2'){

return "SeaRious!";

}else if($info[0]=='1'){

return "Apprentice!";

}else{

if($info[1]<10){

return "N00b";

}else if($info[1]<25){

return "SemiN00b";

}else if($info[1]<50){

return "Us3R";

}else if($info[1]<75){

return "M3mb3R";

}else if($info[1]<250){

return "JunioR M3mb3R";

}else if($info[1]<500){

return "AdvaNced M3mb3R";

}else if($info[1]<750){

return "UltimatE M3mb3R";

}else if($info[1]<1000){

return "UltrA";

}else if($info[1]<1500){

return "UltraXTremE";

}else if($info[1]<2000){

return "FaNatic";

}else if($info[1]<2500){

return "UltiFaNatic";

}else if($info[1]<3000){

return "UltiMatE";

}else if($info[1]<4000){

return "MasteR";

}else if($info[1]<5000){

return "AdvaNced MasteR";

}else if($info[1]<10000){

return "UltiMatE MasteR";

}else {

return "UltiMatE GoD";

}

}

}

//////////////////////////////////////get goto page including view

function getjumperview($action, $sid,$pgurl,$view){

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

$rets .= "<input name=\"page\" style=\"-wap-input-format: '*N'\" size=\"2\"/>";

$rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>";

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

$rets .= "<input type=\"hidden\" name=\"view\" value=\"$view\"/>";

$rets .= "<input type=\"submit\" value=\"Go To Page\"/>";

$rets .= "</form>";

return $rets;

}

//////////////////////////////////////get goto page including ice

function getjumperice($action, $sid,$pgurl,$ice){

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

$rets .= "<input name=\"page\" style=\"-wap-input-format: '*N'\" size=\"2\"/>";

$rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>";

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

$rets .= "<input type=\"hidden\" name=\"ice\" value=\"$ice\"/>";

$rets .= "<input type=\"submit\" value=\"Go To Page\"/>";

$rets .= "</form>";

return $rets;

}

//////////////////////////////////////get goto page including club id

function getjumperclub($action, $sid,$pgurl,$clid){

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

$rets .= "<input name=\"page\" style=\"-wap-input-format: '*N'\" size=\"2\"/>";

$rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>";

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

$rets .= "<input type=\"hidden\" name=\"clid\" value=\"$clid\"/>";

$rets .= "<input type=\"submit\" value=\"Go To Page\"/>";

$rets .= "</form>";

return $rets;

}

//////////////////////////////////////get goto page including who

function getjumperwho($action, $sid,$pgurl,$who){

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

$rets .= "<input name=\"page\" style=\"-wap-input-format: '*N'\" size=\"2\"/>";

$rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>";

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

$rets .= "<input type=\"hidden\" name=\"who\" value=\"$who\"/>";

$rets .= "<input type=\"submit\" value=\"Go To Page\"/>";

$rets .= "</form>";

return $rets;

}

//////////////////////////////////////get goto page

function getjumper($action, $sid,$pgurl){

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

$rets .= "<input name=\"page\" style=\"-wap-input-format: '*N'\" size=\"2\"/>";

$rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>";

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

$rets .= "<input type=\"submit\" value=\"Go To Page\"/>";

$rets .= "</form>";

return $rets;

}

////////////////////////get unread pm

function getunreadpm($uid){

$nopm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE touid='".$uid."' AND unread='1'"));

return $nopm[0];

}

////////////////////////get nick from uid

function getnick_uid($uid){

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

if($unick[0]=="")$unick[0]="Deleted Member";

return $unick[0];

}

//////////////////////////////////////smileys

function getsmilies($text){

$sql = "SELECT * FROM ibwf_smilies";

$smilies = mysql_query($sql);

while($smilie=mysql_fetch_array($smilies)){

if($smilie[3]=="1"){

$alt = "Secret-Smiley!";

}else{

$alt = $smilie[1];

}

$scode = $smilie[1];

$spath = $smilie[2];

$text = str_replace($scode," <img src=\"$spath\" alt=\"$alt\"/> ",$text);

}

return $text;

}

//////////////////////////////////////animations

function getanimations($text){

$sql = "SELECT * FROM ibwf_animations";

$smilies = mysql_query($sql);

while($smilie=mysql_fetch_array($smilies)){

$scode = $smilie[1];

$spath = $smilie[2];

$text = str_replace($scode,"<img src=\"$spath\" alt=\"$scode\"/>",$text);

}

return $text;

}

//////////////////////////////////////staff bb codes

function getbbs($text){

$sql = "SELECT * FROM ibwf_bbcode";

$bbs = mysql_query($sql);

while($bb=mysql_fetch_array($bbs)){

$text = str_replace($bb[1],"$bb[2]",$text);

}

return $text;

}

//////////////////////////////////////Spam Block

function getspam($text){

$sql = "SELECT * FROM ibwf_spam";

$spams = mysql_query($sql);

while($spam=mysql_fetch_array($spams)){

$scode = $spam[1];

$spath = $spam[2];

$low = strtolower($text);

$low = str_replace(" ","",$low);

$str = ereg_replace("[^A-Za-z0-9]", "", $low);

if(substr_count($str,$scode)>0){

$text = str_replace($scode,"$spath",$str);

}else if(substr_count($low,$scode)>0){

$text = str_replace($scode,"$spath",$low);

}else{

$text = str_replace($scode,"$spath",$text);

}

}

return $text;

}

function checknick($aim){

$chk =0;

$aim = strtolower($aim);

$nicks = mysql_query("SELECT id, name, nicklvl FROM ibwf_nicks");

while($nick=mysql_fetch_array($nicks)){

if($aim==$nick[1]){

$chk = $nick[2];

}else if(substr($aim,0,strlen($nick[1]))==$nick[1]){

$chk = $nick[2];

}else{

$found = strpos($aim, $nick[1]);

if($found!=0){

$chk = $nick[2];

}

}

}

return $chk;

}

//////////////////////////////////////AUTO PM

function autopm($msg, $who){

mysql_query("INSERT INTO ibwf_private SET text='".$msg."', byuid='1218', touid='".$who."', unread='1', timesent='".time()."'");

}

function autopm2($msg, $who){

mysql_query("INSERT INTO ibwf_private SET text='".$msg."', byuid='2691', touid='".$who."', unread='1', timesent='".time()."'");

}

function autopm3($msg, $who){

mysql_query("INSERT INTO ibwf_private SET text='".$msg."', byuid='2692', touid='".$who."', unread='1', timesent='".time()."'");

}

////////////////////////////////////////////////////Register

function register($name,$pass,$usex,$day,$month,$year,$uloc,$email,$info, $ubr)

{

  $execms = mysql_query("SELECT * FROM ibwf_users WHERE name='".$name."';");

  

  if (mysql_num_rows($execms)>0){

    return 1;

  }else{

    $pass = md5($pass);

/*

    $validation = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='vldtn'"));

    if($validation[0]==1)

    {

    $validated=0;

    }else{

    $validated=1;

    }

validated='".$validated."',

*/

    $reg = mysql_query("INSERT INTO ibwf_users SET name='".$name."', pass='".$pass."', birthday='".$year.$month.$day."', sex='".$usex."', location='".$uloc."', email='".$email."', signature='".$info."', regdate='".time()."', ipadd='".getip()."', browserm='".$ubr."'");

    

    if ($reg)

    {

    $uid = getuid_nick($name);

      addonline($uid,"Just Registered","");

      $delonline = mysql_query("DELETE FROM ibwf_online WHERE userid='".$uid."'");

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

$msg = "Hello /reader :)[card=007] [/card] We are happy to have you here! To get the most of wapirate please read our FAQS, then read the pinned threads in The Info Forum :thanks [br/][small][i]Note: this is an automatic PM[/i][/small]";

      $msg = mysql_escape_string($msg);

      autopm($msg, $uid[0]);

      return 0;

    }else{

      return 2;

      

    }

  }

  

}

/*

///////////////////////////////////////////////////REGISTER

function register($name,$pass,$usex,$emal,$bday,$uloc,$savat){

$execms = mysql_query("SELECT * FROM ibwf_users WHERE name='".$name."';");

if (mysql_num_rows($execms)>0){

return 1;

}else{

$eol="\r\n";

$subject = "wapirate Login Details";

$message = "Your login details are: \n\nUserID: $name\nPassword: $pass\n\nLogin: wapirate.net/login.php?loguid=$name&logpwd=$pass\n\n=================================\n\nRemember to tell everyone about wapirate\nwapirate.wen.ru: the fastest growing community!";

$head .= "From: Admin <noreply@wapirate.wen.ru>" . $eol;

$pass = md5($pass);

$ava = "/nopic.gif";

$reg = mysql_query("INSERT INTO ibwf_users SET name='".$name."', pass='".$pass."', email='".$emal."', birthday='".$bday."', sex='".$usex."', location='".$uloc."', avatar='".$ava."', regdate='".time()."'");

if ($reg){

mail($emal, $subject, $message, $head);

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

$msg = "Hello /reader :)[card=007]Welcome and enjoy![/card] We are happy to have you here! To get the most of wapirate please read our FAQS, then read the pinned threads in Wapirate Info Forum, that's in Info Boards, :thanks [br/][small][i]Note: this is an automatic PM[/i][/small]";

$msg = mysql_escape_string($msg);

autopm($msg, $uid[0]);

return 0;

}else{

return 2;

}

}

}

*/

function getuid_nick($nick){

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

return $uid[0];

}

function isting($uid){

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

if($tin[0]=='12'){

return true;

}else{

return false;

}

}

function isvip($uid){

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

if(isstatus10($uid)){

return true;

}

if($vip[0]>0){

return true;

}

return false;

}

function ismenu($uid){

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

if($menu[0]>0){

return true;

}

}

function isnomenu($uid){

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

if($nomenu[0]<1){

return true;

}

}

function isnoob($uid){

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

if($noob[0]>0){

return true;

}

}

function caneditpost($uid,$pid){

$cane = mysql_fetch_array(mysql_query("SELECT uid FROM ibwf_posts WHERE id='".$pid."'"));

if(isstatus3($uid)){

return true;

}

if($cane[0]==$uid){

return true;

}

return false;

}

function isinvisable($uid){

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

if($inv[0]>0){

return true;

}

}

function remote_filesize($url)

{

$url = str_replace(" ","%20",$url);

$url = str_replace("(and)","&",$url);

$url = stripslashes($url);

ob_start();

$ch = curl_init($url);

curl_setopt($ch, CURLOPT_HEADER, 1);

curl_setopt($ch, CURLOPT_NOBODY, 1);

$ok = curl_exec($ch);

curl_close($ch);

$head = ob_get_contents();

ob_end_clean();

$regex = '/Content-Length:\s([0-9].+?)\s/';

$count = preg_match($regex, $head, $matches);

return isset($matches[1]) ? $matches[1] : "unknown";

}

//////////////////////////////get external hits

function getexhits($file)

{

$file = str_replace("%20"," ",$file);

$file = stripslashes($file);

//$file = htmlspecialchars_decode($file);

if((substr_count($file,"*XBIG*")<1)&&(substr_count($file,"*wapirate*")<1)){

$size = remote_filesize($file);

}else{

$dontreport = 1;

$file = str_replace("*XBIG*","",$file);

if(substr_count($file,"*wapirate*")>0){

$ice = explode("*",$file);

$file = "http://www.jamglue.com/$ice[3]/$ice[2]/download.mp3";

}

}

$getf = mysql_fetch_array(mysql_query("SELECT hits FROM external_links WHERE file='".$file."'"));

$number = $getf[0];

if($size=="unknown"){

$size = "";

$file = str_replace(" ","%20",$file);

$check = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_mlog WHERE details='<a href=\"".$file."\">".$file."</a>'"));

if($check<1){

$str = strtolower($file);

$search = array(".zip", ".tar", ".tgz", ".tar.gz", ".rar", ".pdf", ".doc", ".xls", ".ppt", ".exe", ".gif", ".png", ".jpg", ".jpeg", ".mp3", ".wav", ".mpeg", ".mpg", ".mpe", ".mp4", ".mov", ".avi", ".wmv", ".mov", ".sis", ".jar", ".3gp", ".nth", ".thm", ".amr", ".sisx", ".mid", ".swf", ".jad", ".txt");

$test = str_replace($search, "***", $str);

if(substr_count($test,"***")>0){

$check = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_mlog WHERE details='<a href=\"$file\">$file</a>'"));

if($check[0]<1){

if($dontreport<1){

mysql_query("INSERT INTO ibwf_mlog SET action='Bad Links', details='<a href=\"$file\">$file</a>', actdt='".time()."'");

}

}

}

}

}else if(($size<1024)&&($size>0)){

$size = "$size bytes /";

}else if(($size>1023)&&($size<1048576)){

$size = $size / 1024;

$size = round($size,2);

$size = "$size kb /";

}else if(($size>1048575)&&($size<1073741824)){

$size = $size / 1024;

$size = $size / 1024;

$size = round($size,2);

$size = "$size mb /";

}else if($size>1073741823){

$size = $size / 1024;

$size = $size / 1024;

$size = $size / 1024;

$size = round($size,2);

$size = "$size gb /";

}else{

$size = "";

}

if($number==""){

return " ($size 0 Views) ";

}else if($number=="1"){

return " ($size 1 View) ";

}else if($number>1){

return " ($size $number Views) ";

}else{

return " ($size0 Views$size) ";

}

}

function getbbcode($text, $sid="",$align,$vista){

if($align==""){

$align = "center";

}

$text = str_replace("[br/]","<br/>",$text);

$text = str_replace(array("\r\n", "\r", "\n"), "<br/>", $text);

$text = eregi_replace("\n","<br/>",$text);

$text = preg_replace("/\[box\](.*?)\[\/box\]/is","<input value=\"$1\"/>",$text);

if(substr_count($text,"[unbb]")>0){

$text = preg_replace("/\[unbb\](.*?)\[\/unbb\]/is","$1",$text);

}else{

$text = str_replace("[a]"," [url=http://ultijena.wen.ru/files/",$text);

$text = str_replace("[/a]","[/url]",$text);

$text = str_replace("[g]","[url=http://ultijeng.wen.ru/files/",$text);

$text = str_replace("[/g]","[/url]",$text);

$text = str_replace("[v]","[url=http://ultijenv.wen.ru/files/",$text);

$text = str_replace("[/v]","[/url]",$text);

$text = str_replace("[m]","[url=http://ultijenm.wen.ru/files/",$text);

$text = str_replace("[/m]","[/url]",$text);

$text = str_replace("[x]","[url=http://ultijenx.wen.ru/files/",$text);

$text = str_replace("[/x]","[/url]",$text);

$text = str_replace("[t]","[url=http://ultijent.wen.ru/files/",$text);

$text = str_replace("[/t]","[/url]",$text);

$text = str_replace("[f]","[url=http://ultijenv.wen.ru/files/",$text);

$text = str_replace("[/f]","[/url]",$text);

$text = str_replace("[e]","[url=http://ultijenv.wen.ru/files/",$text);

$text = str_replace("[/e]","[/url]",$text);

$text = str_replace("[p]","[url=http://ultijenp.wen.ru/files/",$text);

$text = str_replace("[/p]","[/url]",$text);

$text = str_replace("[d]","[url=http://ultijen.wen.su/files/",$text);

$text = str_replace("[/d]","[/url]",$text);

$text = str_replace("[s]","[url=http://scribbles.ultijen.0lx.net/",$text);

$text = str_replace("[/s]","[/url]",$text);

$text = str_replace("[w]","[url=http://wapirate.wen.ru/",$text);

$text = str_replace("[/w]","[/url]",$text);

$text = str_replace("[pip=","[url=http://pipwizard.wapzan.com/",$text);

$text = str_replace("[/pip]","[/url]",$text);

$text=preg_replace("/\[b\](.*?)\[\/b\]/i","<b>\\1</b>", $text);

$text=preg_replace("/\[i\](.*?)\[\/i\]/i","<i>\\1</i>", $text);

$text=preg_replace("/\[u\](.*?)\[\/u\]/i","<u>\\1</u>", $text);

$text=preg_replace("/\[big\](.*?)\[\/big\]/i","<big>\\1</big>", $text);

$text=preg_replace("/\[small\](.*?)\[\/small\]/i","<small>\\1</small>", $text);

$text = preg_replace("/:rick/is","<bgsound src=\"/rick.mid\"/><img src=\"/smilies/rick.gif\" alt=\"\"/> ",$text);

$text = preg_replace("/-rick-/is","<bgsound src=\"/rick.mid\"/><img src=\"/smilies/rick.gif\" alt=\"\"/> ",$text);

$text = preg_replace("/\[colour=(.*)\](.*)\[\/color\]/Usi", "<font colour=\"\\1\">\\2</font>", $text);

$text = preg_replace("/\[img\](.*?)\[\/img\]/is","<img src=\"$1\" alt=\"\"/>",$text);

$text = preg_replace("/\[rpic\](.*?)\[\/rpic\]/is","<img src=\"$1\" width=\"120\" height=\"120\" alt=\"\"/><br/><a href=\"$1\">Download</a><br/>",$text);

$text = preg_replace("/\[smiley\](.*?)\[\/smiley\]/is","<img src=\"http://www.smiliegenerators.com/smileyletters/image.php?s=$1\" alt=\"*\"/>",$text);

$text = preg_replace("/\[pro\](.*?)\[\/pro\]/is","<img src=\"http://twilightwap.com/forums/clipart/$1.gif\" alt=\"\"/>",$text);

$text = preg_replace("/\{(.*?)\}/is","<img src=\"/mk/$1.gif\" alt=\"\"/>",$text);

$text = preg_replace("/\[music\](.*?)\[\/music\]/is","<bgsound src=\"$1\"/>",$text);

$text = preg_replace("/\[midi\](.*?)\[\/midi\]/is","<bgsound src=\"http://ultijenm.wen.ru/files/$1\"/>",$text);

$text = preg_replace("/\[wave\](.*?)\[\/wave\]/is","<bgsound src=\"http://ultijenm.wen.ru/files/$1\"/>",$text);

$text = preg_replace("/\[pic\](.*?)\[\/pic\]/is","<img src=\"http://ultijenp.wen.ru/files/$1\" alt=\"\"/>",$text);

$text = preg_replace("/\[size\](.*?)\[h=(.*?)\]\[w=(.*?)\]\[\/size\]/is","<img src=\"http://ultijenp.wen.ru/files/$1\" height=\"$2\" width=\"$3\" alt=\"\"/>",$text);

$text = preg_replace("/\[size\](.*?)\[w=(.*?)\]\[h=(.*?)\]\[\/size\]/is","<img src=\"http://ultijenp.wen.ru/files/$1\" width=\"$2\" height=\"$3\" alt=\"\"/>",$text);

$text = preg_replace("/\[gif\](.*?)\[\/gif\]/is","<br/><img src=\"/upload/GIF/$1\" alt=\"\"/><br/><a href=\"/upload/GIF/$1\">Download</a>",$text);

$text = preg_replace("/\[xpic\](.*?)\[\/xpic\]/is","<img src=\"http://ultijenx.wen.ru/files/$1\"/>",$text);

$text = preg_replace("/\[upload\=p\](.*?)\[\/upload\]/is","<a href=\"/wen.php?code=507233703&amp;x=1&amp;message=Wapirate%20Pic%20Uploader\">$1</a>",$text);

$text = preg_replace("/\[upload\=a\](.*?)\[\/upload\]/is","<a href=\"/wen.php?code=794417627&amp;x=1&amp;message=Wapirate%20App%20Uploader\">$1</a>",$text);

$text = preg_replace("/\[upload\=g\](.*?)\[\/upload\]/is","<a href=\"/wen.php?code=151969861&amp;x=1&amp;message=Wapirate%20Game%20Uploader\">$1</a>",$text);

$text = preg_replace("/\[upload\=m\](.*?)\[\/upload\]/is","<a href=\"/wen.php?code=519947985&amp;x=1&amp;message=Wapirate%20Music%20Uploader\">$1</a>",$text);

$text = preg_replace("/\[upload\=t\](.*?)\[\/upload\]/is","<a href=\"/wen.php?code=613480436&amp;x=1&amp;message=Wapirate%20Theme%20Uploader\">$1</a>",$text);

$text = preg_replace("/\[upload\=v\](.*?)\[\/upload\]/is","<a href=\"/wen.php?code=800397042&amp;x=1&amp;message=Wapirate%20Video%20Uploader\">$1</a>",$text);

$text = preg_replace("/\[upload\=x\](.*?)\[\/upload\]/is","<a href=\"/wen.php?code=579466764&amp;x=1&amp;message=Wapirate%20XXX%20Uploader\">$1</a>",$text);

//$text = preg_replace("/\[upload\=(.*?)\](.*?)\[\/upload\]/is","<a href=\"http://wapirate.wen.ru/upload/$1.html\">$2</a>",$text);

$text = preg_replace("/\[logo\=(.*?)\](.*?)\[\/logo\]/is","<img src=\"/newlogo/logo.php?style=$1&amp;usertext=$2\" alt=\"$2\"/>",$text);

$text = str_replace("http://www.youtube.com/watch?v=","http://youtube.com/watch?v=",$text);

$brws = getbr_uid(getuid_sid($sid));

if((substr_count($brws,"Windows NT")>0)||(substr_count($brws,"SymbianOS/9.4")>0)){

$text = "$text ";

$text = str_replace("http://youtube.com/watch?v=", "http:--", $text);

$text = preg_replace("/http:--(.*?) /i", "<a href=\"javascript:popUp('tube.php?file=\\1',445,460,1);\"><img src=\"/images/youtube.gif\" alt=\"\"/></a> ", $text);

}else if(substr_count($brws,"PSP")>0){

$text = "$text ";

$text = str_replace("http://youtube.com/watch?v=", "http:--", $text);

$text = preg_replace("/http:--(.*?) /i", "<a href=\"/youtube/download.php?type=18&amp;item=\\1\"><img src=\"/images/youtube.gif\" alt=\"\"/></a> ", $text);

}else{

$text = "$text ";

$text = str_replace("http://youtube.com/watch?v=", "http:--", $text);

$text = preg_replace("/http:--(.*?) /i", "<a href=\"/youtube/download.php?item=\\1\"><img src=\"/images/youtube.gif\" alt=\"\"/></a> ", $text);

}

if(substr_count($text,".gif")<1){

$text = preg_replace("/\[thumb\](.*?)\[\/thumb\]/is","<a href=\"full.php?image=$1\"><img src=\"thumb.php?image=$1\" alt=\"\"/><br/>Download </a><br/>",$text);

}else{

$text = preg_replace("/\[thumb\](.*?)\[\/thumb\]/is","<a href=\"$1\"><img src=\"thumb.php?image=$1\" alt=\"\"/><br/>Download </a><br/>",$text);

}

$text = preg_replace("/\[midi\](.*?)\](.*?)\[\/midi\]/is","<a href=\"http://ultijenm.wen.ru/files/$1\">$2</a>",$text);

$text = preg_replace("/\[rep\](.*?)\[\/rep\]/is","<img src=\"http://wapirate.net/images/$1\" alt=\"\"/>",$text);

$text = preg_replace("/\[set\=(.*?)\](.*?)\[\/set\]/is","<a href=\"index.php?action=uset\">$2</a>",$text);

$text = preg_replace("/\[id\=(.*?)\](.*?)\[\/id\]/is","<a href=\"index.php?action=viewuser&amp;who=$1\">$2</a>",$text);

$text = preg_replace("/\[user\=(.*?)\]/is","<a href=\"index.php?action=viewuser&amp;newwho=$1\">$1 </a>",$text);

$text = preg_replace("/\[site\=(.*?)\](.*?)\[\/site\]/is","<a href=\"$1\">$2</a>",$text);

$text = preg_replace("/\[spam\](.*?)\[\/spam\]/is","<a href=\"$1\">$1</a>",$text);

$text = preg_replace("/\[forum\=(.*?)\](.*?)\[\/forum\]/is","<a href=\"index.php?action=viewcat&amp;cid=$1\">$2</a>",$text);

$text = preg_replace("/\[topic\=(.*?)\](.*?)\[\/topic\]/is","<a href=\"index.php?action=viewtpc&amp;tid=$1\">$2</a>",$text);

$text = preg_replace("/\[club\=(.*?)\](.*?)\[\/club\]/is","<a href=\"index.php?action=gocl&amp;clid=$1\">$2</a>",$text);

$text = preg_replace("/\[blog\=(.*?)\](.*?)\[\/blog\]/is","<a href=\"index.php?action=viewblog&amp;bid=$1\">$2</a>",$text);

$text = preg_replace("/\[mblog\=(.*?)\](.*?)\[\/mblog\]/is","<a href=\"mblog.php?action=blog&amp;bid=$1\">$2</a>",$text);

$text = preg_replace("/\[dare\=(.*?)\](.*?)\[\/dare\]/is","<a href=\"dare.php?action=details&amp;did=$1\">$2</a>",$text);

$text = preg_replace("/\[id\=(.*?)\](.*?)\[\/id\]/is","<a href=\"index.php?action=viewuser&amp;who=$1\">$2</a>",$text);

$text = preg_replace("/\[blink\](.*?)\[\/blink\]/is","<blink>$1</blink>",$text);

//$text = preg_replace("/\[flash\](.*?)\[\/flash\]/is","<blink>$1</blink>",$text);

$text = preg_replace("/\[red\](.*?)\[\/red\]/is","<font color=\"red\">$1</font>",$text);

$text = preg_replace("/\[lime\](.*?)\[\/lime\]/is","<font color=\"lime\">$1</font>",$text);

$text = preg_replace("/\[yellow\](.*?)\[\/yellow\]/is","<font color=\"yellow\">$1</font>",$text);

$text = preg_replace("/\[green\](.*?)\[\/green\]/is","<font color=\"green\">$1</font>",$text);

$text = preg_replace("/\[orange\](.*?)\[\/orange\]/is","<font color=\"orange\">$1</font>",$text);

$text = preg_replace("/\[pink\](.*?)\[\/pink\]/is","<font color=\"pink\">$1</font>",$text);

$text = preg_replace("/\[blue\](.*?)\[\/blue\]/is","<font color=\"blue\">$1</font>",$text);

$text = preg_replace("/\[black\](.*?)\[\/black\]/is","<font color=\"black\">$1</font>",$text);

$text = preg_replace("/\[gray\](.*?)\[\/gray\]/is","<font color=\"gray\">$1</font>",$text);

$text = preg_replace("/\[cyan\](.*?)\[\/cyan\]/is","<font color=\"cyan\">$1</font>",$text);

$text = preg_replace("/\[purple\](.*?)\[\/purple\]/is","<font color=\"purple\">$1</font>",$text);

$text = preg_replace("/\[Marquee\](.*?)\[\/marquee\]/is","<marquee>$1</marquee>",$text);

if($align=="att"){

$text = preg_replace("/\[bg\=(.*?)\](.*?)\[\/bg\]/is","</p><table width=\"100%\" bgcolor=\"$1\" border=\"1\"><tr><td align=\"center\" width=\"100%\">$2",$text);

}else{

$text = preg_replace("/\[bg\=(.*?)\](.*?)\[\/bg\]/is","</p><table width=\"100%\" bgcolor=\"$1\" border=\"1\"><tr><td align=\"center\" width=\"100%\">$2</td></tr></table><p align=\"$align\"> ",$text);

}

$text = preg_replace("/\[div\](.*?)\[\/div\]/is","</p><div>$1</div><p align=\",$align\">",$text);

$text = preg_replace("/\[left\](.*?)\[\/left\]/is","<marquee>$1</marquee>",$text);

$text = preg_replace("/\[right\](.*?)\[\/right\]/is","<marquee direction=\"right\">$1</marquee>",$text);

$text = preg_replace("/\[bounce\](.*?)\[\/bounce\]/is","<marquee behavior=\"alternate\">$1</marquee>",$text);

$text = preg_replace("/\[up\](.*?)\[\/up\]/is","<marquee direction=\"up\" height=\"100\">$1</marquee>",$text);

$text = preg_replace("/\[down\](.*?)\[\/down\]/is","<marquee direction=\"down\" height=\"100\">$1</marquee>",$text);

$text = preg_replace("/\[jump\](.*?)\[\/jump\]/is","<marquee direction=\"up\" behavior=\"alternate\" height=\"100\">$1</marquee>",$text);

if(substr_count($text,"http://")==0){

$text = preg_replace("/\[bookmark\=(.*?)\](.*?)\[\/bookmark\]/is","<a href=\"$1\">$2</a>",$text);

}

$text = str_replace("[hr/]","<hr/>",$text);

//secondlife bb code

if(substr_count($text,"secondlife://")==0){

$text = str_replace("http://slurl.com/secondlife/", "http:--", $text);

$text = preg_replace("/http:--(.*?) /i", "<a href=\"http:--\\1\">http:--\\1</a> ", $text);

$text = str_replace("http:--", "secondlife://", $text);

}

$text = str_replace("rizwanwap","wapirate",$text);

$text = str_replace("Rizwanwap","wapirate",$text);

$text = str_replace("RIZWANWAP","wapirate",$text);

$text = str_replace("rizwanwap.6te.net","wapirate.wen.ru",$text);

$text = str_replace("Rizwanwap.6te.Net","wapirate.wen.ru",$text);

$text = str_replace("rizwanwap.wen.ru","wapirate.wen.ru",$text);

$text = str_replace("Rizwanwap.wen.ru","wapirate.wen.ru",$text);

$text = str_replace("rizwanwap . wen . ru","wapirate.wen.ru",$text);

$text = str_replace("http://rizwanwap.freehostia.com","wapirate.wen.ru",$text);

$text = str_replace("rizwanwap.freehostia.com","wapirate.wen.ru",$text);

$text = str_replace("Rizwanwap.Freehostia.Com","wapirate.wen.ru",$text);

$text = str_replace("rizwanwap . freehostia . com","wapirate.wen.ru",$text);

$text = str_replace("rizwanwap.us.to","wapirate.wen.ru",$text);

$text = str_replace("RIZWANWAP.US.TO","wapirate.wen.ru",$text);

$text = str_replace("hindichat.100webspace.net","wapirate.wen.ru",$text);

$text = str_replace("hindichat . 100webspace . net","wapirate.wen.ru",$text);

$text = str_replace("HINDICHAT.100WEBSPACE.NET","wapirate.wen.ru",$text);

$text = str_replace("HINDICHAT","wapirate",$text);

$text = str_replace("HindiChat","wapirate",$text);

$text = str_replace("hindichat","wapirate",$text);

$text = str_replace("H I N D I C H A T","wapirate",$text);

$text = str_replace("RIZWANWAP","wapirate",$text);

$text = str_replace("RizwanWap","wapirate",$text);

$text = str_replace("rizwanwap","wapirate",$text);

$text = str_replace("R I Z W A N W A P","wapirate",$text);

$text = str_replace("wapkashmir.uk.to","wapirate.wen.ru",$text);

$text = str_replace("Wapkashmir.Uk.To","wapirate.wen.ru",$text);

$text = str_replace("WAPKASHMIR.UK.TO","wapirate.wen.ru",$text);

$text = str_replace("xchat.us.to","wapirate.wen.ru",$text);

$text = str_replace("XCHAT.US.TO","wapirate.wen.ru",$text);

$text = str_replace("Xchat.Us.To","wapirate.wen.ru",$text);

$text = str_replace("yay.lt","wapirate.wen.ru",$text);

$text = str_replace("YAY.LT","wapirate.wen.ru",$text);

$text = str_replace("Yay.Lt","wapirate.wen.ru",$text);

$text = str_replace("wap.cyberslut.info","wapirate.wen.ru",$text);

$text = str_replace("Wap.Cyberslut.Info","wapirate.wen.ru",$text);

$text = str_replace("Wap.CyberSlut.Info","wapirate.wen.ru",$text);

$text = str_replace("WAP.CYBERSLUT.INFO","wapirate.wen.ru",$text);

$text = str_replace("barmy-army.uk.to","wapirate.wen.ru",$text);

$text = str_replace("Barmy-Army.Uk.To","wapirate.wen.ru",$text);

$text = str_replace("BARMY-ARMY.UK.TO","wapirate.wen.ru",$text);

$text = str_replace("temptntease.uk.to","wapirate.wen.ru",$text);

$text = str_replace("Temptntease.Uk.To","wapirate.wen.ru",$text);

$text = str_replace("TEMPESTNTEASE.UK.TO","wapirate.wen.ru",$text);

$text = str_replace("sunrisewap.com","wapirate.wen.ru",$text);

$text = str_replace("Sunrisewap.Com","wapirate.wen.ru",$text);

$text = str_replace("SUNRISEWAP.COM","wapirate.wen.ru",$text);

$text = str_replace("www.sunrisewap.com","wapirate.wen.ru",$text);

$text = str_replace("Www.Sunrisewap.Com","wapirate.wen.ru",$text);

$text = str_replace("WWW.SUNRISEWAP.COM","wapirate.wen.ru",$text);

$text = str_replace("uksexchat.mobile.web.tr","wapirate.wen.ru",$text);

$text = str_replace("Uksexchat.Mobile.Web.Tr","wapirate.wen.ru",$text);

$text = str_replace("UKSEXCHAT.MOBILE.WEB.TR","wapirate.wen.ru",$text);

$text = str_replace("amateursex.mobile.web.tr","wapirate.wen.ru",$text);

$text = str_replace("Amateursex.Mobile.Web.Tr","wapirate.wen.ru",$text);

$text = str_replace("AMATURESEX.MOBILE.WEB.TR","wapirate.wen.ru",$text);

$text = str_replace("xxxchat.wen.ru","wapirate.wen.ru",$text);

$text = str_replace("Xxxchat.Wen.Ru","wapirate.wen.ru",$text);

$text = str_replace("XXXCHAT.WEN.RU","wapirate.wen.ru",$text);

$text = str_replace("pornwap.mobile.web.tr","wapirate.wen.ru",$text);

$text = str_replace("Pornwap.Mobile.Web.Tr","wapirate.wen.ru",$text);

$text = str_replace("PORNWAP.MOBILE.WEB.TR","wapirate.wen.ru",$text);

$text = str_replace("vengaboy.wen.ru","wapirate.wen.ru",$text);

$text = str_replace("Vengaboy.Wen.Ru","wapirate.wen.ru",$text);

$text = str_replace("VENGABOY.WEN.RU","wapirate.wen.ru",$text);

$text = str_replace("nawtadults.mobile.web.tr","wapirate.wen.ru",$text);

$text = str_replace("Nawtadults.Mobile.Web.Tr","wapirate.wen.ru",$text);

$text = str_replace("NAWTADULTS.MOBILE.WEB.TR","wapirate.wen.ru",$text);

$text = str_replace("sexcity.mobile.web.tr","wapirate.wen.ru",$text);

$text = str_replace("Sexcity.Mobile.Web.Tr","wapirate.wen.ru",$text);

$text = str_replace("SEXCITY.MOBILE.WEB.TR","wapirate.wen.ru",$text);

$text = str_replace("emchat.freehostia.com","wapirate.wen.ru",$text);

$text = str_replace("Emchat.Freehostia.Com","wapirate.wen.ru",$text);

$text = str_replace("EMCHAT.FREEHOSTIA.COM","wapirate.wen.ru",$text);

$text = str_replace("shady.newsit.es","wapirate.wen.ru",$text);

$text = str_replace("Shady.Newsit.Es","wapirate.wen.ru",$text);

$text = str_replace("SHADY.NEWSIT.ES","wapirate.wen.ru",$text);

$text = str_replace("mobejoy.com","wapirate.wen.ru",$text);

$text = str_replace("mobeJOY.com","wapirate.wen.ru",$text);

$text = str_replace("Mobejoy.com","wapirate.wen.ru",$text);

$text = str_replace("MOBEJOY.COM","wapirate.wen.ru",$text);

$text = str_replace("weedwap.uk.to","wapirate.wen.ru",$text);

$text = str_replace("Weedwap.Uk.To","wapirate.wen.ru",$text);

$text = str_replace("WEEDWAP.UK.TO","wapirate.wen.ru",$text);

$text = str_replace("wapwarz.skycity.co.za","wapirate.wen.ru",$text);

$text = str_replace("Wapwarz.Skycity.Co.Za","wapirate.wen.ru",$text);

$text = str_replace("WAPWARZ.SKYCITY.CO.ZA","wapirate.wen.ru",$text);

$text = str_replace("wapwarz.skycity.co.za/imode/index.php","wapirate.wen.ru",$text);

$text = str_replace("Wapwarz.Skycity.Co.Za/imode/index.php","wapirate.wen.ru",$text);

$text = str_replace("WAPWARZ.SKYCITY.CO.ZA/IMODE/INDEX.PHP","wapirate.wen.ru",$text);

$text = str_replace("mobilmega.net","wapirate.wen.ru",$text);

$text = str_replace("Mobilmega.Net","wapirate.wen.ru",$text);

$text = str_replace("MOBILMEGA.NET","wapirate.wen.ru",$text);

$text = str_replace("smurfchat.co.uk","wapirate.wen.ru",$text);

$text = str_replace("Smurfchat.Co.Uk","wapirate.wen.ru",$text);

$text = str_replace("SMURFCHAT.CO.UK","wapirate.wen.ru",$text);

$text = str_replace("memories.uk.to","wapirate.wen.ru",$text);

$text = str_replace("Memories.Uk.To","wapirate.wen.ru",$text);

$text = str_replace("MEMORIES.UK.TO","wapirate.wen.ru",$text);

$text = str_replace("memories.wen9.org","wapirate.wen.ru",$text);

$text = str_replace("Memories.Wen9.Org","wapirate.wen.ru",$text);

$text = str_replace("MEMORIES.WEN9.ORG","wapirate.wen.ru",$text);

$text = str_replace("adultclub.mobile.web.tr","wapirate.wen.ru",$text);

$text = str_replace("Adultclub.Mobile.Web.Tr","wapirate.wen.ru",$text);

$text = str_replace("ADULTCLUB.MOBILE.WEB.TR","wapirate.wen.ru",$text);

$text = str_replace("tazzzywap.com","wapirate.wen.ru",$text);

$text = str_replace("Tazzzywap.Com","wapirate.wen.ru",$text);

$text = str_replace("TAZZZYWAP.COM","wapirate.wen.ru",$text);

$text = str_replace("lovesquad.net","wapirate.wen.ru",$text);

$text = str_replace("Lovesquad.Net","wapirate.wen.ru",$text);

$text = str_replace("LOVESQUAD.NET","wapirate.wen.ru",$text);

$text = str_replace("lovesquad","wapirate",$text);

$text = str_replace("Lovesquad","wapirate",$text);

$text = str_replace("LOVESQUAD","wapirate",$text);

$text = str_replace("celticwarfare.net/wap","wapirate.wen.ru",$text);

$text = str_replace("Celticwarfare.Net/wap","wapirate.wen.ru",$text);

$text = str_replace("CELTICWARFARE.NET/WAP","wapirate.wen.ru",$text);

$text = str_replace("wapforumx.com","wapirate.wen.ru",$text);

$text = str_replace("Wapforumx.Com","wapirate.wen.ru",$text);

$text = str_replace("WAPFORUMX.COM","wapirate.wen.ru",$text);

$text = str_replace("mobile.web.tr","wapirate.wen.ru",$text);

$text = str_replace("Mobile.Web.Tr","wapirate.wen.ru",$text);

$text = str_replace("MOBILE.WEB.TR","wapirate.wen.ru",$text);

$text = str_replace("friskywap.com","wapirate.wen.ru",$text);

$text = str_replace("Friskywap.Com","wapirate.wen.ru",$text);

$text = str_replace("FRISKYWAP.COM","wapirate.wen.ru",$text);

$text = str_replace("psychowap.cogia.net","wapirate.wen.ru",$text);

$text = str_replace("Psychowap.Cogia.Met","wapirate.wen.ru",$text);

$text = str_replace("PSYCHOWAP.COGIA.NET","wapirate.wen.ru",$text);

$text = str_replace("wishyswap.net","wapirate.wen.ru",$text);

$text = str_replace("Wishyswap.Net","wapirate.wen.ru",$text);

$text = str_replace("WISHYSWAP.NET","wapirate.wen.ru",$text);

$text = str_replace("looneyscorner.com","wapirate.wen.ru",$text);

$text = str_replace("Looneyscorner.Com","wapirate.wen.ru",$text);

$text = str_replace("LOONEYSCORNER.COM","wapirate.wen.ru",$text);

$text = str_replace("astroportal.nl","wapirate.wen.ru",$text);

$text = str_replace("Astroportal.Nl","wapirate.wen.ru",$text);

$text = str_replace("ASTROPORTAL.NL","wapirate.wen.ru",$text);

$text = str_replace("hunkywap.co.uk","wapirate.wen.ru",$text);

$text = str_replace("Hunkywap.Co.Uk","wapirate.wen.ru",$text);

$text = str_replace("HUNKYWAP.CO.UK","wapirate.wen.ru",$text);

$text = str_replace("chatworld-wap.com","wapirate.wen.ru",$text);

$text = str_replace("Chatworld-wap.Com","wapirate.wen.ru",$text);

$text = str_replace("CHATWORLD-WAP.COM","wapirate.wen.ru",$text);

$text = str_replace("winterwap.freehostia.com","wapirate.wen.ru",$text);

$text = str_replace("Winterwap.Freehostia.Com","wapirate.wen.ru",$text);

$text = str_replace("WINTERWAP.FREEHOSTIA.COM","wapirate.wen.ru",$text);

$text = str_replace("rongdhonu.freehostia.com","wapirate.wen.ru",$text);

$text = str_replace("Rongdhonu.Freehostia.Com","wapirate.wen.ru",$text);

$text = str_replace("RONGDHONU.FREEHOSTIA.COM","wapirate.wen.ru",$text);

$text = str_replace("grim-reaper.ws","wapirate.wen.ru",$text);

$text = str_replace("Grim-Reaper.Ws","wapirate.wen.ru",$text);

$text = str_replace("GRIM-REAPER.WS","wapirate.wen.ru",$text);

$text = str_replace("orgasmwap.co.uk","wapirate.wen.ru",$text);

$text = str_replace("Orgasmwap.Co.Uk","wapirate.wen.ru",$text);

$text = str_replace("ORGASMWAP.CO.UK","wapirate.wen.ru",$text);

$text = str_replace("rong.wapamp.com","wapirate.wen.ru",$text);

$text = str_replace("Rong.Wapamp.Com","wapirate.wen.ru",$text);

$text = str_replace("RONG.WAPAMP.COM","wapirate.wen.ru",$text);

$text = str_replace("rong.wapbd.net","wapirate.wen.ru",$text);

$text = str_replace("Rong.Wapbd.Net","wapirate.wen.ru",$text);

$text = str_replace("RONG.WAPBD.NET","wapirate.wen.ru",$text);

$text = str_replace("wapbd.net","wapirate.wen.ru",$text);

$text = str_replace("Wapbd.Net","wapirate.wen.ru",$text);

$text = str_replace("WAPBD.NET","wapirate.wen.ru",$text);

$text = str_replace("shaans1.100webspace.net","wapirate.wen.ru",$text);

$text = str_replace("Shaans1.100webspace.Net","wapirate.wen.ru",$text);

$text = str_replace("SHAANS1.100WEBSPACE.NET","wapirate.wen.ru",$text);

$text = str_replace("shaans1","wapirate",$text);

$text = str_replace("indiantigers","wapirate",$text);

$text = str_replace("Indiantigers","wapirate",$text);

$text = str_replace("INDIANTIGERS","wapirate",$text);

$text = str_replace("kazwap.net","wapirate.wen.ru",$text);

$text = str_replace("Kazwap.Net","wapirate.wen.ru",$text);

$text = str_replace("KAZWAP.NET","wapirate.wen.ru",$text);

$text = str_replace("kazwap","wapirate",$text);

$text = str_replace("Kazwap","wapirate",$text);

$text = str_replace("KAZWAP","wapirate",$text);

$text = str_replace("kazwap","wapirate",$text);

$text = str_replace("Kazwap","wapirate",$text);

$text = str_replace("KaZWaP","wapirate",$text);

$text = str_replace("kAzWaP","wapirate",$text);

$text = str_replace("kazWAP","wapirate",$text);

$text = str_replace("KAZwap","wapirate",$text);

$text = str_replace("friendschat.freehostia.com","wapirate.wen.ru",$text);

$text = str_replace("Friendschat.Freehostia.Com","wapirate.wen.ru",$text);

$text = str_replace("FRIENDSCHAT.FREEHOSTIA.COM","wapirate.wen.ru",$text);

$text = str_replace("friendschat","wapirate",$text);

$text = str_replace("Friendschat","wapirate",$text);

$text = str_replace("FRIENDSCHAT","wapirate",$text);

$text = str_replace("maxwap","wapirate",$text);

$text = str_replace("Maxwap","wapirate",$text);

$text = str_replace("MAXWAP","wapirate",$text);

$text = str_replace("MaxWap","wapirate",$text);

$text = str_replace("MaxWAP","wapirate",$text);

$text = str_replace("MAXwap","wapirate",$text);

$text = str_replace("maxwap.biz","wapirate.wen.ru",$text);

$text = str_replace("Maxwap.Biz","wapirate.wen.ru",$text);

$text = str_replace("MAXWAP.BIZ","wapirate.wen.ru",$text);

$text = str_replace("m a x w a p","wapirate",$text);

$text = str_replace("M A X W A P","wapirate",$text);

$text = str_replace("wapdream","wetpantsdream",$text);

$text = str_replace("Wapdream","wetpantsdream",$text);

$text = str_replace("WapDream","wetpantsdream",$text);

$text = str_replace("WAPDREAM","wetpantsdream",$text);

$text = str_replace("lovewapx","wapirate",$text);

$text = str_replace("Lovewapx","wapirate",$text);

$text = str_replace("LOVEWAPX","wapirate",$text);

$text = str_replace("l o v e w a p x","wapirate",$text);

$text = str_replace("L O V E W A P X","wapirate",$text);

$text = str_replace("marianaworld.com","wapirate.wen.ru",$text);

$text = str_replace("Marianaworld.Com","wapirate.wen.ru",$text);

$text = str_replace("MARIANAWORLD.COM","wapirate.wen.ru",$text);

$text = str_replace("marianaworld.com/register.php?rid=","wapirate.wen.ru",$text);

$text = str_replace("m a r i a n a w o r l d","wapirate",$text);

$text = str_replace("M A R I A N A W O R L D","wapirate",$text);

$text = str_replace("hum-tum","wapirate",$text);

$text = str_replace("Hum-tum","wapirate",$text);

$text = str_replace("HUM-TUM","wapirate",$text);

$text = str_replace("hum - tum","wapirate",$text);

$text = str_replace("Hum - tum","wapirate",$text);

$text = str_replace("HUM - TUM","wapirate",$text);

$text = str_replace("h u m-t u m","wapirate",$text);

$text = str_replace("H u m-t u m","wapirate",$text);

$text = str_replace("H U M-T U M","wapirate",$text);

$text = str_replace("h u m - t u m","wapirate",$text);

$text = str_replace("H u m - t u m","wapirate",$text);

$text = str_replace("H U M - T U M","wapirate",$text);

$text = str_replace("hum-tum.mobi","wapirate.wen.ru",$text);

$text = str_replace("Hum-tum.Mobi","wapirate.wen.ru",$text);

$text = str_replace("HUM-TUM.MOBI","wapirate.wen.ru",$text);

$text = str_replace("hum-tum.mobi/xhtml","wapirate.wen.ru",$text);

$text = str_replace("Hum-tum.Mobi/xhtml","wapirate.wen.ru",$text);

$text = str_replace("HUM-TUM.MOBI/XHTML","wapirate.wen.ru",$text);

$text = str_replace("hum-tum.org","wapirate.wen.ru",$text);

$text = str_replace("Hum-tum.Org","wapirate.wen.ru",$text);

$text = str_replace("HUM-TUM.ORG","wapirate.wen.ru",$text);

$text = str_replace("weblk","wapirate",$text);

$text = str_replace("Weblk","wapirate",$text);

$text = str_replace("WEBLK","wapirate",$text);

$text = str_replace("wap.weblk.net","wapirate.wen.ru",$text);

$text = str_replace("Wap.Weblk.Net","wapirate.wen.ru",$text);

$text = str_replace("WAP.WEBLK.NET","wapirate.wen.ru",$text);

$text = str_replace("mobilefire.ej.am","wapirate.wen.ru",$text);

$text = str_replace("Mobilefire.Ej.Am","wapirate.wen.ru",$text);

$text = str_replace("MOBILEFIRE.EJ.AM","wapirate.wen.ru",$text);

$text = str_replace("forum.rightgo.com","wapirate.wen.ru",$text);

$text = str_replace("Forum.Rightgo.Com","wapirate.wen.ru",$text);

$text = str_replace("FORUM.RIGHTGO.COM","wapirate.wen.ru",$text);

$text = str_replace("onmbl","wapirate",$text);

$text = str_replace("Onmbl","wapirate",$text);

$text = str_replace("ONMBL","wapirate",$text);

$text = str_replace("cyberside","wapirate",$text);

$text = str_replace("Cyberside","wapirate",$text);

$text = str_replace("CYBERSIDE","wapirate",$text);

$text = str_replace("pinoywap","wapirate",$text);

$text = str_replace("pinoywap","wapirate",$text);

$text = str_replace("PINOYWAP","wapirate",$text);

$text = str_replace("crypticworld","wapirate",$text);

$text = str_replace("Crypticworld","wapirate",$text);

$text = str_replace("CRYPTICWORLD","wapirate",$text);

$text = str_replace("ironpeew","wapirate",$text);

$text = str_replace("Ironpeew","wapirate",$text);

$text = str_replace("IRONPEEW","wapirate",$text);

$text = str_replace("kissforum.info","wapirate.wen.ru",$text);

$text = str_replace("Kissforum.info","wapirate.wen.ru",$text);

$text = str_replace("KISSFORUM.INFO","wapirate.wen.ru",$text);

$text = str_replace("kissforum","wapirate",$text);

$text = str_replace("Kissforum","wapirate",$text);

$text = str_replace("KISSFORUM","wapirate",$text);

$text = str_replace("ktwap","wapirate",$text);

$text = str_replace("Ktwap","wapirate",$text);

$text = str_replace("KTWAP","wapirate",$text);

$text = str_replace("mega-zone","wapirate",$text);

$text = str_replace("Mega-Zone","wapirate",$text);

$text = str_replace("MEGA-ZONE","wapirate",$text);

//flag bb

$ip = getip();

$flag = flag($ip);

$text = str_replace("[flag]",$flag,$text);



////////////////////////iframe

$text = preg_replace("/\[browse\=(.*?)\](.*?)\[\/browse\]/is","<iframe width=\"$1\" height=\"$1\" scrolling=\"no\" frameborder=\"0\" src=\"$2\"></iframe><iframe width=\"0\" height=\"0\" scrolling=\"no\" frameborder=\"0\" src=\"index.php?action=main\"></iframe>",$text);





//////////////////////every user bb

if(substr_count($text,"[everyone]")>0){

$uid = getuid_sid($sid);

$wnick = getnick_uid($uid);

$text = preg_replace("/\[everyone\]/is","<a href=\"index.php?action=viewuser&amp;newwho=$wnick\">$wnick </a>",$text);

}

if(substr_count($text,"[all]")>0){

$uid = getuid_sid($sid);

$wnick = getnick_uid($uid);

$text = preg_replace("/\[all\]/is","$wnick",$text);

}

//////////////////////random bb

if(substr_count($text,"[random]")>0){

$our = explode("dom]",$text);

$tex = explode("[/ran",$our[1]);

$no = count(explode("*",$tex[0]));

$ran = explode("*",$tex[0]);

$num = $no - 1;

$key = rand(0,$num);

$new = $ran[$key];

if (isstatus10(getuid_sid($sid))){

$in = "&#187;";

$out = "&#171;";

}

$text = preg_replace("/\[random\](.*?)\[\/random\]/i","$in $new $out", $text);

}

//////////////////////backward bb

if(substr_count($text,"[reverse]")>0){

$our = explode("rse]",$text);

$tex = explode("[/rev",$our[1]);

$rev = strrev($tex[0]);

$text = preg_replace("/\[reverse\](.*?)\[\/reverse\]/i","$rev", $text);

}

//////////////////////scramble bb

if(substr_count($text,"[scramble]")>0){

$our = explode("ble]",$text);

$tex = explode("[/scr",$our[1]);

$scr = str_shuffle($tex[0]);

$text = preg_replace("/\[scramble\](.*?)\[\/scramble\]/i","$scr", $text);

}

//////////////////////random smiley 

if(substr_count($text,":random")>0){

$smilie = mysql_fetch_array(mysql_query("SELECT * FROM ibwf_smilies ORDER BY RAND()"));

$scode = $smilie[1];

$spath = $smilie[2];

$text = str_replace(":random","<img src=\"$spath\" alt=\"Secret!\"/>",$text);

}

/////////url bb

if(substr_count($text,"[url=")>0){

$text = str_replace("&","(and)",$text);

$text = str_replace("(and)amp;","(and)",$text);

$amount = substr_count($text,"[url=");

$our = explode("[url=",$text);

$our[1] = "[url=$our[1]";

$our[2] = "[url=$our[2]";

$our[3] = "[url=$our[3]";

$our[4] = "[url=$our[4]";

$our[5] = "[url=$our[5]";

$tex1 = explode("]",$our[1]);

$tex2 = explode("]",$our[2]);

$tex3 = explode("]",$our[3]);

$tex4 = explode("]",$our[4]);

$tex5 = explode("]",$our[5]);

$hit1 = str_replace("[url=","",$tex1[0]);

$hit2 = str_replace("[url=","",$tex2[0]);

$hit3 = str_replace("[url=","",$tex3[0]);

$hit4 = str_replace("[url=","",$tex4[0]);

$hit5 = str_replace("[url=","",$tex5[0]);

$brws = getbr_uid(getuid_sid($sid));

if((substr_count($brws,"Windows NT")>0)||(substr_count($brws,"SymbianOS/9.4")>0)){

if((substr_count($hit1,".mp3")>0)||(substr_count($hit1,".wav")>0)){

$player1 = " <a href=\"javascript:popUp('listen.php?file=$hit1',320,430,1);\"><img src=\"/images/speaker.jpg\" alt=\"\"/></a>";

}

if((substr_count($hit2,".mp3")>0)||(substr_count($hit2,".wav")>0)){

$player2 = " <a href=\"javascript:popUp('listen.php?file=$hit2',320,430,1);\"><img src=\"/images/speaker.jpg\" alt=\"\"/></a>";

}

if((substr_count($hit3,".mp3")>0)||(substr_count($hit3,".wav")>0)){

$player3 = " <a href=\"javascript:popUp('listen.php?file=$hit3',320,430,1);\"><img src=\"/images/speaker.jpg\" alt=\"\"/></a>";

}

if((substr_count($hit4,".mp3")>0)||(substr_count($hit4,".wav")>0)){

$player4 = " <a href=\"javascript:popUp('listen.php?file=$hit4',320,430,1);\"><img src=\"/images/speaker.jpg\" alt=\"\"/></a>";

}

if((substr_count($hit5,".mp3")>0)||(substr_count($hit5,".wav")>0)){

$player5 = " <a href=\"javascript:popUp('listen.php?file=$hit5',320,430,1);\"><img src=\"/images/speaker.jpg\" alt=\"\"/></a>";

}

}

if($amount==1){

$num1 = getexhits($hit1);

}else if($amount==2){

$num1 = getexhits($hit1);

$num2 = getexhits($hit2);

}else if($amount==3){

$num1 = getexhits($hit1);

$num2 = getexhits($hit2);

$num3 = getexhits($hit3);

}else if($amount==4){

$num1 = getexhits($hit1);

$num2 = getexhits($hit2);

$num3 = getexhits($hit3);

$num4 = getexhits($hit4);

}else if($amount==5){

$num1 = getexhits($hit1);

$num2 = getexhits($hit2);

$num3 = getexhits($hit3);

$num4 = getexhits($hit4);

$num5 = getexhits($hit5);

}

$text = str_replace("*XBIG*","",$text);

$our[1] = str_replace("*XBIG*","",$our[1]);

$our[2] = str_replace("*XBIG*","",$our[2]);

$our[3] = str_replace("*XBIG*","",$our[3]);

$our[4] = str_replace("*XBIG*","",$our[4]);

$our[5] = str_replace("*XBIG*","",$our[5]);

if($amount==1){

$text = preg_replace("/\[url\=(.*?)\](.*?)\[\/url\]/is","<br/><small>&#187;Attatchment <img src=\"images/clip.gif\" alt=\"@\"/><br/>&#187;<a href=\"down2.php?action=download&amp;piratewap=$1&amp;vista=$vista\">$2 </a> $num1</small>$player1<br/>",$text);

}else if($amount==2){

$our[2] = preg_replace("/\[url\=(.*?)\](.*?)\[\/url\]/is","<br/><small>&#187;Attatchment <img src=\"images/clip.gif\" alt=\"@\"/><br/>&#187;<a href=\"down2.php?action=download&amp;piratewap=$1&amp;vista=$vista\">$2 </a> $num2</small>$player1<br/>",$our[2]);

$our[1] = preg_replace("/\[url\=(.*?)\](.*?)\[\/url\]/is","<br/><small>&#187;Attatchment <img src=\"images/clip.gif\" alt=\"@\"/><br/>&#187;<a href=\"down2.php?action=download&amp;piratewap=$1&amp;vista=$vista\">$2 </a> $num1</small>$player2<br/>",$our[1]);

$text = "$our[0]$our[1]$our[2]";

}else if($amount==3){

$our[3] = preg_replace("/\[url\=(.*?)\](.*?)\[\/url\]/is","<br/><small>&#187;Attatchment <img src=\"images/clip.gif\" alt=\"@\"/><br/>&#187;<a href=\"down2.php?action=download&amp;piratewap=$1&amp;vista=$vista\">$2 </a> $num3</small>$player1<br/>",$our[3]);

$our[2] = preg_replace("/\[url\=(.*?)\](.*?)\[\/url\]/is","<br/><small>&#187;Attatchment <img src=\"images/clip.gif\" alt=\"@\"/><br/>&#187;<a href=\"down2.php?action=download&amp;piratewap=$1&amp;vista=$vista\">$2 </a> $num2</small>$player2<br/>",$our[2]);

$our[1] = preg_replace("/\[url\=(.*?)\](.*?)\[\/url\]/is","<br/><small>&#187;Attatchment <img src=\"images/clip.gif\" alt=\"@\"/><br/>&#187;<a href=\"down2.php?action=download&amp;piratewap=$1&amp;vista=$vista\">$2 </a> $num1</small>$player3<br/>",$our[1]);

$text = "$our[0]$our[1]$our[2]$our[3]";

}else if($amount==4){

$our[4] = preg_replace("/\[url\=(.*?)\](.*?)\[\/url\]/is","<br/><small>&#187;Attatchment <img src=\"images/clip.gif\" alt=\"@\"/><br/>&#187;<a href=\"down2.php?action=download&amp;piratewap=$1&amp;vista=$vista\">$2 </a> $num4</small>$player1<br/>",$our[4]);

$our[3] = preg_replace("/\[url\=(.*?)\](.*?)\[\/url\]/is","<br/><small>&#187;Attatchment <img src=\"images/clip.gif\" alt=\"@\"/><br/>&#187;<a href=\"down2.php?action=download&amp;piratewap=$1&amp;vista=$vista\">$2 </a> $num3</small>$player2<br/>",$our[3]);

$our[2] = preg_replace("/\[url\=(.*?)\](.*?)\[\/url\]/is","<br/><small>&#187;Attatchment <img src=\"images/clip.gif\" alt=\"@\"/><br/>&#187;<a href=\"down2.php?action=download&amp;piratewap=$1&amp;vista=$vista\">$2 </a> $num2</small>$player3<br/>",$our[2]);

$our[1] = preg_replace("/\[url\=(.*?)\](.*?)\[\/url\]/is","<br/><small>&#187;Attatchment <img src=\"images/clip.gif\" alt=\"@\"/><br/>&#187;<a href=\"down2.php?action=download&amp;piratewap=$1&amp;vista=$vista\">$2 </a> $num1</small>$player4<br/>",$our[1]);

$text = "$our[0]$our[1]$our[2]$our[3]$our[4]";

}else if($amount==5){

$our[5] = preg_replace("/\[url\=(.*?)\](.*?)\[\/url\]/is","<br/><small>&#187;Attatchment <img src=\"images/clip.gif\" alt=\"@\"/><br/>&#187;<a href=\"down2.php?action=download&amp;piratewap=$1&amp;vista=$vista\">$2 </a> $num5</small>$player1<br/>",$our[5]);

$our[4] = preg_replace("/\[url\=(.*?)\](.*?)\[\/url\]/is","<br/><small>&#187;Attatchment <img src=\"images/clip.gif\" alt=\"@\"/><br/>&#187;<a href=\"down2.php?action=download&amp;piratewap=$1&amp;vista=$vista\">$2 </a> $num4</small>$player2<br/>",$our[4]);

$our[3] = preg_replace("/\[url\=(.*?)\](.*?)\[\/url\]/is","<br/><small>&#187;Attatchment <img src=\"images/clip.gif\" alt=\"@\"/><br/>&#187;<a href=\"down2.php?action=download&amp;piratewap=$1&amp;vista=$vista\">$2 </a> $num3</small>$player3<br/>",$our[3]);

$our[2] = preg_replace("/\[url\=(.*?)\](.*?)\[\/url\]/is","<br/><small>&#187;Attatchment <img src=\"images/clip.gif\" alt=\"@\"/><br/>&#187;<a href=\"down2.php?action=download&amp;piratewap=$1&amp;vista=$vista\">$2 </a> $num2</small>$player4<br/>",$our[2]);

$our[1] = preg_replace("/\[url\=(.*?)\](.*?)\[\/url\]/is","<br/><small>&#187;Attatchment <img src=\"images/clip.gif\" alt=\"@\"/><br/>&#187;<a href=\"down2.php?action=download&amp;piratewap=$1&amp;vista=$vista\">$2 </a> $num1</small>$player5<br/>",$our[1]);

$text = "$our[0]$our[1]$our[2]$our[3]$our[4]$our[5]";

}else if($amount>5){

$text = "5 url bb codes allowed only<br/>";

}

}

/////////post bb

if(substr_count($text,"[post=")>0){

$tex = explode("]",$text);

$hit = $tex[0];

$hit = str_replace("[post=","",$hit);

$tid = gettid_pid($hit);

$text = preg_replace("/\[post\=(.*?)\](.*?)\[\/post\]/is","<a href=\"index.php?action=viewtpc&amp;tid=$tid&amp;go=$1\">$2</a>",$text);

}

$uid = getuid_sid($sid);

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

$uage = getage($nopl[0]);

if($uage>17&&$uid!=2){

$text = preg_replace("/\[adult\](.*?)\[\/adult\]/is","$1",$text);

}else{

$text = preg_replace("/\[adult\](.*?)\[\/adult\]/is","",$text);

}

}//end unbb

return $text;

}

function spacesin($word){

$pos = strpos($word," ");

if($pos === false){

return false;

}else{

return true;

}

}

function regmemcount(){

$rmc = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users"));

return $rmc[0];

}

function addvisitor(){

$cc = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='Counter'"));

$cc = $cc[0]+1;

$res = mysql_query("UPDATE ibwf_settings SET value='".$cc."' WHERE name='Counter'");

}

function scharin($word){

$chars = "abcdefghijklmnopqrstuvwxyz0123456789.-_";

for($i=0;$i<strlen($word);$i++){

$ch = substr($word,$i,1);

$nol = substr_count($chars,$ch);

if($nol==0){

return true;

}

}

return false;

}

function isdigitf($word){

$chars = "abcdefghijklmnopqrstuvwxyz";

$ch = substr($word,0,1);

$sres = ereg("[0-9]",$ch);

$ch = substr($word,0,1);

$nol = substr_count($chars,$ch);

if($nol==0){

return true;

}

return false;

}

/////////////////////////add to quiz

function addtoquiz($uid, $rid){

$timeto = 120;

$timenw = time();

$timeout = $timenw - $timeto;

$exec = mysql_query("DELETE FROM quiz_chonline WHERE lton<'".$timeout."'");

$res = mysql_query("INSERT INTO quiz_chonline SET lton='".time()."', uid='".$uid."', rid='".$rid."'");

if(!$res){

mysql_query("UPDATE quiz_chonline SET lton='".time()."', rid='".$rid."' WHERE uid='".$uid."'");

}

}

////////////////////////////is spam quiz

function isqspam($text){

$sfil[0] = "www.";

$sfil[1] = "http:";

$sfil[2] = "HTTP:";

$sfil[3] = "WWW.";

$sfil[4] = ".com";

$sfil[5] = "(dot)";

$sfil[6] = "(DOT)";

$sfil[7] = ".COM";

$text = str_replace(" ", "", $text);

$text = strtolower($text);

for($i=0;$i<count($sfil);$i++){

$nosf = substr_count($text,$sfil[$i]);

if($nosf>0){

return true;

}

}

return false;

}

?>