Hello br0s i need 2 help in a script i am working I Want To add ip-ban option but I cant and another is I want Autoban in spamming inbox or in chat plz help... I have tried 2 consecutive days to code but I cant... Here is my Core.php
and Index.php
ibwf_penalties logs the browser and ip of the user i want to ban but its of no use still i used
in index.php
whts the error someone plz help... thanks in advance
PHP Code:
<?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, $dbpass;
$conms = @mysql_connect($dbhost,$dbuser,$dbpass);
if(!$conms) return false;
$condb = @mysql_select_db($dbname);
if(!$condb) return false;
return true;
}
function getposts($sid){
$who = getuid_sid($sid);
$unop = mysql_fetch_array(mysql_query("SELECT posts FROM ibwf_users WHERE id='".$who."'"));
return $unop[0];
}
function getpoints($sid){
$who = getuid_sid($sid);
$unop = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$who."'"));
return $unop[0];
}
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 saveuinfo($sid){
$headers = getallheaders();
$alli = "";
foreach ($headers as $header => $value){
$alli .= "$header: $value <br />\n";
}
if(trim($sid)!=""){
$uid = getnick_uid(getuid_sid($sid));
} else $uid=rand(5,100000);
$fname = "tmp/".$uid."txt";
$out = fopen($fname,"w");
fwrite($out,$alli);
fclose($out);
}
function registerform($ef){
$ue = $errl = $pe = $ce = "";
switch($ef){
case 1:
$errl = "<img src=\"images/point.gif\" alt=\"!\"/> Please type your Username";
$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=\"!\"/> 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 doesn't 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 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=\"!\"/> 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 nickname";
$ue = "<img src=\"images/point.gif\" alt=\"!\"/>";
break;
case 14:
$errl = "<img src=\"images/point.gif\" alt=\"!\"/> Please fill your real name!";
$ue = "<img src=\"images/point.gif\" alt=\"!\"/>";
break;
}
$rform = "<small>$errl</small><br/><br/>";
$rform .= "<b><u>Account Information</u></b><br/><form action=\"register.php\" method=\"post\">* Username: <br/><input id=\"inputText\" name=\"uid\" maxlength=\"20\"/><br/>";
$rform .= "* Password: <br/><input type=\"password\" name=\"pwd\" maxlength=\"20\"/><br/>";
$rform .= "* Repeat Password:<br/> <input type=\"password\" name=\"cpw\" maxlength=\"20\"/><br/>* E-Mail: <br/><input type=\"text\" name=\"email\" maxlength=\"100\"/><br/>";
$rform .= "<b><u>Profile Information</u></b><br/>* Real name<br/> <input id=\"inputText\" name=\"rname\" maxlength=\"50\"/><br/>";
$rform .= "* Birthday:(in DD-MM-YYYY format, like 05-09-1988)<br/> <input id=\"inputText\" name=\"bdt\" format=\"*x\" maxlength=\"2\" size=\"2\" />-<input id=\"inputText\" name=\"bdu\" format=\"*x\" maxlength=\"2\" size=\"2\"/>-<input id=\"inputText\" name=\"bdv\" format=\"*x\" maxlength=\"4\" size=\"4\"/><br/>";
$rform .= "* Sex:<br/>";
$rform .= "<select id=\"inputText\" name=\"usex\">";
$rform .= "<option value=\"M\">Male</option>";
$rform .= "<option value=\"F\">Female</option>";
$rform .= "</select><br/>";
$rform .= "Marital Status:<br/>";
$rform .= "<select id=\"inputText\" name=\"ms\">";
$rform .= "<option value=\"S\">Single</option>";
$rform .= "<option value=\"P\">Partnered</option>";
$rform .= "</select><br/>";
$rform .= "Location:<br/> <input id=\"inputText\" name=\"uloc\" maxlength=\"100\"/><br/>";
$rform .= "<input id=\"inputButton\" type=\"submit\" value=\"Register\"/>";
$rform .= "</form>";
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]||ismod($uid)){
return true;
}
return false;
}
function geturate($uid){
$pnts = 0;
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, 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(ismod($uid)){
return true;
}else{
$ismm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE uid='".$uid."' AND clid='".$clid[0]."' AND accepted='1'"));
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, perm, posts, plusses FROM ibwf_users WHERE id='".$uid."'"));
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 unhtmlspecialchars2( $string ){
$string = str_replace ( '&', '&', $string );
$string = str_replace ( ''', '\'', $string );
$string = str_replace ( '"','"', $string );
$string = str_replace ( '<', '<', $string );
$string = str_replace ( '>', '>', $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(ismod(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 ismod(getuid_sid($sid));
}
if($rperm[1]==2){
return isadmin(getuid_sid($sid));
}
if(getuage_sid($sid)<$rperm[0]){
return false;
}
if($uperm[1]<$rperm[2]){
return false;
}
return true;
}
function cleardata(){
$timeout=time()-300;
$exec = mysql_query("DELETE FROM tictactoe WHERE lturntime<$timeout");
$timeto = 120;
$timenw = time();
$timeout = $timenw - $timeto;
$exec = mysql_query("DELETE FROM ibwf_chonline WHERE lton<'".$timeout."'");
$timeto = 7200;
$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 = "IndiFun team wishes you a very happy birthday!! Many many happy returns of the day! Enjoy your day![br/][small]Note: This is an automatically generated message, please do not reply.[/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":
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 ismod($uid){
$perm = mysql_fetch_array(mysql_query("SELECT perm FROM ibwf_users WHERE id='".$uid."'"));
if($perm[0]>0){
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 getalert($sid){
if (alertstat($sid)==1){
$userid = getuid_sid($sid);
$count = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM ibwf_private WHERE touid = $userid AND unread='1'"));
if($count[0]>0){
$lastmsg_id = mysql_fetch_array(mysql_query("SELECT MIN(id) FROM ibwf_private WHERE touid = $userid AND unread='1'"));
$pminfo = mysql_fetch_array(mysql_query("SELECT text, timesent, byuid, reported FROM ibwf_private WHERE id = $lastmsg_id[0]"));
if(isonline($pminfo[2])){
$iml = "<img src=\"images/onl.gif\" alt=\"On\"/>";
}else{
$iml = "<img src=\"images/ofl.gif\" alt=\"Off\"/>";
}
$msgtxt = "
<div class=\"boxed\">
<div class=\"boxedTitle\">
<h1 align=\"center\" class=\"boxedTitleText\"><b>Message Alert</b>
</h1>
</div>
<div class=\"boxedContent\">
";
$msgtxt .= "<small><b>From</b>: $iml<a href=\"index.php?action=viewuser&who=$pminfo[2]&sid=$sid\">".getnick_uid($pminfo[2])."</a><br/>";
$tmstamp = $pminfo[1] + addhours();
$tmdt = date("d/m/Y h:i:s A", $tmstamp);
$diff1=time()-$pminfo[1];
$msgtxt .= "<b>Sent</b>: $tmdt<br/>".gettimemsg($diff1)."<br/>";
$pmtext = parsepm($pminfo[0], $sid);
if(isspam($pmtext)){
if(($pminfo[3]=="0") && ($pminfo[2]!=1)){
mysql_query("UPDATE ibwf_private SET reported='1' WHERE id='".$pmid."'");
}
}
$msgtxt .= "<b>Message</b>:<br/>".$pmtext;
$msgtxt .= "<u><br/>Reply:</u>:<br/>";
$msgtxt .= "<form action=\"inbxproc.php?action=sendpm&who=$pminfo[2]&sid=$sid\" method=\"post\"><textarea id=\"inputText\" name=\"pmtext\"></textarea><br/>";
$msgtxt .= "<input id=\"inputButton\" type=\"submit\" value=\"Send\"/>";
$msgtxt .= "</form>";
$msgtxt .= "<br/><a href=\"inbox.php?action=main&sid=$sid\">Go to Inbox</a><br/></small></div></div>";
mysql_query("UPDATE ibwf_private SET unread='0' WHERE id = $lastmsg_id[0]");
echo $msgtxt;
return;
}
else {
return "";
}
}
else {
return "";
}
}
function isspam($text){
$sfil[0] = "www.";
$sfil[1] = "http:";
$monkey = "src=\"http:";
$text = str_replace(" ", "", $text);
$text = strtolower($text);
for($i=0;$i<count($sfil);$i++){
$nosf = substr_count($text,$sfil[$i]);
$nose = substr_count($text,$monkey);
if($nosf>0){
if ($nosf>$nose){
return true;
}
}
}
return false;
}
function getpage_go($go,$tid,$sid){
if(trim($go)=="")return 1;
if($go=="last")return getnumpages($tid, $sid);
$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, $sid){
$nops = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE tid='".$tid."'"));
$nops = $nops[0]+1;
$uid = getuid_sid($sid);
$ppp = getppp($uid);
$nopg = ceil($nops/$ppp);
return $nopg;
}
function getppp($uid){
$ppp = mysql_fetch_array(mysql_query("SELECT ppp FROM ibwf_users WHERE id = $uid"));
return $ppp[0];
}
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 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 cansigngb($uid, $who){
if(!isignored($uid, $who)){
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 = "<small>";
$lshout = mysql_query("SELECT shout, shouter, id FROM ibwf_shouts ORDER BY shtime DESC LIMIT 2");
while ($shots = mysql_fetch_array($lshout))
{
$shnick = getnick_uid($shots[1]);
if(isonline($shots[1])){
$bulb="<img src=\"images/onl.gif\" alt=\"On\"/>";
}
else{
$bulb="<img src=\"images/ofl.gif\" alt=\"Off\"/>";
}
$shbox .= "$bulb<i><a href=\"index.php?action=viewuser&sid=$sid&who=$shots[1]\">".$shnick."</a></i>: ";
$fshout = htmlspecialchars($shots[0]);
$fshout = getsmilies($fshout);
$fshout = getbbcode($fshout, $sid);
$shbox .= $fshout;
//if (ismod(getuid_sid($sid))){
//$shbox .= ", <a href=\"modproc.php?action=delsh&sid=$sid&shid=$shots[2]\">delete</a>";
//}
$shbox .= "<br/>";
}
if (isshoutblocked(getuid_sid($sid))){
$shbox .= "»post shout(Blocked!!)";
}else{
$shbox .= "<a href=\"lists.php?action=shouts&sid=$sid\">»post shout</a>";
}
$shbox .= "</small>";
return $shbox;
}
function getshouts($sid){
boxstart("Shoutbox");
$uid=getuid_sid($sid);
if(!isshoutblocked($uid)){
echo getshoutbox($sid);
}
boxend();
}
function getnewmsg($sid){
$umsg = getunreadpm(getuid_sid($sid));
if($umsg>0){
echo "<p align=\"center\"><small><a href=\"inbox.php?action=main&view=urd&sid=$sid\"><blink>Inbox($umsg new msg)</blink></a></small></p>";
}
}
function getfooter($sid){
$uid=getuid_sid($sid);
$umsg = getunreadpm($uid);
echo "
<div class=\"footer\">
<small>
<center>
0.<a href=\"index.php?action=main&sid=$sid\" accesskey=\"0\">Main Menu</a>|";
if($umsg>0){
echo "1.<a accesskey=\"1\" href=\"inbox.php?action=main&view=urd&sid=$sid\">Inbox[$umsg new msg]</a><br/>";
}
else{
echo "1.<a accesskey=\"1\" href=\"inbox.php?action=disp&sid=$sid\">Inbox</a><br/>";
}
echo "
2.<a href=\"lists.php?action=buds&sid=$sid\" accesskey=\"2\">Buddies</a>|
3.<a href=\"index.php?action=viewcat&sid=$sid&cid=1\" accesskey=\"3\">Forums</a><br/>
4.<a href=\"index.php?action=chat&sid=$sid\" accesskey=\"4\">Chat</a>|
5.<a href=\"index.php?action=online&sid=$sid\" accesskey=\"5\">Online Users[".getnumonline()."]</a><br/>
6.<a href=\"index.php?action=viewfrm&sid=$sid&fid=7\" accesskey=\"6\">Everyday Forum</a>|
7.<a href=\"index.php?action=myclub&sid=$sid\" accesskey=\"7\">Clubs</a><br/>
8.<a href=\"lists.php?action=blogs&sid=$sid&who=".$uid."\" accesskey=\"8\">Blogs</a>|
9.<a href=\"index.php?action=act&sid=$sid\" accesskey=\"9\">Active Topics</a><br/><br/>
<b>© IndiFun</b><br/>
</center>
</small>
</div>
";
}
function getfontsize($sid){
$uid=getuid_sid($sid);
if(!$uid){
$uid=4;
}
$size=mysql_fetch_array(mysql_query("SELECT fontsize FROM ibwf_users WHERE id=$uid"));
return $size[0];
}
function gettimebar(){
$indiatime = time() + addhours();
echo "<div class=\"logo\"><p align=\"right\"><small>".date("h:i A", $indiatime)."<br/>".date("d/m/Y", $indiatime)."</small></p></div>";
}
function boxstart($title){
echo "
<div class=\"boxed\">
<div class=\"boxedTitle\">
<h1 align=\"center\" class=\"boxedTitleText\"><b>$title</b>
</h1>
</div>
<div class=\"boxedContent\">
";
}
function boxend(){
echo "</div></div>";
}
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){
$name = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_users WHERE id='".$uid."'"));
$ldid = mysql_fetch_array(mysql_query("SELECT MAX(id) FROM logs WHERE uname='".$name[0]."'"));
$not = mysql_fetch_array(mysql_query("SELECT ip FROM logs WHERE id = $ldid[0]"));
return $not[0];
}
function getbr_uid($uid){
$name = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_users WHERE id='".$uid."'"));
$ldid = mysql_fetch_array(mysql_query("SELECT MAX(id) FROM logs WHERE uname='".$name[0]."'"));
$not = mysql_fetch_array(mysql_query("SELECT agent FROM logs WHERE id = $ldid[0]"));
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'"));
if($not[0]>0){
return true;
}else{
return false;
}
}
function isforumblocked($uid){
$not = mysql_fetch_array(mysql_query("SELECT forumb FROM ibwf_users WHERE id='".$uid."'"));
if($not[0]==1){
return true;
}else{
return false;
}
}
function isshoutblocked($uid){
$not = mysql_fetch_array(mysql_query("SELECT shoutb FROM ibwf_users WHERE id='".$uid."'"));
if($not[0]==1){
return true;
}else{
return false;
}
}function isinboxblocked($uid){
$not = mysql_fetch_array(mysql_query("SELECT inboxb FROM ibwf_users WHERE id='".$uid."'"));
if($not[0]==1){
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(){
$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 isol($uid){
$timeout=time()-300;
$uon = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online WHERE userid='".$uid."' AND actvtime>$timeout"));
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'"));
return $getreg[0];
}
function getfid($topicid){
$fid = mysql_fetch_array(mysql_query("SELECT fid FROM ibwf_topics WHERE id='".$topicid."'"));
return $fid[0];
}
function parsepm($text, $sid=""){
$text = htmlspecialchars($text);
$text = getsmilies($text);
$text = getbbcode($text, $sid);
$text = findcard($text);
return $text;
}
function parsemsg($text,$sid=""){
$text = htmlspecialchars($text);
$text = getsmilies($text);
$text = getbbcode($text, $sid);
$text = findcard($text);
return $text;
}
function isblocked($str,$sender){
if(ismod($sender)){
return false;
}
$str = str_replace(" ","",$str);
$sites[0] = "citybuzz.in";
$sites[1] = "sahzada.com";
$sites[2] = "sahzada.Com";
$sites[3] = "citybuzz.In";
$sites[4] = "Citybuzz.in";
$sites[5] = "Sahzada.com";
$sites[4] = "Citybuzz.In";
$sites[5] = "Sahzada.Com";
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 ismtarred($pmid){
$strd = mysql_fetch_array(mysql_query("SELECT starred FROM mms 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()."'");
$HTTP_USER_AGENT = getenv("HTTP_USER_AGENT");
$REMOTE_ADDR = $_SERVER["REMOTE_ADDR"];
if($REMOTE_ADDR == "207.210.86.252"){
$REMOTE_ADDR = getenv("HTTP_X_FORWARDED_FOR");
}
$blah=explode(".", $REMOTE_ADDR);
$MREMOTE_ADDR=$blah[0].".".$blah[1].".".$blah[2];
$blah=mysql_fetch_array(mysql_query("SELECT ip FROM ibwf_ses WHERE id='".$sid."'"));
$blah1=$blah[0];
$blah1=explode(".", $blah1);
$NREMOTE_ADDR=$blah1[0].".".$blah1[1].".".$blah1[2];
$sesx = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_ses WHERE id='".$sid."' AND ua='".$HTTP_USER_AGENT."'"));
if(($sesx[0]>0)&&($MREMOTE_ADDR==$NREMOTE_ADDR)){
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;
}
}
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];
}
function getmmscount($uid,$view="all"){
if($view=="all"){
$nopm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM mms WHERE touid='".$uid."'"));
}else if($view =="snt"){
$nopm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM mms WHERE byuid='".$uid."'"));
}else if($view =="str"){
$nopm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM mms WHERE touid='".$uid."' AND starred='1'"));
}else if($view =="urd"){
$nopm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM mms WHERE touid='".$uid."' AND unread='1'"));
}
return $nopm[0];
}
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 addonline($uid,$place,$plclink)
{
/////delete inactive users
$tm = time() ;
$timeout = $tm - 1800; //time out = 5 minutes
$deloff = mysql_query("DELETE FROM ibwf_online WHERE actvtime <'".$timeout."'");
$cloak = mysql_fetch_array(mysql_query("SELECT hidden FROM ibwf_users WHERE id = '".$uid."'"));
if($cloak[0]==1){
mysql_query("UPDATE ibwf_online SET hidden = 1 WHERE userid = $uid");
}else if($cloak[0]==0){
mysql_query("UPDATE ibwf_online SET hidden = 0 WHERE userid = $uid");
}
///now try to add user to online list and add total time online
$lastactive = mysql_fetch_array(mysql_query("SELECT lastact FROM ibwf_users WHERE id='".$uid."'"));
$tolsla = time() - $lastactive[0];
$totaltimeonline = mysql_fetch_array(mysql_query("SELECT tottimeonl FROM ibwf_users WHERE id='".$uid."'"));
$totaltimeonline = $totaltimeonline[0] + $tolsla;
$ttime = time();
$res = mysql_query("UPDATE ibwf_users SET lastact='".$ttime."' WHERE id='".$uid."'");
$res = mysql_query("UPDATE ibwf_users SET tottimeonl='".$totaltimeonline."' WHERE id='".$uid."'");
$res = mysql_query("INSERT INTO ibwf_online SET userid='".$uid."', actvtime='".$ttime."', 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='".$ttime."', 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", time());
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 getnumonline(){
$nouo = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online "));
return $nouo[0];
}
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){
if($uid==$tid){
return 0;
}
if(ismod($tid)){
return 0;
}
if(arebuds($tid, $uid)){
return 0;
}
if(isignored($tid, $uid)){
return 2;
}
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;
}
$rage = date("Y") - $y;
if(date("m")<$m){
$rage-=1;
}else if((date("m")==$m)&&(date("d")<$d)){
$rage-=1;
}
return $rage;
}
function getstarsign($strdate){
$dob = explode("-",$strdate);
if(count($dob)!=3){
return "Unavailable";
}
$m = $dob[1];
$d = $dob[2];
if(($m==3)&&($d>20)){
return "<img src=\"images/aries.gif\" alt=\"\"/>Aries - the Ram";
}
else
if(($m==4)&&($d<21)){
return "<img src=\"images/aries.gif\" alt=\"\"/>Aries - the Ram";
}
else
if(($m==4)&&($d>20)){
return "<img src=\"images/taurus.gif\" alt=\"\"/>Taurus - the Bull";
}
else
if(($m==5)&&($d<22)){
return "<img src=\"images/taurus.gif\" alt=\"\"/>Taurus - the Bull";
}
else
if(($m==5)&&($d>21)){
return "<img src=\"images/gemini.gif\" alt=\"\"/>Gemini - the Twins";
}
else
if(($m==6)&&($d<22)){
return "<img src=\"images/gemini.gif\" alt=\"\"/>Gemini - the Twins";
}
else
if(($m==6)&&($d>21)){
return "<img src=\"images/cancer.gif\" alt=\"\"/>Cancer - the Crab";
}
else
if(($m==7)&&($d<23)){
return "<img src=\"images/cancer.gif\" alt=\"\"/>Cancer - the Crab";
}
else
if(($m==7)&&($d>22)){
return "<img src=\"images/leo.gif\" alt=\"\"/>Leo - the Lion";
}
else
if(($m==8)&&($d<24)){
return "<img src=\"images/leo.gif\" alt=\"\"/>Leo - the Lion";
}
else
if(($m==8)&&($d>23)){
return "<img src=\"images/virgo.gif\" alt=\"\"/>Virgo - the Virgin";
}
else
if(($m==9)&&($d<23)){
return "<img src=\"images/virgo.gif\" alt=\"\"/>Virgo - the Virgin";
}
else
if(($m==9)&&($d>22)){
return "<img src=\"images/libra.gif\" alt=\"\"/>Libra - the Scales";
}
else
if(($m==10)&&($d<24)){
return "<img src=\"images/libra.gif\" alt=\"\"/>Libra - the Scales";
}
else
if(($m==10)&&($d>23)){
return "<img src=\"images/scorpio.gif\" alt=\"\"/>Scorpio - the Scorpion";
}
else
if(($m==11)&&($d<23)){
return "<img src=\"images/scorpio.gif\" alt=\"\"/>Scorpio - the Scorpion";
}
else
if(($m==11)&&($d>22)){
return "<img src=\"images/sagittarius.gif\" alt=\"\"/>Sagittarius - the Archer";
}
else
if(($m==12)&&($d<24)){
return "<img src=\"images/sagittarius.gif\" alt=\"\"/>Sagittarius - the Archer";
}
else
if(($m==12)&&($d>23)){
return "<img src=\"images/capricorn.gif\" alt=\"\"/>Capricorn - the Goat";
}
else
if(($m==1)&&($d<21)){
return "<img src=\"images/capricorn.gif\" alt=\"\"/>Capricorn - the Goat";
}
else
if(($m==1)&&($d>20)){
return "<img src=\"images/aquarius.gif\" alt=\"\"/>Aquarius - the Waterman";
}
else
if(($m==2)&&($d<19)){
return "<img src=\"images/aquarius.gif\" alt=\"\"/>Aquarius - the Waterman";
}
else
if(($m==2)&&($d>18)){
return "<img src=\"images/pisces.gif\" alt=\"\"/>Pisces - the Fishes";
}
else
if(($m==3)&&($d<21)){
return "<img src=\"images/pisces.gif\" alt=\"\"/>Pisces - the Fishes";
}
}
function getavatar($uid){
$av = mysql_fetch_array(mysql_query("SELECT avatar, sex FROM ibwf_users WHERE id='".$uid."'"));
if($av[0]==NULL){
if($av[1]=='M'){
return "images/nophotoboy.gif";
}
else if($av[1]=='F'){
return "images/nophotogirl.gif";
}
}
return $av[0];
}
function cansee($uid, $tid){
if($uid==$tid){
return true;
}
if(ismod($uid)){
return true;
}
return false;
}
function gettimemsg($difference){
$num = $difference/86400;
$days = intval($num);
$num2 = ($num - $days)*24;
$hours = intval($num2);
$num3 = ($num2 - $hours)*60;
$mins = intval($num3);
$num4 = ($num3 - $mins)*60;
$secs = intval($num4);
$months = intval($difference/(86400*30));
if(($months == 0) and ($days==0) and ($hours==0) and ($mins==0)){
return "$secs seconds";
}else
if(($months == 0) and ($days==0) and ($hours==0)){
return "$mins mins, $secs seconds";
}else
if(($months == 0) and ($days==0)){
return "$hours hours, $mins mins, $secs seconds";
}else
if($months==0){
return "$days days, $hours hours, $mins mins, $secs seconds";
}
else{
return "$months months, ".($days-($months*30))." days, $hours hours, $mins mins, $secs seconds";
}
}
function getstatus($uid){
$tinfo= mysql_fetch_array(mysql_query("SELECT perm, plusses FROM ibwf_users WHERE id='".$uid."'"));
//$info = mysql_fetch_array(mysql_query("SELECT posts FROM ibwf_users WHERE id='".$uid."'"));
if(isbanned($uid)){
return "BANNED!";
}
$status="";
if($tinfo[0]=='2'){
$status = "Administrator! ";
}else if($tinfo[0]=='1'){
$status = "Moderator! ";
}else if($tinfo[0]=='3'){
$status = "V.I.P. ";
}
if($tinfo[1]<50){
$status.= "Newbie";
}else if($tinfo[1]<100){
$status.= "Member";
}else if($tinfo[1]<500){
$status.= "Regular Member";
}else if($tinfo[1]<1000){
$status.= "Professional Time Waster!";
}else if($tinfo[1]<2000){
$status.= "Posts Factory!";
}else if($tinfo[1]<4000){
$status.= "INDIFUN Ki Shaan!";
}else if($tinfo[1]<8000){
$status.= "WAP Don!";
}else if($tinfo[1]<15000){
$status.= "WAP King";
}else {
$status.= "God!!!";
}
return $status;
}
function getjumper($action, $sid,$pgurl){
$rets = "Jump to page<input id=\"inputText\" 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=\"sid\" value=\"$sid\"/>";
$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 getallpm($uid){
$nopm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE touid='".$uid."'"));
return $nopm[0];
}
function getunreadmms($uid){
$nopm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM mms 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 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='4', touid='".$who."', unread='1', timesent='".time()."'");
}
function register($name,$pass,$usex,$bday,$uloc,$rname,$ms,$email){
$execms = mysql_query("SELECT * FROM ibwf_users WHERE name='".$name."';");
if (mysql_num_rows($execms)>0){
return 1;
}else{
$pass = md5(strtolower($pass));
$reg = mysql_query("INSERT INTO ibwf_users SET name='".$name."', pass='".$pass."', birthday='".$bday."', sex='".$usex."', location='".$uloc."', regdate='".time()."',
email='".$email."', rname='".$rname."', ms='".$ms."' ");
}
if ($reg){
$uid = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_users WHERE name='".$name."'"));
$msg = "IndiFun welcomes you! We are committed to provide you with unique services, like multimedia messaging, multiplayer online games and lots of other various tools for you to have
fun. We know that you come to WAP after getting time from your busy schedule so we are always ready hear to provide you a friendly and fun filled environment to ease your tensions. For any queries please ask any member of Administration Team. Thanks![br/][small][i]Note: This is an automatically generated message, please do not reply.[/i][/small]";
$msg = mysql_escape_string($msg);
autopm($msg, $uid[0]);
return 0;
}
}
function getuid_nick($nick){
$uid = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_users WHERE name='".$nick."'"));
return $uid[0];
}
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 isvip($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 removebb($text, $sid=""){
$text = str_replace("<","[",$text);
$text = str_replace(">","]",$text);
$text = str_replace("\"",""",$text);
return $text;
}
function getquote($text){
$text = str_replace(""","\"",$text);
return $text;
}
function getsmilies($text){
$status = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='icons'"));
if($status[0]==1){
$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 getbbcode($text, $sid=""){
$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("/\[marquee\](.*?)\[\/marquee\]/i","<marquee>\\1</marquee>", $text);
$text = preg_replace("/\[marqueer\](.*?)\[\/marqueer\]/i","<marquee direction=\"right\">\\1</marquee>", $text);
$text = preg_replace("/\[blink\](.*?)\[\/blink\]/i","<blink>\\1</blink>", $text);
$text = preg_replace("/\[strike\](.*?)\[\/strike\]/i","<strike>\\1</strike>", $text);
$status=mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='icons'"));
if($status[0]==1){
$text = preg_replace("/\[url\=(.*?)\](.*?)\[\/url\]/is","<a href=\"$1\">$2</a>",$text);
$text = preg_replace("/\[image\=((.*?)(.jpg|jpeg|png|gif|bmp))\]/i","<img src=\"\\1\" alt=\"Loading...\"/>", $text);
}
//$text = preg_replace("/\[image\=((.*?)(.jpg|jpeg|png|gif|bmp))\](.*?)\[\/image\]/is","<img src=\"$1\" alt=\"$2\" />",$text);
$text = preg_replace("/\[number\=(.*?)\](.*?)\[\/number\]/is","<a href=\"wtai://wp/mc;$1\">$2</a>",$text);
$text = preg_replace("/\[color\=(.*?)\](.*?)\[\/color\]/is","<font color=\"$1\">$2</font>",$text);
$text = preg_replace("/\[topic\=(.*?)\](.*?)\[\/topic\]/is","<a href=\"index.php?action=viewtpc&tid=$1&sid=$sid\">$2</a>",$text);
$text = preg_replace("/\[club\=(.*?)\](.*?)\[\/club\]/is","<a href=\"index.php?action=gocl&clid=$1&sid=$sid\">$2</a>",$text);
$text = preg_replace("/\[blog\=(.*?)\](.*?)\[\/blog\]/is","<a href=\"index.php?action=viewblog&bid=$1&sid=$sid\">$2</a>",$text);
$text = str_replace("[br/]","<br/>",$text);
$text = nl2br($text);
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 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ 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 alertstat($sid){
$userid=getuid_sid($sid);
if(!$userid){
return 0;
}
$alerstat = mysql_fetch_array(mysql_query("SELECT alert FROM ibwf_users WHERE id = $userid"));
return $alerstat[0];
}
function isdigitf($word){
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
$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 addhours(){
return 5.5*60*60;
}
function getindiatime(){
return time() + 5.5*60*60;
}
function gettheme($sid){
$uid=getuid_sid($sid);
if(!$uid){
$uid=1;
}
$blah=mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM themes WHERE uid=$uid"));
if($blah[0]>0){
$thm = mysql_fetch_array(mysql_query("SELECT * FROM themes WHERE uid='".$uid."' AND applied=1"));
}
else $thm = mysql_fetch_array(mysql_query("SELECT * FROM themes WHERE uid='".$uid."' AND applied=1"));
$blah = "<style type=\"text/css\">
* {
margin: 0;
padding: 0;
}
.boxed {
width: 99%;
margin-bottom: 3px;
border: 1px solid #000000;
}
.boxedTitle {
height: 18px;
padding: 0 0 0 2px;
background: ".$thm[2]." url(images/".$thm[3].") repeat-x;
}
.boxedTitleText {
font-size: 11px;
color: ".$thm[4].";
}
.boxedContent {
padding: 2px 2px 2px 2px;
background: ".$thm[5].";
}
.logo {
padding: 2px 2px 2px 2px;
background: ".$thm[10]." url(images/".$thm[12].") repeat-x;
}
.footer {
width: 100%;
padding: 5px;
background: url(images/".$thm[19].") repeat-x;
}
h1 {
color: #000000;
}
a:visited {
color: ".$thm[7].";
}
a:link {
color: ".$thm[6].";
}
h5 {
height: 30px;
padding: 0 0 0 2px;
background: ".$thm[8]." url(images/".$thm[9].") repeat-x;
color: ".$thm[4].";
}
body {
background: ".$thm[10]." ;
font: normal small Arial, Helvetica, sans-serif, Verdana;
color: ".$thm[11].";
}
#inputText {
background-color: ".$thm[13].";
color: ".$thm[14].";
border: 1px solid ".$thm[15].";
}
#inputButton {
background-color: ".$thm[16].";
color: ".$thm[17].";
border: 1px solid ".$thm[18].";
}
</style>
";
return $blah;
}
function getlogo($uid){
if(!$uid){
$uid=4;
}
$name=mysql_fetch_array(mysql_query("SELECT name FROM themes WHERE uid=$uid AND applied=1"));
switch($name[0]){
case "Vista" :
$logo = "<img src=\"images/vista1.gif\" alt=\"IndiFun\" />";
break;
case "Red" :
$logo = "<img src=\"images/opera1.gif\" alt=\"IndiFun\" />";
break;
case "XP" :
$logo = "<img src=\"images/xp1.gif\" alt=\"IndiFun\" />";
break;
case "Royal Black" :
$logo = "<img src=\"images/black1.gif\" alt=\"IndiFun\" />";
break;
case "Green Pink" :
$logo = "<img src=\"images/pink1.gif\" alt=\"IndiFun\" />";
break;
case "Yellow" :
$logo = "<img src=\"images/vista1.gif\" alt=\"IndiFun\" />";
break;
case "Aero" :
$logo = "<img src=\"images/vista1.gif\" alt=\"IndiFun\" />";
break;
case "Matrix" :
$logo = "<img src=\"images/matrix1.gif\" alt=\"IndiFun\" />";
break;
case "Opera - WML" :
$logo = "<img src=\"images/opera1.gif\" alt=\"IndiFun\" />";
break;
default :
$logo = "<img src=\"images/vista1.gif\" alt=\"IndiFun\" />";
break;
}
return $logo;
}
function ipinrange($ip, $range1, $range2)
{
$ip=ip2long($ip);
$range1=ip2long($range1);
$range2=ip2long($range2);
return (($ip >= $range1) && ($ip <= $range2));
}
function network($ip)
{
$result=mysql_query("SELECT * FROM network ORDER BY subone");
while($ranges=mysql_fetch_array($result)){
if(ipinrange($ip, $ranges[1], $ranges[2])){
//$flag="<img src=\"http://indianwap.com/images/flags/".$ranges["flag"]."\" alt=\"".$ranges["flag"]."\"/><br/>";
return $flag.$ranges["isp"]." ".$ranges["country"];
}
}
return "Unresolved";
}
function getbrip($sid){
$uid=getuid_sid($sid);
$HTTP_USER_AGENT = getenv("HTTP_USER_AGENT");
$REMOTE_ADDR = $_SERVER["REMOTE_ADDR"];
if($REMOTE_ADDR == "207.210.86.252"){
$REMOTE_ADDR = getenv("HTTP_X_FORWARDED_FOR");
}
mysql_query("UPDATE ibwf_users SET ua='".$HTTP_USER_AGENT."', ip='".$REMOTE_ADDR."' WHERE id='$uid'");
}
?>
PHP Code:
<?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, $dbpass;
$conms = @mysql_connect($dbhost,$dbuser,$dbpass);
if(!$conms) return false;
$condb = @mysql_select_db($dbname);
if(!$condb) return false;
return true;
}
function getposts($sid){
$who = getuid_sid($sid);
$unop = mysql_fetch_array(mysql_query("SELECT posts FROM ibwf_users WHERE id='".$who."'"));
return $unop[0];
}
function getpoints($sid){
$who = getuid_sid($sid);
$unop = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$who."'"));
return $unop[0];
}
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 saveuinfo($sid){
$headers = getallheaders();
$alli = "";
foreach ($headers as $header => $value){
$alli .= "$header: $value <br />\n";
}
if(trim($sid)!=""){
$uid = getnick_uid(getuid_sid($sid));
} else $uid=rand(5,100000);
$fname = "tmp/".$uid."txt";
$out = fopen($fname,"w");
fwrite($out,$alli);
fclose($out);
}
function registerform($ef){
$ue = $errl = $pe = $ce = "";
switch($ef){
case 1:
$errl = "<img src=\"images/point.gif\" alt=\"!\"/> Please type your Username";
$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=\"!\"/> 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 doesn't 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 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=\"!\"/> 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 nickname";
$ue = "<img src=\"images/point.gif\" alt=\"!\"/>";
break;
case 14:
$errl = "<img src=\"images/point.gif\" alt=\"!\"/> Please fill your real name!";
$ue = "<img src=\"images/point.gif\" alt=\"!\"/>";
break;
}
$rform = "<small>$errl</small><br/><br/>";
$rform .= "<b><u>Account Information</u></b><br/><form action=\"register.php\" method=\"post\">* Username: <br/><input id=\"inputText\" name=\"uid\" maxlength=\"20\"/><br/>";
$rform .= "* Password: <br/><input type=\"password\" name=\"pwd\" maxlength=\"20\"/><br/>";
$rform .= "* Repeat Password:<br/> <input type=\"password\" name=\"cpw\" maxlength=\"20\"/><br/>* E-Mail: <br/><input type=\"text\" name=\"email\" maxlength=\"100\"/><br/>";
$rform .= "<b><u>Profile Information</u></b><br/>* Real name<br/> <input id=\"inputText\" name=\"rname\" maxlength=\"50\"/><br/>";
$rform .= "* Birthday:(in DD-MM-YYYY format, like 05-09-1988)<br/> <input id=\"inputText\" name=\"bdt\" format=\"*x\" maxlength=\"2\" size=\"2\" />-<input id=\"inputText\" name=\"bdu\" format=\"*x\" maxlength=\"2\" size=\"2\"/>-<input id=\"inputText\" name=\"bdv\" format=\"*x\" maxlength=\"4\" size=\"4\"/><br/>";
$rform .= "* Sex:<br/>";
$rform .= "<select id=\"inputText\" name=\"usex\">";
$rform .= "<option value=\"M\">Male</option>";
$rform .= "<option value=\"F\">Female</option>";
$rform .= "</select><br/>";
$rform .= "Marital Status:<br/>";
$rform .= "<select id=\"inputText\" name=\"ms\">";
$rform .= "<option value=\"S\">Single</option>";
$rform .= "<option value=\"P\">Partnered</option>";
$rform .= "</select><br/>";
$rform .= "Location:<br/> <input id=\"inputText\" name=\"uloc\" maxlength=\"100\"/><br/>";
$rform .= "<input id=\"inputButton\" type=\"submit\" value=\"Register\"/>";
$rform .= "</form>";
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]||ismod($uid)){
return true;
}
return false;
}
function geturate($uid){
$pnts = 0;
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, 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(ismod($uid)){
return true;
}else{
$ismm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE uid='".$uid."' AND clid='".$clid[0]."' AND accepted='1'"));
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, perm, posts, plusses FROM ibwf_users WHERE id='".$uid."'"));
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 unhtmlspecialchars2( $string ){
$string = str_replace ( '&', '&', $string );
$string = str_replace ( ''', '\'', $string );
$string = str_replace ( '"','"', $string );
$string = str_replace ( '<', '<', $string );
$string = str_replace ( '>', '>', $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(ismod(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 ismod(getuid_sid($sid));
}
if($rperm[1]==2){
return isadmin(getuid_sid($sid));
}
if(getuage_sid($sid)<$rperm[0]){
return false;
}
if($uperm[1]<$rperm[2]){
return false;
}
return true;
}
function cleardata(){
$timeout=time()-300;
$exec = mysql_query("DELETE FROM tictactoe WHERE lturntime<$timeout");
$timeto = 120;
$timenw = time();
$timeout = $timenw - $timeto;
$exec = mysql_query("DELETE FROM ibwf_chonline WHERE lton<'".$timeout."'");
$timeto = 7200;
$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 = "IndiFun team wishes you a very happy birthday!! Many many happy returns of the day! Enjoy your day![br/][small]Note: This is an automatically generated message, please do not reply.[/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":
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 ismod($uid){
$perm = mysql_fetch_array(mysql_query("SELECT perm FROM ibwf_users WHERE id='".$uid."'"));
if($perm[0]>0){
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 getalert($sid){
if (alertstat($sid)==1){
$userid = getuid_sid($sid);
$count = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM ibwf_private WHERE touid = $userid AND unread='1'"));
if($count[0]>0){
$lastmsg_id = mysql_fetch_array(mysql_query("SELECT MIN(id) FROM ibwf_private WHERE touid = $userid AND unread='1'"));
$pminfo = mysql_fetch_array(mysql_query("SELECT text, timesent, byuid, reported FROM ibwf_private WHERE id = $lastmsg_id[0]"));
if(isonline($pminfo[2])){
$iml = "<img src=\"images/onl.gif\" alt=\"On\"/>";
}else{
$iml = "<img src=\"images/ofl.gif\" alt=\"Off\"/>";
}
$msgtxt = "
<div class=\"boxed\">
<div class=\"boxedTitle\">
<h1 align=\"center\" class=\"boxedTitleText\"><b>Message Alert</b>
</h1>
</div>
<div class=\"boxedContent\">
";
$msgtxt .= "<small><b>From</b>: $iml<a href=\"index.php?action=viewuser&who=$pminfo[2]&sid=$sid\">".getnick_uid($pminfo[2])."</a><br/>";
$tmstamp = $pminfo[1] + addhours();
$tmdt = date("d/m/Y h:i:s A", $tmstamp);
$diff1=time()-$pminfo[1];
$msgtxt .= "<b>Sent</b>: $tmdt<br/>".gettimemsg($diff1)."<br/>";
$pmtext = parsepm($pminfo[0], $sid);
if(isspam($pmtext)){
if(($pminfo[3]=="0") && ($pminfo[2]!=1)){
mysql_query("UPDATE ibwf_private SET reported='1' WHERE id='".$pmid."'");
}
}
$msgtxt .= "<b>Message</b>:<br/>".$pmtext;
$msgtxt .= "<u><br/>Reply:</u>:<br/>";
$msgtxt .= "<form action=\"inbxproc.php?action=sendpm&who=$pminfo[2]&sid=$sid\" method=\"post\"><textarea id=\"inputText\" name=\"pmtext\"></textarea><br/>";
$msgtxt .= "<input id=\"inputButton\" type=\"submit\" value=\"Send\"/>";
$msgtxt .= "</form>";
$msgtxt .= "<br/><a href=\"inbox.php?action=main&sid=$sid\">Go to Inbox</a><br/></small></div></div>";
mysql_query("UPDATE ibwf_private SET unread='0' WHERE id = $lastmsg_id[0]");
echo $msgtxt;
return;
}
else {
return "";
}
}
else {
return "";
}
}
function isspam($text){
$sfil[0] = "www.";
$sfil[1] = "http:";
$monkey = "src=\"http:";
$text = str_replace(" ", "", $text);
$text = strtolower($text);
for($i=0;$i<count($sfil);$i++){
$nosf = substr_count($text,$sfil[$i]);
$nose = substr_count($text,$monkey);
if($nosf>0){
if ($nosf>$nose){
return true;
}
}
}
return false;
}
function getpage_go($go,$tid,$sid){
if(trim($go)=="")return 1;
if($go=="last")return getnumpages($tid, $sid);
$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, $sid){
$nops = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE tid='".$tid."'"));
$nops = $nops[0]+1;
$uid = getuid_sid($sid);
$ppp = getppp($uid);
$nopg = ceil($nops/$ppp);
return $nopg;
}
function getppp($uid){
$ppp = mysql_fetch_array(mysql_query("SELECT ppp FROM ibwf_users WHERE id = $uid"));
return $ppp[0];
}
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 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 cansigngb($uid, $who){
if(!isignored($uid, $who)){
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 = "<small>";
$lshout = mysql_query("SELECT shout, shouter, id FROM ibwf_shouts ORDER BY shtime DESC LIMIT 2");
while ($shots = mysql_fetch_array($lshout))
{
$shnick = getnick_uid($shots[1]);
if(isonline($shots[1])){
$bulb="<img src=\"images/onl.gif\" alt=\"On\"/>";
}
else{
$bulb="<img src=\"images/ofl.gif\" alt=\"Off\"/>";
}
$shbox .= "$bulb<i><a href=\"index.php?action=viewuser&sid=$sid&who=$shots[1]\">".$shnick."</a></i>: ";
$fshout = htmlspecialchars($shots[0]);
$fshout = getsmilies($fshout);
$fshout = getbbcode($fshout, $sid);
$shbox .= $fshout;
//if (ismod(getuid_sid($sid))){
//$shbox .= ", <a href=\"modproc.php?action=delsh&sid=$sid&shid=$shots[2]\">delete</a>";
//}
$shbox .= "<br/>";
}
if (isshoutblocked(getuid_sid($sid))){
$shbox .= "»post shout(Blocked!!)";
}else{
$shbox .= "<a href=\"lists.php?action=shouts&sid=$sid\">»post shout</a>";
}
$shbox .= "</small>";
return $shbox;
}
function getshouts($sid){
boxstart("Shoutbox");
$uid=getuid_sid($sid);
if(!isshoutblocked($uid)){
echo getshoutbox($sid);
}
boxend();
}
function getnewmsg($sid){
$umsg = getunreadpm(getuid_sid($sid));
if($umsg>0){
echo "<p align=\"center\"><small><a href=\"inbox.php?action=main&view=urd&sid=$sid\"><blink>Inbox($umsg new msg)</blink></a></small></p>";
}
}
function getfooter($sid){
$uid=getuid_sid($sid);
$umsg = getunreadpm($uid);
echo "
<div class=\"footer\">
<small>
<center>
0.<a href=\"index.php?action=main&sid=$sid\" accesskey=\"0\">Main Menu</a>|";
if($umsg>0){
echo "1.<a accesskey=\"1\" href=\"inbox.php?action=main&view=urd&sid=$sid\">Inbox[$umsg new msg]</a><br/>";
}
else{
echo "1.<a accesskey=\"1\" href=\"inbox.php?action=disp&sid=$sid\">Inbox</a><br/>";
}
echo "
2.<a href=\"lists.php?action=buds&sid=$sid\" accesskey=\"2\">Buddies</a>|
3.<a href=\"index.php?action=viewcat&sid=$sid&cid=1\" accesskey=\"3\">Forums</a><br/>
4.<a href=\"index.php?action=chat&sid=$sid\" accesskey=\"4\">Chat</a>|
5.<a href=\"index.php?action=online&sid=$sid\" accesskey=\"5\">Online Users[".getnumonline()."]</a><br/>
6.<a href=\"index.php?action=viewfrm&sid=$sid&fid=7\" accesskey=\"6\">Everyday Forum</a>|
7.<a href=\"index.php?action=myclub&sid=$sid\" accesskey=\"7\">Clubs</a><br/>
8.<a href=\"lists.php?action=blogs&sid=$sid&who=".$uid."\" accesskey=\"8\">Blogs</a>|
9.<a href=\"index.php?action=act&sid=$sid\" accesskey=\"9\">Active Topics</a><br/><br/>
<b>© IndiFun</b><br/>
</center>
</small>
</div>
";
}
function getfontsize($sid){
$uid=getuid_sid($sid);
if(!$uid){
$uid=4;
}
$size=mysql_fetch_array(mysql_query("SELECT fontsize FROM ibwf_users WHERE id=$uid"));
return $size[0];
}
function gettimebar(){
$indiatime = time() + addhours();
echo "<div class=\"logo\"><p align=\"right\"><small>".date("h:i A", $indiatime)."<br/>".date("d/m/Y", $indiatime)."</small></p></div>";
}
function boxstart($title){
echo "
<div class=\"boxed\">
<div class=\"boxedTitle\">
<h1 align=\"center\" class=\"boxedTitleText\"><b>$title</b>
</h1>
</div>
<div class=\"boxedContent\">
";
}
function boxend(){
echo "</div></div>";
}
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){
$name = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_users WHERE id='".$uid."'"));
$ldid = mysql_fetch_array(mysql_query("SELECT MAX(id) FROM logs WHERE uname='".$name[0]."'"));
$not = mysql_fetch_array(mysql_query("SELECT ip FROM logs WHERE id = $ldid[0]"));
return $not[0];
}
function getbr_uid($uid){
$name = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_users WHERE id='".$uid."'"));
$ldid = mysql_fetch_array(mysql_query("SELECT MAX(id) FROM logs WHERE uname='".$name[0]."'"));
$not = mysql_fetch_array(mysql_query("SELECT agent FROM logs WHERE id = $ldid[0]"));
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'"));
if($not[0]>0){
return true;
}else{
return false;
}
}
function isforumblocked($uid){
$not = mysql_fetch_array(mysql_query("SELECT forumb FROM ibwf_users WHERE id='".$uid."'"));
if($not[0]==1){
return true;
}else{
return false;
}
}
function isshoutblocked($uid){
$not = mysql_fetch_array(mysql_query("SELECT shoutb FROM ibwf_users WHERE id='".$uid."'"));
if($not[0]==1){
return true;
}else{
return false;
}
}function isinboxblocked($uid){
$not = mysql_fetch_array(mysql_query("SELECT inboxb FROM ibwf_users WHERE id='".$uid."'"));
if($not[0]==1){
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(){
$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 isol($uid){
$timeout=time()-300;
$uon = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online WHERE userid='".$uid."' AND actvtime>$timeout"));
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'"));
return $getreg[0];
}
function getfid($topicid){
$fid = mysql_fetch_array(mysql_query("SELECT fid FROM ibwf_topics WHERE id='".$topicid."'"));
return $fid[0];
}
function parsepm($text, $sid=""){
$text = htmlspecialchars($text);
$text = getsmilies($text);
$text = getbbcode($text, $sid);
$text = findcard($text);
return $text;
}
function parsemsg($text,$sid=""){
$text = htmlspecialchars($text);
$text = getsmilies($text);
$text = getbbcode($text, $sid);
$text = findcard($text);
return $text;
}
function isblocked($str,$sender){
if(ismod($sender)){
return false;
}
$str = str_replace(" ","",$str);
$sites[0] = "citybuzz.in";
$sites[1] = "sahzada.com";
$sites[2] = "sahzada.Com";
$sites[3] = "citybuzz.In";
$sites[4] = "Citybuzz.in";
$sites[5] = "Sahzada.com";
$sites[4] = "Citybuzz.In";
$sites[5] = "Sahzada.Com";
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 ismtarred($pmid){
$strd = mysql_fetch_array(mysql_query("SELECT starred FROM mms 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()."'");
$HTTP_USER_AGENT = getenv("HTTP_USER_AGENT");
$REMOTE_ADDR = $_SERVER["REMOTE_ADDR"];
if($REMOTE_ADDR == "207.210.86.252"){
$REMOTE_ADDR = getenv("HTTP_X_FORWARDED_FOR");
}
$blah=explode(".", $REMOTE_ADDR);
$MREMOTE_ADDR=$blah[0].".".$blah[1].".".$blah[2];
$blah=mysql_fetch_array(mysql_query("SELECT ip FROM ibwf_ses WHERE id='".$sid."'"));
$blah1=$blah[0];
$blah1=explode(".", $blah1);
$NREMOTE_ADDR=$blah1[0].".".$blah1[1].".".$blah1[2];
$sesx = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_ses WHERE id='".$sid."' AND ua='".$HTTP_USER_AGENT."'"));
if(($sesx[0]>0)&&($MREMOTE_ADDR==$NREMOTE_ADDR)){
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;
}
}
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];
}
function getmmscount($uid,$view="all"){
if($view=="all"){
$nopm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM mms WHERE touid='".$uid."'"));
}else if($view =="snt"){
$nopm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM mms WHERE byuid='".$uid."'"));
}else if($view =="str"){
$nopm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM mms WHERE touid='".$uid."' AND starred='1'"));
}else if($view =="urd"){
$nopm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM mms WHERE touid='".$uid."' AND unread='1'"));
}
return $nopm[0];
}
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 addonline($uid,$place,$plclink)
{
/////delete inactive users
$tm = time() ;
$timeout = $tm - 1800; //time out = 5 minutes
$deloff = mysql_query("DELETE FROM ibwf_online WHERE actvtime <'".$timeout."'");
$cloak = mysql_fetch_array(mysql_query("SELECT hidden FROM ibwf_users WHERE id = '".$uid."'"));
if($cloak[0]==1){
mysql_query("UPDATE ibwf_online SET hidden = 1 WHERE userid = $uid");
}else if($cloak[0]==0){
mysql_query("UPDATE ibwf_online SET hidden = 0 WHERE userid = $uid");
}
///now try to add user to online list and add total time online
$lastactive = mysql_fetch_array(mysql_query("SELECT lastact FROM ibwf_users WHERE id='".$uid."'"));
$tolsla = time() - $lastactive[0];
$totaltimeonline = mysql_fetch_array(mysql_query("SELECT tottimeonl FROM ibwf_users WHERE id='".$uid."'"));
$totaltimeonline = $totaltimeonline[0] + $tolsla;
$ttime = time();
$res = mysql_query("UPDATE ibwf_users SET lastact='".$ttime."' WHERE id='".$uid."'");
$res = mysql_query("UPDATE ibwf_users SET tottimeonl='".$totaltimeonline."' WHERE id='".$uid."'");
$res = mysql_query("INSERT INTO ibwf_online SET userid='".$uid."', actvtime='".$ttime."', 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='".$ttime."', 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", time());
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 getnumonline(){
$nouo = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online "));
return $nouo[0];
}
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){
if($uid==$tid){
return 0;
}
if(ismod($tid)){
return 0;
}
if(arebuds($tid, $uid)){
return 0;
}
if(isignored($tid, $uid)){
return 2;
}
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;
}
$rage = date("Y") - $y;
if(date("m")<$m){
$rage-=1;
}else if((date("m")==$m)&&(date("d")<$d)){
$rage-=1;
}
return $rage;
}
function getstarsign($strdate){
$dob = explode("-",$strdate);
if(count($dob)!=3){
return "Unavailable";
}
$m = $dob[1];
$d = $dob[2];
if(($m==3)&&($d>20)){
return "<img src=\"images/aries.gif\" alt=\"\"/>Aries - the Ram";
}
else
if(($m==4)&&($d<21)){
return "<img src=\"images/aries.gif\" alt=\"\"/>Aries - the Ram";
}
else
if(($m==4)&&($d>20)){
return "<img src=\"images/taurus.gif\" alt=\"\"/>Taurus - the Bull";
}
else
if(($m==5)&&($d<22)){
return "<img src=\"images/taurus.gif\" alt=\"\"/>Taurus - the Bull";
}
else
if(($m==5)&&($d>21)){
return "<img src=\"images/gemini.gif\" alt=\"\"/>Gemini - the Twins";
}
else
if(($m==6)&&($d<22)){
return "<img src=\"images/gemini.gif\" alt=\"\"/>Gemini - the Twins";
}
else
if(($m==6)&&($d>21)){
return "<img src=\"images/cancer.gif\" alt=\"\"/>Cancer - the Crab";
}
else
if(($m==7)&&($d<23)){
return "<img src=\"images/cancer.gif\" alt=\"\"/>Cancer - the Crab";
}
else
if(($m==7)&&($d>22)){
return "<img src=\"images/leo.gif\" alt=\"\"/>Leo - the Lion";
}
else
if(($m==8)&&($d<24)){
return "<img src=\"images/leo.gif\" alt=\"\"/>Leo - the Lion";
}
else
if(($m==8)&&($d>23)){
return "<img src=\"images/virgo.gif\" alt=\"\"/>Virgo - the Virgin";
}
else
if(($m==9)&&($d<23)){
return "<img src=\"images/virgo.gif\" alt=\"\"/>Virgo - the Virgin";
}
else
if(($m==9)&&($d>22)){
return "<img src=\"images/libra.gif\" alt=\"\"/>Libra - the Scales";
}
else
if(($m==10)&&($d<24)){
return "<img src=\"images/libra.gif\" alt=\"\"/>Libra - the Scales";
}
else
if(($m==10)&&($d>23)){
return "<img src=\"images/scorpio.gif\" alt=\"\"/>Scorpio - the Scorpion";
}
else
if(($m==11)&&($d<23)){
return "<img src=\"images/scorpio.gif\" alt=\"\"/>Scorpio - the Scorpion";
}
else
if(($m==11)&&($d>22)){
return "<img src=\"images/sagittarius.gif\" alt=\"\"/>Sagittarius - the Archer";
}
else
if(($m==12)&&($d<24)){
return "<img src=\"images/sagittarius.gif\" alt=\"\"/>Sagittarius - the Archer";
}
else
if(($m==12)&&($d>23)){
return "<img src=\"images/capricorn.gif\" alt=\"\"/>Capricorn - the Goat";
}
else
if(($m==1)&&($d<21)){
return "<img src=\"images/capricorn.gif\" alt=\"\"/>Capricorn - the Goat";
}
else
if(($m==1)&&($d>20)){
return "<img src=\"images/aquarius.gif\" alt=\"\"/>Aquarius - the Waterman";
}
else
if(($m==2)&&($d<19)){
return "<img src=\"images/aquarius.gif\" alt=\"\"/>Aquarius - the Waterman";
}
else
if(($m==2)&&($d>18)){
return "<img src=\"images/pisces.gif\" alt=\"\"/>Pisces - the Fishes";
}
else
if(($m==3)&&($d<21)){
return "<img src=\"images/pisces.gif\" alt=\"\"/>Pisces - the Fishes";
}
}
function getavatar($uid){
$av = mysql_fetch_array(mysql_query("SELECT avatar, sex FROM ibwf_users WHERE id='".$uid."'"));
if($av[0]==NULL){
if($av[1]=='M'){
return "images/nophotoboy.gif";
}
else if($av[1]=='F'){
return "images/nophotogirl.gif";
}
}
return $av[0];
}
function cansee($uid, $tid){
if($uid==$tid){
return true;
}
if(ismod($uid)){
return true;
}
return false;
}
function gettimemsg($difference){
$num = $difference/86400;
$days = intval($num);
$num2 = ($num - $days)*24;
$hours = intval($num2);
$num3 = ($num2 - $hours)*60;
$mins = intval($num3);
$num4 = ($num3 - $mins)*60;
$secs = intval($num4);
$months = intval($difference/(86400*30));
if(($months == 0) and ($days==0) and ($hours==0) and ($mins==0)){
return "$secs seconds";
}else
if(($months == 0) and ($days==0) and ($hours==0)){
return "$mins mins, $secs seconds";
}else
if(($months == 0) and ($days==0)){
return "$hours hours, $mins mins, $secs seconds";
}else
if($months==0){
return "$days days, $hours hours, $mins mins, $secs seconds";
}
else{
return "$months months, ".($days-($months*30))." days, $hours hours, $mins mins, $secs seconds";
}
}
function getstatus($uid){
$tinfo= mysql_fetch_array(mysql_query("SELECT perm, plusses FROM ibwf_users WHERE id='".$uid."'"));
//$info = mysql_fetch_array(mysql_query("SELECT posts FROM ibwf_users WHERE id='".$uid."'"));
if(isbanned($uid)){
return "BANNED!";
}
$status="";
if($tinfo[0]=='2'){
$status = "Administrator! ";
}else if($tinfo[0]=='1'){
$status = "Moderator! ";
}else if($tinfo[0]=='3'){
$status = "V.I.P. ";
}
if($tinfo[1]<50){
$status.= "Newbie";
}else if($tinfo[1]<100){
$status.= "Member";
}else if($tinfo[1]<500){
$status.= "Regular Member";
}else if($tinfo[1]<1000){
$status.= "Professional Time Waster!";
}else if($tinfo[1]<2000){
$status.= "Posts Factory!";
}else if($tinfo[1]<4000){
$status.= "INDIFUN Ki Shaan!";
}else if($tinfo[1]<8000){
$status.= "WAP Don!";
}else if($tinfo[1]<15000){
$status.= "WAP King";
}else {
$status.= "God!!!";
}
return $status;
}
function getjumper($action, $sid,$pgurl){
$rets = "Jump to page<input id=\"inputText\" 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=\"sid\" value=\"$sid\"/>";
$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 getallpm($uid){
$nopm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE touid='".$uid."'"));
return $nopm[0];
}
function getunreadmms($uid){
$nopm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM mms 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 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='4', touid='".$who."', unread='1', timesent='".time()."'");
}
function register($name,$pass,$usex,$bday,$uloc,$rname,$ms,$email){
$execms = mysql_query("SELECT * FROM ibwf_users WHERE name='".$name."';");
if (mysql_num_rows($execms)>0){
return 1;
}else{
$pass = md5(strtolower($pass));
$reg = mysql_query("INSERT INTO ibwf_users SET name='".$name."', pass='".$pass."', birthday='".$bday."', sex='".$usex."', location='".$uloc."', regdate='".time()."',
email='".$email."', rname='".$rname."', ms='".$ms."' ");
}
if ($reg){
$uid = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_users WHERE name='".$name."'"));
$msg = "IndiFun welcomes you! We are committed to provide you with unique services, like multimedia messaging, multiplayer online games and lots of other various tools for you to have
fun. We know that you come to WAP after getting time from your busy schedule so we are always ready hear to provide you a friendly and fun filled environment to ease your tensions. For any queries please ask any member of Administration Team. Thanks![br/][small][i]Note: This is an automatically generated message, please do not reply.[/i][/small]";
$msg = mysql_escape_string($msg);
autopm($msg, $uid[0]);
return 0;
}
}
function getuid_nick($nick){
$uid = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_users WHERE name='".$nick."'"));
return $uid[0];
}
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 isvip($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 removebb($text, $sid=""){
$text = str_replace("<","[",$text);
$text = str_replace(">","]",$text);
$text = str_replace("\"",""",$text);
return $text;
}
function getquote($text){
$text = str_replace(""","\"",$text);
return $text;
}
function getsmilies($text){
$status = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='icons'"));
if($status[0]==1){
$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 getbbcode($text, $sid=""){
$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("/\[marquee\](.*?)\[\/marquee\]/i","<marquee>\\1</marquee>", $text);
$text = preg_replace("/\[marqueer\](.*?)\[\/marqueer\]/i","<marquee direction=\"right\">\\1</marquee>", $text);
$text = preg_replace("/\[blink\](.*?)\[\/blink\]/i","<blink>\\1</blink>", $text);
$text = preg_replace("/\[strike\](.*?)\[\/strike\]/i","<strike>\\1</strike>", $text);
$status=mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='icons'"));
if($status[0]==1){
$text = preg_replace("/\[url\=(.*?)\](.*?)\[\/url\]/is","<a href=\"$1\">$2</a>",$text);
$text = preg_replace("/\[image\=((.*?)(.jpg|jpeg|png|gif|bmp))\]/i","<img src=\"\\1\" alt=\"Loading...\"/>", $text);
}
//$text = preg_replace("/\[image\=((.*?)(.jpg|jpeg|png|gif|bmp))\](.*?)\[\/image\]/is","<img src=\"$1\" alt=\"$2\" />",$text);
$text = preg_replace("/\[number\=(.*?)\](.*?)\[\/number\]/is","<a href=\"wtai://wp/mc;$1\">$2</a>",$text);
$text = preg_replace("/\[color\=(.*?)\](.*?)\[\/color\]/is","<font color=\"$1\">$2</font>",$text);
$text = preg_replace("/\[topic\=(.*?)\](.*?)\[\/topic\]/is","<a href=\"index.php?action=viewtpc&tid=$1&sid=$sid\">$2</a>",$text);
$text = preg_replace("/\[club\=(.*?)\](.*?)\[\/club\]/is","<a href=\"index.php?action=gocl&clid=$1&sid=$sid\">$2</a>",$text);
$text = preg_replace("/\[blog\=(.*?)\](.*?)\[\/blog\]/is","<a href=\"index.php?action=viewblog&bid=$1&sid=$sid\">$2</a>",$text);
$text = str_replace("[br/]","<br/>",$text);
$text = nl2br($text);
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 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ 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 alertstat($sid){
$userid=getuid_sid($sid);
if(!$userid){
return 0;
}
$alerstat = mysql_fetch_array(mysql_query("SELECT alert FROM ibwf_users WHERE id = $userid"));
return $alerstat[0];
}
function isdigitf($word){
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
$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 addhours(){
return 5.5*60*60;
}
function getindiatime(){
return time() + 5.5*60*60;
}
function gettheme($sid){
$uid=getuid_sid($sid);
if(!$uid){
$uid=1;
}
$blah=mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM themes WHERE uid=$uid"));
if($blah[0]>0){
$thm = mysql_fetch_array(mysql_query("SELECT * FROM themes WHERE uid='".$uid."' AND applied=1"));
}
else $thm = mysql_fetch_array(mysql_query("SELECT * FROM themes WHERE uid='".$uid."' AND applied=1"));
$blah = "<style type=\"text/css\">
* {
margin: 0;
padding: 0;
}
.boxed {
width: 99%;
margin-bottom: 3px;
border: 1px solid #000000;
}
.boxedTitle {
height: 18px;
padding: 0 0 0 2px;
background: ".$thm[2]." url(images/".$thm[3].") repeat-x;
}
.boxedTitleText {
font-size: 11px;
color: ".$thm[4].";
}
.boxedContent {
padding: 2px 2px 2px 2px;
background: ".$thm[5].";
}
.logo {
padding: 2px 2px 2px 2px;
background: ".$thm[10]." url(images/".$thm[12].") repeat-x;
}
.footer {
width: 100%;
padding: 5px;
background: url(images/".$thm[19].") repeat-x;
}
h1 {
color: #000000;
}
a:visited {
color: ".$thm[7].";
}
a:link {
color: ".$thm[6].";
}
h5 {
height: 30px;
padding: 0 0 0 2px;
background: ".$thm[8]." url(images/".$thm[9].") repeat-x;
color: ".$thm[4].";
}
body {
background: ".$thm[10]." ;
font: normal small Arial, Helvetica, sans-serif, Verdana;
color: ".$thm[11].";
}
#inputText {
background-color: ".$thm[13].";
color: ".$thm[14].";
border: 1px solid ".$thm[15].";
}
#inputButton {
background-color: ".$thm[16].";
color: ".$thm[17].";
border: 1px solid ".$thm[18].";
}
</style>
";
return $blah;
}
function getlogo($uid){
if(!$uid){
$uid=4;
}
$name=mysql_fetch_array(mysql_query("SELECT name FROM themes WHERE uid=$uid AND applied=1"));
switch($name[0]){
case "Vista" :
$logo = "<img src=\"images/vista1.gif\" alt=\"IndiFun\" />";
break;
case "Red" :
$logo = "<img src=\"images/opera1.gif\" alt=\"IndiFun\" />";
break;
case "XP" :
$logo = "<img src=\"images/xp1.gif\" alt=\"IndiFun\" />";
break;
case "Royal Black" :
$logo = "<img src=\"images/black1.gif\" alt=\"IndiFun\" />";
break;
case "Green Pink" :
$logo = "<img src=\"images/pink1.gif\" alt=\"IndiFun\" />";
break;
case "Yellow" :
$logo = "<img src=\"images/vista1.gif\" alt=\"IndiFun\" />";
break;
case "Aero" :
$logo = "<img src=\"images/vista1.gif\" alt=\"IndiFun\" />";
break;
case "Matrix" :
$logo = "<img src=\"images/matrix1.gif\" alt=\"IndiFun\" />";
break;
case "Opera - WML" :
$logo = "<img src=\"images/opera1.gif\" alt=\"IndiFun\" />";
break;
default :
$logo = "<img src=\"images/vista1.gif\" alt=\"IndiFun\" />";
break;
}
return $logo;
}
function ipinrange($ip, $range1, $range2)
{
$ip=ip2long($ip);
$range1=ip2long($range1);
$range2=ip2long($range2);
return (($ip >= $range1) && ($ip <= $range2));
}
function network($ip)
{
$result=mysql_query("SELECT * FROM network ORDER BY subone");
while($ranges=mysql_fetch_array($result)){
if(ipinrange($ip, $ranges[1], $ranges[2])){
//$flag="<img src=\"http://indianwap.com/images/flags/".$ranges["flag"]."\" alt=\"".$ranges["flag"]."\"/><br/>";
return $flag.$ranges["isp"]." ".$ranges["country"];
}
}
return "Unresolved";
}
function getbrip($sid){
$uid=getuid_sid($sid);
$HTTP_USER_AGENT = getenv("HTTP_USER_AGENT");
$REMOTE_ADDR = $_SERVER["REMOTE_ADDR"];
if($REMOTE_ADDR == "207.210.86.252"){
$REMOTE_ADDR = getenv("HTTP_X_FORWARDED_FOR");
}
mysql_query("UPDATE ibwf_users SET ua='".$HTTP_USER_AGENT."', ip='".$REMOTE_ADDR."' WHERE id='$uid'");
}
?>
ibwf_penalties logs the browser and ip of the user i want to ban but its of no use still i used
PHP Code:
if(isipbanned($uip,$ubr))
{
if(!isshield(getuid_sid($sid)))
{
echo "<head>";
echo "<title>Ip Block!</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/white_medium.css\">";
echo "</head>";
echo "<body>";
echo "<p align=\"center\">";
echo "<div><img src=\"../images/notok.gif\" alt=\"!\"/></div>";
echo "<b>This IP address is blocked!!!</b><br/>";
echo "<br/>";
echo "How ever we grant a shield against IP-Ban for our great users, you can try to see if you are shielded by trying to log-in, if you kept coming to this page that means you are not shielded, so come back when the ip-ban period is over<br/><br/>";
$banto = mysql_fetch_array(mysql_query("SELECT timeto FROM ibwf_penalties WHERE penalty='2' AND ipadd='".$uip."' AND browserm='".$ubr."' LIMIT 1 "));
$remain = $banto[0] - time();
$rmsg = gettimemsg($remain);
echo "<b>Time Left: </b>$rmsg<br/>";
echo "</p>";
whts the error someone plz help... thanks in advance
Comment