please help...i use opera and mozzila browser it works but when i use internet explorer it is always redirect to wml
funmobile script redirection bug!
Collapse
X
-
PHP Code:<?php
include("config.php");
connectdb();
define ('WAP','text/vnd.wap.wml');
define ('WEB','application/xhtml+xml');
$v = $_GET["v"];
$ses = $_GET["ses"];
$uid = getuid_ses($ses);
$font = getfont($uid);
if($font=="0")
{
$f1 = "<small>";
$f2 = "</small>";
}else if($font=="2")
{
$f1 = "<b>";
$f2 = "</b>";
}else{
$f1 = "";
$f2 = "";
}
$icons_on = geticons($uid);
if($icons_on)
{
$nboximg = "<img src=\"images/inbox.gif\" alt=\"*\"/>";
$budimg = "<img src=\"images/buddies.gif\" alt=\"*\"/>";
$fimg = "<img src=\"images/forums.gif\" alt=\"*\"/>";
$cimg = "<img src=\"images/chat.gif\" alt=\"*\"/>";
$climg = "<img src=\"images/clubs.gif\" alt=\"*\"/>";
$fuimg = "<img src=\"images/funmenu.gif\" alt=\"*\"/>";
$galimg = "<img src=\"images/gallery.gif\" alt=\"*\"/>";
$shimg = "<img src=\"images/shop.gif\" alt=\"*\"/>";
$cpimg = "<img src=\"images/cpanel.gif\" alt=\"*\"/>";
$dimg = "<img src=\"images/downloads.gif\" alt=\"*\"/>";
$simg = "<img src=\"images/search.gif\" alt=\"*\"/>";
$mlimg = "<img src=\"images/modlog.gif\" alt=\"*\"/>";
}else{
$nboximg = "";
$budimg = "";
$fimg = "";
$cimg = "";
$climg = "";
$fuimg = "";
$galimg = "";
$shimg = "";
$cpimg = "";
$dimg = "";
$simg = "";
$mlimg = "";
}
if($v=="w")
{
$mime = "text/vnd.wap.wml";
}else if($v=="x")
{
$mime = "application/xhtml+xml";
}else if($v=="")
{
$getview = mysql_fetch_array(mysql_query("SELECT view FROM ibwf_users WHERE id='".$uid."'"));
if($getview[0]=="w") {
$mime = "text/vnd.wap.wml";
}else if($getview[0]=="x") {
$mime = "application/xhtml+xml";
}else if($getview[0]=="") {
$content_type = "";
//$content_type = "text/vnd.wap.wml"; //for debugging
if ($content_type=="")
{
$mime = ((stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml")) ? "application/xhtml+xml" : "text/vnd.wap.wml");
}else{
$mime = $content_type;
}
}
}
$charset = "utf-8";
header("content-type:$mime;charset=$charset");
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 waphead($pgtitle)
{
$ret = "<wml><card id=\"main\" title=\"$pgtitle\">";
return $ret;
}
function wapheadchat($rid,$ses,$rpw,$pgtitle)
{
$ret = "<wml><card id=\"chat\" title=\"$pgtitle\" ontimer=\"chat.php?time=";
$ret .= date('dmHis');
$ret .= "&ses=$ses&rid=$rid&rpw=$rpw";
$ret .= "\">";
return $ret;
}
function wapfoot()
{
$ret = "</card></wml>";
return $ret;
}
function webhead($uthm,$pgtitle)
{
$ret = "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" >";
$ret .= "<head>";
$ret .= "<title>$pgtitle</title>";
$ret .= "<link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"images/favicon.ico\" />";
$ret .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/$uthm\" />";
$ret .= "</head><body>";
return $ret;
}
function webheadchat($rid,$ses,$rpw,$uthm,$pgtitle)
{
$ret = "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" >";
$ret .= "<head>";
$ret .= "<title>$pgtitle</title>";
$ret .= "<link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"images/favicon.ico\" />";
$ret .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/$uthm\" />";
$ret .= "<meta http-equiv=\"refresh\" content=\"20; URL=";
$ret .= " chat.php?time=";
$ret .= date('dmHis');
$ret .= "&ses=$ses&rid=$rid&rpw=$rpw\"/>";
$ret .= "</head><body>";
return $ret;
}
function webfoot()
{
$ret = "</body></html>";
return $ret;
}
function connectdb()
{
global $fdbname, $fdbuser, $fdbhost, $fdbpass;
$conms = @mysql_connect($fdbhost,$fdbuser,$fdbpass);
if(!$conms) return false;
$condb = @mysql_select_db($fdbname);
if(!$condb) return false;
return true;
}
function dberror($mime)
{
global $stitle;
$msg = "Cannot connect to Mysql DATABASE!";
$uthm = "default.css";
if($mime== WEB)
{
echo webhead($uthm,$stitle);
echo $msg;
echo webfoot();
exit();
}else{
echo waphead($stitle);
echo "<p>";
echo $msg;
echo "</p>";
echo wapfoot();
exit();
}
}
function notlogged($mime)
{
global $stitle;
$msg = "You are not logged in or your session has expired!<br/>";
$uthm = "default.css";
if($mime== WEB)
{
echo webhead($uthm,$stitle);
echo $msg;
echo "<form action=\"login.php\" method=\"get\">";
echo "Username:";
echo "<br/>";
echo "<input type=\"text\" name=\"uid\" size=\"8\" maxlength=\"15\" />";
echo "<br/>";
echo "Password:";
echo "<br/>";
echo "<input type=\"password\" name=\"pwd\" size=\"8\" maxlength=\"15\" />";
echo "<br/>";
echo "<input type=\"hidden\" name=\"v\" value=\"$v\"/>";
echo "<input type=\"submit\" value=\"login\"/>";
echo "</form>";
echo webfoot();
exit();
}else{
echo waphead($stitle);
echo "<p>";
echo $msg;
echo "Username:";
echo "<br/>";
echo "<input type=\"text\" name=\"uid\" maxlength=\"15\" />";
echo "<br/>";
echo "Password:";
echo "<br/>";
echo "<input type=\"password\" name=\"pwd\" maxlength=\"15\" />";
echo "<br/>";
echo "<anchor>login<go href=\"login.php\" method=\"get\">";
echo "<postfield name=\"uid\" value=\"$(uid)\"/>";
echo "<postfield name=\"pwd\" value=\"$(pwd)\"/>";
echo "<postfield name=\"v\" value=\"$v\"/>";
echo "</go>";
echo "</anchor>";
echo "</p>";
echo wapfoot();
exit();
}
}
function userbanned($mime,$uid)
{
global $stitle;
$msg = "You are Banned!<br/>";
$banto = mysql_fetch_array(mysql_query("SELECT timeto FROM ibwf_penalties WHERE uid='".$uid."' AND penalty='1'"));
$banres = mysql_fetch_array(mysql_query("SELECT lastpnreas FROM ibwf_users WHERE id='".$uid."'"));
$remain = $banto[0]- time();
$rmsg = gettimemsg($remain);
if($mime== WEB)
{
echo webhead($uthm,$stitle);
echo $msg;
echo "Time to finish your penalty: $rmsg<br/>";
echo "Ban Reason: $banres[0]";
echo webfoot();
exit();
}else{
echo waphead($stitle);
echo "<p>";
echo $msg;
echo "Time to finish your penalty: $rmsg<br/>";
echo "Ban Reason: $banres[0]";
echo "</p>";
echo wapfoot();
exit();
}
}
function useripbanned($mime,$uip,$ubr)
{
global $stitle;
$uthm = "default.css";
if($mime== WEB)
{
echo webhead($uthm,$stitle);
echo "Your IP is Banned<br/>";
$banto = mysql_fetch_array(mysql_query("SELECT timeto FROM ibwf_penalties WHERE penalty='2' AND ipadd='".$uip."' AND browserm='".$ubr."' LIMIT 1 "));
//echo mysql_error();
$remain = $banto[0] - time();
$rmsg = gettimemsg($remain);
echo " IP: $rmsg<br/>";
echo webfoot();
exit();
}else{
echo waphead($stitle);
echo "<p>";
echo "Your IP is Banned<br/>";
$banto = mysql_fetch_array(mysql_query("SELECT timeto FROM ibwf_penalties WHERE penalty='2' AND ipadd='".$uip."' AND browserm='".$ubr."' LIMIT 1 "));
//echo mysql_error();
$remain = $banto[0] - time();
$rmsg = gettimemsg($remain);
echo " IP: $rmsg<br/>";
echo "</p>";
echo wapfoot();
exit();
}
}
function getshoutbox($mime,$ses)
{
$uid = getuid_ses($ses);
$sbox = getsbox($uid);
if($sbox)
{
if($mime== WEB)
{
$shbox = "<b>ShoutBox</b><br/>";
$lshout = mysql_fetch_array(mysql_query("SELECT shout, shouter, id FROM ibwf_shouts ORDER BY shtime DESC LIMIT 1"));
$shnick = getnick_uid($lshout[1]);
$shbox .= "<i><a href=\"index.php?action=viewuser&ses=$ses&who=$lshout[1]\">".$shnick."</a></i>: ";
$shbox .= unhtmlspecialchars($lshout[0]);
$shbox .= "<br/>";
$shbox .= "<a href=\"lists.php?action=shouts&ses=$ses\">more</a>, ";
$shbox .= "<a href=\"index.php?action=shout&ses=$ses\">shout</a>";
if (ismod(getuid_ses($ses)))
{
$shbox .= ", <a href=\"modproc.php?action=delsh&ses=$ses&shid=$lshout[2]\">delete</a>";
}
return $shbox;
}else{
$shbox = "<b>ShoutBox</b><br/>";
$lshout = mysql_fetch_array(mysql_query("SELECT shout, shouter, id FROM ibwf_shouts ORDER BY shtime DESC LIMIT 1"));
$shnick = getnick_uid($lshout[1]);
$shbox .= "<i><a href=\"index.php?action=viewuser&ses=$ses&who=$lshout[1]\">".$shnick."</a></i>: ";
$shbox .= unhtmlspecialchars($lshout[0]);
$shbox .= "<br/>";
$shbox .= "<a href=\"lists.php?action=shouts&ses=$ses\">more</a>, ";
$shbox .= "<a href=\"index.php?action=shout&ses=$ses\">shout</a>";
if (ismod(getuid_ses($ses)))
{
$shbox .= ", <a href=\"modproc.php?action=delsh&ses=$ses&shid=$lshout[2]\">delete</a>";
}
return $shbox;
}
}
}
function registerform($mime,$ef)
{
$ue = $errl = $pe = $ce = $ee = "";
switch($ef)
{
case 1:
$errl = "<img src=\"images/point.gif\" alt=\"!\"/> Please type your UserID";
$ue = "<img src=\"images/point.gif\" alt=\"!\"/>";
break;
case 2:
$errl = "<img src=\"images/point.gif\" alt=\"!\"/> Please type your password";
$pe = "<img src=\"images/point.gif\" alt=\"!\"/>";
break;
case 3:
$errl = "<img src=\"images/point.gif\" alt=\"!\"/> Please type your password again";
$ce = "<img src=\"images/point.gif\" alt=\"!\"/>";
break;
case 4:
$errl = "<img src=\"images/point.gif\" alt=\"!\"/> UserID 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 doesn't match";
$ce = "<img src=\"images/point.gif\" alt=\"!\"/>";
break;
case 7:
$errl = "<img src=\"images/point.gif\" alt=\"!\"/> UserID 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=\"!\"/> UserID already in use, choose a different one";
$ue = "<img src=\"images/point.gif\" alt=\"!\"/>";
break;
case 10:
$errl = "<img src=\"images/point.gif\" alt=\"!\"/> Unknown mysql error try registering later";
break;
case 11:
$errl = "<img src=\"images/point.gif\" alt=\"!\"/> UserID 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=\"!\"/> UserID 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 nickname";
$ue = "<img src=\"images/point.gif\" alt=\"!\"/>";
break;
case 14:
$errl = "<img src=\"images/point.gif\" alt=\"!\"/> Please Enter Email Address";
$ee = "<img src=\"images/point.gif\" alt=\"!\"/>";
break;
case 15:
$errl = "<img src=\"images/point.gif\" alt=\"!\"/> Email Address Invalid";
$ee = "<img src=\"images/point.gif\" alt=\"!\"/>";
break;
case 16:
$errl = "<img src=\"images/point.gif\" alt=\"!\"/> Email Address is already in use";
$ee = "<img src=\"images/point.gif\" alt=\"!\"/>";
break;
}
if($mime== WEB)
{
$rform = "<form action=\"register.php?v=$v\" method=\"post\">";
$rform .= "$errl<br/><br/>";
$rform .= "$ue UserID: <input name=\"uid\" format=\"*x\" maxlength=\"15\"/><br/>";
$rform .= "$pe Password: <input type=\"password\" name=\"pwd\" format=\"*x\" maxlength=\"30\"/><br/>";
$rform .= "$ce Password: <input type=\"password\" name=\"cpw\" format=\"*x\" maxlength=\"30\"/><br/>";
$rform .= "Birthday: <input name=\"bdy\" format=\"*x\" maxlength=\"30\"/><br/>";
$rform .= "Sex:";
$rform .= "<select name=\"usx\" value=\"1\">";
$rform .= "<option value=\"1\">Male</option>";
$rform .= "<option value=\"2\">Female</option>";
$rform .= "</select><br/>";
$rform .= "Display:";
$rform .= "<select name=\"view\" value=\"x\">";
$rform .= "<option value=\"x\">XHTML</option>";
$rform .= "<option value=\"w\">WML</option>";
$rform .= "</select><br/>";
$rform .= "Location: <input name=\"ulc\" maxlength=\"100\"/><br/>";
$rform .= "$ee Email Address: <input name=\"email\" type=\"text\" maxlength=\"55\"/><br/>";
$rform .= "<input type=\"submit\" value=\"Register\"/>";
$rform .= "</form>";
return $rform;
}else{
$rform = "$errl<br/><br/>";
$rform .= "$ue UserID: <input name=\"uid\" format=\"*x\" maxlength=\"15\"/><br/>";
$rform .= "$pe Password: <input type=\"password\" name=\"pwd\" format=\"*x\" maxlength=\"30\"/><br/>";
$rform .= "$ce Password: <input type=\"password\" name=\"cpw\" format=\"*x\" maxlength=\"30\"/><br/>";
$rform .= "Birthday: <input name=\"bdy\" format=\"*x\" maxlength=\"30\"/><br/>";
$rform .= "Sex:";
$rform .= "<select name=\"usx\" value=\"1\">";
$rform .= "<option value=\"1\">Male</option>";
$rform .= "<option value=\"2\">Female</option>";
$rform .= "</select><br/>";
$rform .= "Display:";
$rform .= "<select name=\"view\" value=\"x\">";
$rform .= "<option value=\"x\">XHTML</option>";
$rform .= "<option value=\"w\">WML</option>";
$rform .= "</select><br/>";
$rform .= "Location: <input name=\"ulc\" maxlength=\"100\"/><br/>";
$rform .= "$ee Email Address: <input name=\"email\" type=\"text\" maxlength=\"55\"/><br/>";
$rform .= "<anchor>Register";
$rform .= "<go href=\"register.php?v=$v\" method=\"post\">";
$rform .= "<postfield name=\"uid\" value=\"$(uid)\"/>";
$rform .= "<postfield name=\"pwd\" value=\"$(pwd)\"/>";
$rform .= "<postfield name=\"cpw\" value=\"$(cpw)\"/>";
$rform .= "<postfield name=\"bdy\" value=\"$(bdy)\"/>";
$rform .= "<postfield name=\"usx\" value=\"$(usx)\"/>";
$rform .= "<postfield name=\"view\" value=\"$(view)\"/>";
$rform .= "<postfield name=\"ulc\" value=\"$(ulc)\"/>";
$rform .= "<postfield name=\"email\" value=\"$(email)\"/>";
$rform .= "</go></anchor>";
return $rform;
}
}
function notowner($mime)
{
global $stitle;
if($mime== WEB)
{
echo webhead($uthm,$stitle);
echo "You are not an Owner<br/>";
echo "<br/>";
echo "<a href=\"index.php\">Home</a>";
echo webfoot();
exit();
}else{
echo waphead($stitle);
echo "<p align=\"center\">";
echo "You are not an Owner<br/>";
echo "<br/>";
echo "<a href=\"index.php\">Home</a>";
echo "</p>";
echo wapfoot();
exit();
}
}
function notadmin($mime)
{
global $stitle;
if($mime== WEB)
{
echo webhead($uthm,$stitle);
echo "You are not an admin<br/>";
echo "<br/>";
echo "<a href=\"index.php\">Home</a>";
echo webfoot();
exit();
}else{
echo waphead($stitle);
echo "<p align=\"center\">";
echo "You are not an admin<br/>";
echo "<br/>";
echo "<a href=\"index.php\">Home</a>";
echo "</p>";
echo wapfoot();
exit();
}
}
function notmod($mime)
{
global $stitle;
if($mime== WEB)
{
echo webhead($uthm,$stitle);
echo "You are not a mod<br/>";
echo "<br/>";
echo "<a href=\"index.php\">Home</a>";
echo webfoot();
exit();
}else{
echo waphead($stitle);
echo "<p align=\"center\">";
echo "You are not a mod<br/>";
echo "<br/>";
echo "<a href=\"index.php\">Home</a>";
echo "</p>";
echo wapfoot();
exit();
}
}
function register($name,$pass,$usex,$bday,$uloc, $ubr,$view,$email)
{
$execms = mysql_query("SELECT * FROM ibwf_users WHERE name='".$name."';");
if (mysql_num_rows($execms)>0){
return 1;
}else{
$pass = md5($pass);
$reg = mysql_query("INSERT INTO ibwf_users SET name='".$name."', pass='".$pass."', birthday='".$bday."', sex='".$usex."', location='".$uloc."', regdate='".time()."', ipadd='".getip()."', browserm='".$ubr."', view='".$view."', email='".$email."'");
if ($reg)
{
$uid = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_users WHERE name='".$name."'"));
$msg = "Hello /reader =)[card=007]welcome and enjoy[/card] greetings from all $stitle staff, we are happy to have you here, welcome to our big happy family! to get the most of our site please read the pinned threads in $stitle Info Boards. ENJOY! -play- ";
$msg = mysql_escape_string($msg);
autopm($msg, $uid[0]);
return 0;
}else{
return 2;
}
}
}
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 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."'");
///delete expired rooms
$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");
//echo $lbpm[0];
if ($td!=$lbpm[0])
{
//echo "boo";
$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] $stitle team wish 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 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;
}
function deleteMClubs($uid)
{
$uclubs = mysql_query("SELECT id FROM ibwf_clubs WHERE owner='".$uid."'");
while($uclub=mysql_fetch_array($uclubs))
{
deleteClub($uclub[0]);
}
}
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]||ismod($uid))
{
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(ismod($uid))
{
return true;
}else{
$ismm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE uid='".$uid."' AND clid='".$clid[0]."'"));
if($ismm[0]>0)
{
return true;
}else{
return false;
}
}
}
}else{
$gid = mysql_fetch_array(mysql_query("SELECT gid FROM ibwf_acc WHERE fid='".$fid."'"));
$gid = $gid[0];
$ginfo = mysql_fetch_array(mysql_query("SELECT autoass, mage, userst, posts, credits FROM ibwf_groups WHERE id='".$gid."'"));
if($ginfo[0]=="1")
{
$uperms = mysql_fetch_array(mysql_query("SELECT birthday, perm, posts, credits FROM ibwf_users WHERE id='".$uid."'"));
if($ginfo[2]==3)
{
if(isowner($uid))
{
return true;
}else{
return false;
}
}
if($ginfo[2]==2)
{
if(isadmin($uid))
{
return true;
}else{
return false;
}
}
if($ginfo[2]==1)
{
if(ismod($uid))
{
return true;
}else{
return false;
}
}
if($uperms[1]>$ginfo[2])
{
return true;
}
$acc = true;
if(getage($uperms[0])< $ginfo[1])
{
$acc = false;
}
if($uperms[2]<$ginfo[3])
{
$acc = false;
}
if($uperms[3]<$ginfo[4])
{
$acc = false;
}
}
}
return $acc;
}
function canenter($rid, $ses)
{
$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_ses($ses)."'"));
if($rperm[3]!=0)
{
if(ismod(getuid_ses($ses)))
{
return true;
}else{
$ismm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE uid='".getuid_ses($ses)."' AND clid='".$rperm[3]."'"));
if($ismm[0]>0)
{
return true;
}else{
return false;
}
}
}
if($rperm[1]==1)
{
return ismod(getuid_ses($ses));
}
if($rperm[1]==2)
{
return isadmin(getuid_ses($ses));
}
if(getuage_ses($ses)<$rperm[0])
{
return false;
}
if($uperm[1]<$rperm[2])
{
return false;
}
return true;
}
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;
}
return false;
}
function isspam($text)
{
$text = str_replace(" ", "", $text);
$getwords = mysql_query("SELECT word FROM ibwf_spam");
while ($row = mysql_fetch_array($getwords))
{
$sfil[] = $row[0];
}
$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)
{
if(trim($go)=="")return 1;
if($go=="last")return getnumpages($tid);
$counter=1;
$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/5);
return $tore;
}
}
return 1;
}
function getnumpages($tid)
{
$nops = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE tid='".$tid."'"));
$nops = $nops[0]+1; //where did the 1 come from? the topic text, duh!
$nopg = ceil($nops/5); //5 is the posts to show in each page
return $nopg;
}
function candelbl($uid,$bid)
{
$minfo = mysql_fetch_array(mysql_query("SELECT bowner FROM ibwf_blogs WHERE id='".$bid."'"));
if(ismod($uid))
{
return true;
}
if($minfo[0]==$uid)
{
return true;
}
return false;
}
function getcredits($uid)
{
$plus = mysql_fetch_array(mysql_query("SELECT credits FROM ibwf_users WHERE id='".$uid."'"));
return $plus[0];
}
function cansigngb($uid, $who)
{
if(arebuds($uid, $who))
{
return true;
}
if($uid==$who)
{
return false; //imagine if someone signed his own gbook o.O
}
if(getcredits($uid)>=75)
{
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 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)
{
//3 = can't bud
//2 = already buds
//1 = request pended
//0 = can bud
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'"));
$max_buds = getmaxbuds();
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'"));
$max_buds = getmaxbuds;
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 getshoutcredits()
{
$getdata = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='shoutcredits'"));
return $getdata[0];
}
function getclubcredits()
{
$getdata = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='clubcredits'"));
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()
{
$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."'"));
if($uon[0]>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, $ses="")
{
$text = unhtmlspecialchars($text);
$sml = mysql_fetch_array(mysql_query("SELECT hvia FROM ibwf_users WHERE id='".getuid_ses($ses)."'"));
if ($sml[0]=="1")
{
$text = getsmilies($text);
}
$text = getbbcode($text, $ses);
$text = findcard($text);
return $text;
}
function parsemsg($text,$ses="")
{
$text = unhtmlspecialchars($text);
$sml = mysql_fetch_array(mysql_query("SELECT hvia FROM ibwf_users WHERE id='".getuid_ses($ses)."'"));
if ($sml[0]=="1")
{
$text = getsmilies($text);
}
$text = getbbcode($text, $ses);
$text = findcard($text);
return $text;
}
function isblocked($str,$sender)
{
if(ismod($sender))
{
return false;
}
$str = str_replace(" ","",$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)
{
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 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 islogged($ses)
{
//delete old sessions first
$deloldses = mysql_query("DELETE FROM ibwf_ses WHERE expiretm<'".time()."'");
//does sessions exist?
$sesx = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_ses WHERE id='".$ses."'"));
if($sesx[0]>0)
{
if(!isuser(getuid_ses($ses)))
{
return false;
}
//yip it's logged in
//first extend its session expirement time
$xtm = time() + (60*getsxtm());
$extxtm = mysql_query("UPDATE ibwf_ses SET expiretm='".$xtm."' WHERE id='".$ses."'");
return true;
}else{
//nope its session must be expired or something
return false;
}
}
function ismod($uid)
{
$perm = mysql_fetch_array(mysql_query("SELECT perm FROM ibwf_users WHERE id='".$uid."'"));
if($perm[0]>0)
{
return true;
}
}
function isadmin($uid)
{
$admn = mysql_fetch_array(mysql_query("SELECT perm FROM ibwf_users WHERE id='".$uid."'"));
if($admn[0]>='2')
{
return true;
}else{
return false;
}
}
function isowner($uid)
{
$admn = mysql_fetch_array(mysql_query("SELECT perm FROM ibwf_users WHERE id='".$uid."'"));
if($admn[0]=='3')
{
return true;
}else{
return false;
}
}
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 (getenv('HTTP_X_FORWARDED_FOR'))
{
$ip=getenv('HTTP_X_FORWARDED_FOR');
}
else
{
$ip=getenv('REMOTE_ADDR');
}
return $ip;
}
function ignoreres($uid, $tid)
{
//0 user can't ignore the target
//1 yes can ignore
//2 already ignored
if($uid==$tid)
{
return 0;
}
if(ismod($tid))
{
//you cant ignore staff members
return 0;
}
if(arebuds($tid, $uid))
{
//why the hell would anyone ignore his bud? o.O
return 0;
}
if(isignored($tid, $uid))
{
return 2; // the target is already ignored by the user
}
return 1;
}
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;
}
function getavatar($uid)
{
$av = mysql_fetch_array(mysql_query("SELECT avatar FROM ibwf_users WHERE id='".$uid."'"));
return $av[0];
}
function cansee($uid, $tid)
{
if($uid==$tid)
{
return true;
}
if(ismod($uid))
{
return true;
}
return false;
}
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";
}
function getstatus($uid)
{
$info= mysql_fetch_array(mysql_query("SELECT perm, credits FROM ibwf_users WHERE id='".$uid."'"));
if(isbanned($uid))
{
return "BANNED!";
}
if($info[0]=='3')
{
return "Owner!";
}else if($info[0]=='2')
{
return "Administrator!";
}else if($info[0]=='1')
{
return "Moderator!";
}else{
if($info[1]<10)
{
return "N00b";
}else if($info[1]<25)
{
return "SpaRkl3";
}else if($info[1]<50)
{
return "flaR3";
}else if($info[1]<75)
{
return "flaM3";
}else if($info[1]<250)
{
return "buRst";
}else if($info[1]<500)
{
return "ViTa1";
}else if($info[1]<750)
{
return "Lava unplugged";
}else if($info[1]<1000)
{
return "GuRu";
}else if($info[1]<1500)
{
return "V.I.P";
}else if($info[1]<2000)
{
return "FaNatic";
}else if($info[1]<2500)
{
return "Lava KNight";
}else if($info[1]<3000)
{
return "VeteRaN";
}else if($info[1]<4000)
{
return "Lava eXpelleR";
}else if($info[1]<5000)
{
return "MasteR";
}else if($info[1]<10000)
{
return "ic0N";
}else
{
return "Lava volcaNo";
}
}
}
function getjumper($mime,$action, $ses,$pgurl)
{
if($mime== WEB)
{
$rets = "<form action=\"$pgurl.php\" method=\"get\">";
$rets .= "Jump to page <input name=\"page\" format=\"*N\" size=\"3\"/>";
$rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>";
$rets .= "<input type=\"hidden\" name=\"ses\" value=\"$ses\"/>";
$rets .= "<input type=\"submit\" value=\"[GO]\"/>";
$rets .= "</form>";
return $rets;
}else{
$rets = "Jump to page<input name=\"pg\" format=\"*N\" size=\"3\"/>";
$rets .= "<anchor>[GO]";
$rets .= "<go href=\"$pgurl.php\" method=\"get\">";
$rets .= "<postfield name=\"action\" value=\"$action\"/>";
$rets .= "<postfield name=\"ses\" value=\"$ses\"/>";
$rets .= "<postfield name=\"page\" value=\"$(pg)\"/>";
$rets .= "</go></anchor>";
return $rets;
}
}
function getunreadpm($uid)
{
$nopm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE touid='".$uid."' AND unread='1'"));
return $nopm[0];
}
function getnick_uid($uid)
{
$unick = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_users WHERE id='".$uid."'"));
return $unick[0];
}
function getsmilies($text)
{
$sql = "SELECT * FROM ibwf_smilies";
$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;
}
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;
}
function autopm($msg, $who)
{
mysql_query("INSERT INTO ibwf_private SET text='".$msg."', byuid='1', touid='".$who."', unread='1', timesent='".time()."'");
}
function addonline($uid,$place,$plclink)
{
/////delete inactive users
$tm = time();
$timeout = $tm - 420; //time out = 5 minutes
$deloff = mysql_query("DELETE FROM ibwf_online WHERE actvtime <'".$timeout."'");
///now try to add user to online list
$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."'");
if(!$res)
{
//most probably userid already in the online list
//so just update the place and time
$res = mysql_query("UPDATE ibwf_online SET actvtime='".$tm."', place='".$place."', placedet='".$plclink."' 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")."'");
}
}
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 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 getnumonline()
{
$nouo = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online "));
return $nouo[0];
}
function spacesin($word)
{
$pos = strpos($word," ");
if($pos === false)
{
return false;
}else
{
return true;
}
}
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;
}
function checkemail($email)
{
$regexp = "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$";
if (eregi($regexp, $email)) {
return true;
}
else
{
return false;
}
}
function getuid_nick($nick)
{
$uid = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_users WHERE name='".$nick."'"));
return $uid[0];
}
function getnick_ses($ses)
{
$uid = mysql_fetch_array(mysql_query("SELECT uid FROM ibwf_ses WHERE id='".$ses."'"));
$uid = $uid[0];
return getnick_uid($uid);
}
function getuid_ses($ses)
{
$uid = mysql_fetch_array(mysql_query("SELECT uid FROM ibwf_ses WHERE id='".$ses."'"));
$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];
}
function geturate($uid)
{
$pnts = 0;
//by blogs, posts per day, chats per day, gb signatures
if(ismod($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, credits, 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 getuage_ses($ses)
{
$uid = getuid_ses($ses);
$uage = mysql_fetch_array(mysql_query("SELECT birthday FROM ibwf_users WHERE id='".$uid."'"));
return getage($uage[0]);
}
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":
return "<img src=\"images/video.gif\" alt=\"video\"/>";
break;
default:
return "<img src=\"images/other.gif\" alt=\"!\"/>";
break;
}
}
function gettopicaf()
{
$getdata = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='topicaf'"));
return $getdata[0];
}
function getpostaf()
{
$getdata = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='postaf'"));
return $getdata[0];
}
function getmaxbuds()
{
$getdata = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='maxbuds'"));
return $getdata[0];
}
function gettimezone($uid)
{
$zone = mysql_fetch_array(mysql_query("SELECT timezone FROM ibwf_xinfo WHERE uid='".$uid."'"));
return $zone[0];
}
function unhtmlspecialchars( $string )
{
$string = str_replace ( '&', '&', $string );
$string = str_replace ( ''', '\'', $string );
$string = str_replace ( '"', '"', $string );
$string = str_replace ( '<', '<', $string );
$string = str_replace ( '>', '>', $string );
$string = str_replace ( 'ü', '?', $string );
$string = str_replace ( 'Ü', '?', $string );
$string = str_replace ( 'ä', '?', $string );
$string = str_replace ( 'Ä', '?', $string );
$string = str_replace ( 'ö', '?', $string );
$string = str_replace ( 'Ö', '?', $string );
return $string;
}
function unhtmlspecialchars2( $string )
{
$string = str_replace ( '&', '&', $string );
$string = str_replace ( ''', '\'', $string );
$string = str_replace ( '"', '"', $string );
$string = str_replace ( '<', '<', $string );
$string = str_replace ( '>', '>', $string );
$string = str_replace ( 'ü', '?', $string );
$string = str_replace ( 'Ü', '?', $string );
$string = str_replace ( 'ä', '?', $string );
$string = str_replace ( 'Ä', '?', $string );
$string = str_replace ( 'ö', '?', $string );
$string = str_replace ( 'Ö', '?', $string );
return $string;
}
function getbbcode($text, $ses="")
{
$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("/\[url\=(.*?)\](.*?)\[\/url\]/is","<a href=\"$1\">$2</a>",$text);
$text = preg_replace("/\[topic\=(.*?)\](.*?)\[\/topic\]/is","<a href=\"index.php?action=viewtpc&tid=$1&ses=$ses\">$2</a>",$text);
$text = preg_replace("/\[club\=(.*?)\](.*?)\[\/club\]/is","<a href=\"index.php?action=gocl&clid=$1&ses=$ses\">$2</a>",$text);
$text = preg_replace("/\[blog\=(.*?)\](.*?)\[\/blog\]/is","<a href=\"index.php?action=viewblog&bid=$1&ses=$ses\">$2</a>",$text);
//$text = ereg_replace("http://[A-Za-z0-9./=?-_]+","<a href=\"\\0\">\\0</a>", $text);
if(substr_count($text,"[br/]")<=3){
$text = str_replace("[br/]","<br/>",$text);
}
//$text = str_replace("2wap","2crapforwap",$text);
return $text;
}
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&msg=$msg\" alt=\"$cid\"/><br/>$textf";
}
function rand_pass($numchar)
{
$string = str_shuffle ("abcdefghijklmnopqrstuvwxyz1234567890");
$password = substr ($string, 1, $numchar);
return ($password);
}
function emailexist($email)
{
$checkmail = mysql_fetch_array(mysql_query("SELECT COUNT(*) from ibwf_users where email='".$email."'"));
if($checkmail[0]>0)
{
return true;
}else{
return false;
}
}
function getsbox($uid)
{
$sbox = mysql_fetch_array(mysql_query("SELECT sbox FROM ibwf_users WHERE id='".$uid."'"));
if($sbox[0]=="1")
{
return true;
}else{
return false;
}
}
function geticons($uid)
{
$icons = mysql_fetch_array(mysql_query("SELECT icons FROM ibwf_users WHERE id='".$uid."'"));
if($icons[0]=="1")
{
return true;
}else{
return false;
}
}
function getfont($uid)
{
$font = mysql_fetch_array(mysql_query("SELECT font FROM ibwf_users WHERE id='".$uid."'"));
if($font[0]=="1")
{
//normal
return 1;
}else if($font[0]=="0")
{
//small
return 0;
}else{
//bold
return 2;
}
}
function candelgal($uid, $item)
{
$candoit = mysql_fetch_array(mysql_query("SELECT uid FROM ibwf_gallery WHERE id='".$item."'"));
if($uid==$candoit[0]||ismod($uid))
{
return true;
}
return false;
}
function photoowner($uid, $item)
{
$candoit = mysql_fetch_array(mysql_query("SELECT uid FROM ibwf_gallery WHERE id='".$item."'"));
if($uid==$candoit[0])
{
return true;
}
return false;
}
function loginform($mime)
{
if($mime== WEB)
{
echo "<form action=\"login.php\" method=\"get\">";
echo "Username:";
echo "<br/>";
echo "<input type=\"text\" name=\"uid\" size=\"8\" maxlength=\"15\" />";
echo "<br/>";
echo "Password:";
echo "<br/>";
echo "<input type=\"password\" name=\"pwd\" size=\"8\" maxlength=\"15\" />";
echo "<br/>";
echo "<input type=\"hidden\" name=\"v\" value=\"$v\"/>";
echo "<input type=\"submit\" value=\"login\"/>";
echo "</form>";
}else{
echo "Username:";
echo "<br/>";
echo "<input type=\"text\" name=\"uid\" maxlength=\"15\" />";
echo "<br/>";
echo "Password:";
echo "<br/>";
echo "<input type=\"password\" name=\"pwd\" maxlength=\"15\" />";
echo "<br/>";
echo "<anchor>login<go href=\"login.php\" method=\"get\">";
echo "<postfield name=\"uid\" value=\"$(uid)\"/>";
echo "<postfield name=\"pwd\" value=\"$(pwd)\"/>";
echo "<postfield name=\"v\" value=\"$v\"/>";
echo "</go>";
echo "</anchor>";
}
}
function utheme($themeid)
{
$themeurl = mysql_fetch_array(mysql_query("SELECT theme FROM ibwf_themes WHERE id='".$themeid."'"));
return $themeurl[0];
}
Comment
Comment