Could someone help me plz

Started on the old forum in January 2012 · view the original in the archive · old links redirect here

5 replies · 517 views · started 14 years ago · 1 min read

3 participants
carebear Developer · 68 posts #1
<?php
serveraddy()or die('Could not connect to the server');

function popup($ses)
{
if(!is_file($folder)){
$folder="../inbox";}
else{$folder="./inbox";}
$unread=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM popups WHERE unread='1' AND to_id='".uid_ses($ses)."'"));      
$enabled=mysql_fetch_array(mysql_query("SELECT popmsg FROM members WHERE uid='".uid_ses($ses)."'"));
$pop=mysql_fetch_array(mysql_query("SELECT id, text, by_id, time_sent, to_id, reported FROM popups WHERE unread='1' AND to_id='".uid_ses($ses)."'"));
mysql_query("UPDATE popups SET unread='0' WHERE id='".$pop[id]."'");
if($unread[0]>0){if($enabled[0]==1){
$popup.="<form action=\"$folder/sendpopup.php?ses=$ses&userid=$pop[2]&id=$pop[0]&sent=yes\" method=\"post\"><p style=\"text-align: center\">";
$popup.="<strong>POP-UP From ".nick_uid($pop[by_id])."</strong><br/>";
$popup.="<b>Sent:</b> ".date("H:i-D jS M y",$pop[time_sent])."<br/>";
$popup.="<b>Msg:</b> ".getbbcode($pop[text],$ses,0)."<br/>";
$popup.="Reply to ".nick_uid($pop[by_id])."<br/>";
$popup.="<input name=\"poptext\" maxlength=\"500\"/><br/>";
$popup.="<input type=\"Submit\" Value=\"  Send  \"></form><br/>";
mysql_query("INSERT INTO online SET uid='".uid_ses($ses)."', idel='".time()."', place='".$place."', placelink='".$placelink."'");
$place=mysql_fetch_array(mysql_query("SELECT placelink FROM online WHERE uid='".uid_ses($ses)."'"));
$popup.="<a href=\"$place[0]?ses=$ses\">Skip Msg</a><br/>";
$popup.="<a href=\"$folder/sendpopup.php?ses=$ses&id=$pop[id]&report=yes\">Report</a></p>";}
}return $popup;
}

function starsign($day,$month,$year)
{
if(($month==1)&&($day>20)||($month==2)&&($day<20)){$starsign="Aquarius";}
if(($month==2)&&($day>18)||($month==3)&&($day<21)){$starsign="Pisces";}
if(($month==3)&&($day>20)||($month==4)&&($day<21)){$starsign="Aries";}
if(($month==4)&&($day>20)||($month==5)&&($day<22)){$starsign="Taurus";}
if(($month==5)&&($day>21)||($month==6)&&($day<22)){$starsign="Gemini";}
if(($month==6)&&($day>21)||($month==7)&&($day<24)){$starsign="Cancer";}
if(($month==7)&&($day>23)||($month==8)&&($day<24)){$starsign="Leo";}
if(($month==8)&&($day>23)||($month==9)&&($day<24)){$starsign="Virgo";}
if(($month==9)&&($day>23)||($month==10)&&($day<24)){$starsign="Libra";}
if(($month==10)&&($day>23)||($month==11)&&($day<23)){$starsign="Scorpio";}
if(($month==11)&&($day>22)||($month==12)&&($day<23)){$starsign="Sagittarius";}
if(($month==12)&&($day>22)||($month==1)&&($day<21)){$starsign="Capricorn";}
return $starsign;
}

function status($uid)
{
$pinfo=mysql_fetch_array(mysql_query("SELECT regdate, level, points, browser, ip, status FROM members WHERE uid='".$uid."'"));
$days=explode(" days",timemsg((time()-$info[0])));
if(isshoutban($uid)){$status="Shoutbox Banned!";}
else if(isforumban($uid)){$status="Forum Banned";}
else if(ischatban($uid)){$status="Chat Banned!";}
else if(isbanned($uid)){$status="Banned!";}
else if(isipbanned($pinfo[4],$pinfo[3])){$status="Ip Banned!";}
else if($pinfo[5]!=""){$status="$pinfo[5]";}
else if($pinfo[1]==5){$status="Site Host!";}
else if($pinfo[1]==4){$status="Site Owner!";}
else if($pinfo[1]==3){$status="Head Administrator!";}
else if($pinfo[1]==2){$status="Administrator!";}
else if($pinfo[1]==1){$status="Moderator!";}
else if($pinfo[1]==0){$status="Member!";}
else if($days[0]<7){$status="New Member!";}
return $status;
}

function rating($uid)
{
$sql="SELECT points, shouts, chatmsgs FROM members WHERE uid='".$uid."'";
$item=mysql_query($sql);
$info=mysql_fetch_array($item);
$points=$info[points];
$shouts=$info[shouts];
$chatmsgs=$info[chatmsgs];
$lvl=($points+$shouts+$chatmsgs);
if($lvl<0){$rating.="<img src=\"./images/half-star.gif\" alt=\"\"/>";}
else if($lvl<350){$rating.="<img src=\"./images/1-star.gif\" alt=\"\"/>";}
else if($lvl<1000){$rating.="<img src=\"./images/1half-star.gif\" alt=\"\"/>";}
else if($lvl<2500){$rating.="<img src=\"./images/2-star.gif\" alt=\"\"/>";}
else if($lvl<6500){$rating.="<img src=\"./images/2half-star.gif\" alt=\"\"/>";}
else if($lvl<15000){$rating.="<img src=\"./images/3-star.gif\" alt=\"\"/>";}
else if($lvl<37000){$rating.="<img src=\"./images/3half-star.gif\" alt=\"\"/>";}
else if($lvl<85000){$rating.="<img src=\"./images/4-star.gif\" alt=\"\"/>";}
else if($lvl<190000){$rating.="<img src=\"./images/4half-star.gif\" alt=\"\"/>";}
else if($lvl<1000000){$rating="<img src=\"./images/5-star.gif\" alt=\"\"/>";}
return $rating;
}

function level($level)
{
$ses=get_var(ses);
if(ishost(uid_ses($ses))){$level="Host";}
else if(isowner(uid_ses($ses))){$level="Owner";}
else if(isheadadmin(uid_ses($ses))){$level="HeadAdmin";}
else if(isadmin(uid_ses($ses))){$level="Admin";}
else if(ismod(uid_ses($ses))){$level="Mod";}
else{$level="Hidden";}
return $level;
}

function smilies($text)
{
$sql="SELECT * FROM smilies_files";
$smilies=mysql_query($sql);
while($smilie=mysql_fetch_array($smilies)){
if(!is_file("$spath")){$spath="../".$smilie[2];}else{$spath=$smilie[2];}
$text=str_replace($smilie[1],"<img src=\"$spath\" alt=\"\"/>",$text);}
return $text;
}

function replace($text)
{
$sql="SELECT * FROM swearing";
$replace=mysql_query($sql);
while($filter=mysql_fetch_array($replace)){
$text=str_replace($filter[1],"$filter[2]",$text);}
return $text;
}

function filter()
{
$swearing=mysql_fetch_array(mysql_query("SELECT value FROM settings WHERE name='swearing'"));
if($swearing[0]=="1"){return true;}else{return false;}
}

function sitenews()
{
$site_news=mysql_fetch_array(mysql_query("SELECT news FROM site_news"));
return $site_news[0];
}

function strClean($text)
{
$tex=strip_tags($text);
$tex=stripslashes(stripslashes($tex));
return $tex;
}

function isspam($text)
{
$sfil[0]="www.";
$sfil[1]="http:";
$sfil[2]="co.uk";
$sfil[3]="co . uk";
$sfil[4]="uk.to";
$sfil[5]="uk . to";
$sfil[6]="org.uk";
$sfil[7]="org . uk";
$sfil[8]=".com";
$sfil[9]=". c o m";
$sfil[10]=".mobi";
$sfil[11]=". m o b i";
$sfil[12]=".org";
$sfil[13]=". o r g";
$text=str_replace("","",$text);
$text=strtolower($text);
for($i=0;$i<count($sfil);$i++){
$nosf=substr_count($text,$sfil[$i]);
if($nosf>0){return true;}
}return false;
}

function swearing($str)
{
$str=str_replace(" ","",$str);
$sites[0]="****";
$sites[1]="****";
$sites[2]="dick";
$sites[3]="pussy";
$sites[4]="cunt";
$sites[5]="cock";
$sites[6]="slut";
$sites[7]="faggot";
$sites[8]="wanker";
$sites[9]="prick";
$sites[10]="bastard";
$sites[11]="bitch";
$sites[12]="-- Sent on a phone using T9space.com";
for($i=0;$i<count($sites);$i++){
$str=strtolower($str);
$nosf=substr_count($str,$sites[$i]);
if($nosf>0){return true;}
}return false;
}

function getbbcode($text,$ses='')
{
$text=htmlspecialchars($text);
$text=str_replace('-- Sent on a phone using T9space.com','**',$text);
$text=preg_replace("/\[b\](.*?)\[\/b\]/i","<b>\\1</b>", $text);
$text=preg_replace("/\[i\](.*?)\[\/i\]/i","<i>\\1</i>", $text);
$text=preg_replace("/\[u\](.*?)\[\/u\]/i","<u>\\1</u>", $text);
$text=preg_replace("/\[big\](.*?)\[\/big\]/i","<big>\\1</big>", $text);
$text=preg_replace("/\[small\](.*?)\[\/small\]/i","<small>\\1</small>", $text);
$text=preg_replace("/\[url\=(.*?)\](.*?)\[\/url\]/is","<a href=\"$1\">$2</a>",$text);
$text=preg_replace("/\[color\=(.*?)\](.*?)\[\/color\]/is","<span style=\"color:$1\">$2</span>",$text);
$text=preg_replace("/\[img\=(.*?)\]/i","<img src=\"$1\" alt=\"\"/>",$text);
$text=preg_replace("/\[midi\](.*?)\[\/midi\]/i","<bgsound src=\"\\1\"/>",$text);
$text=preg_replace("/\[blink\](.*?)\[\/blink\]/i","<blink>\\1</blink>",$text);
$text=preg_replace("/\[topic\=(.*?)\](.*?)\[\/topic\]/is","<a href=\"../forums/viewtopic.php?ses=$ses&tid=$1\">$2</a>",$text);
$text=preg_replace("/\[club\=(.*?)\](.*?)\[\/club\]/is","<a href=\"../clubs/clubs.php?ses=$ses&clid=$1\">$2</a>",$text);
$text=preg_replace("/\[blog\=(.*?)\](.*?)\[\/blog\]/is","<a href=\"../wapsites/blogs.php?ses=$ses&bid=$1&viewblog=yes\">$2</a>",$text);
if(substr_count($text,"[br/]")<=3){$text=str_replace("[br/]","<br/>",$text);}
$smilies=mysql_fetch_array(mysql_query("SELECT smilies FROM members WHERE uid='".uid_ses($ses)."'"));
if($smilies[0]=='1'){$text=smilies($text);}
if(filter()=='1'){
if(swearing($text)){
$text=replace($text);}
}return $text;
}

function logbbcode($text,$ses='')
{
$text=htmlspecialchars($text);
$text=preg_replace("/\[b\](.*?)\[\/b\]/i","<b>\\1</b>", $text);
$text=preg_replace("/\[i\](.*?)\[\/i\]/i","<i>\\1</i>", $text);
$text=preg_replace("/\[u\](.*?)\[\/u\]/i","<u>\\1</u>", $text);
$text=preg_replace("/\[big\](.*?)\[\/big\]/i","<big>\\1</big>", $text);
$text=preg_replace("/\[small\](.*?)\[\/small\]/i","<small>\\1</small>", $text);
$text=preg_replace("/\[url\=(.*?)\](.*?)\[\/url\]/is","<a href=\"$1\">$2</a>",$text);
$text=preg_replace("/\[color\=(.*?)\](.*?)\[\/color\]/is","<span style=\"color:$1\">$2</span>",$text);
$text=preg_replace("/\[img\=(.*?)\]/i","<img src=\"$1\" alt=\"\"/>",$text);
$text=preg_replace("/\[midi\](.*?)\[\/midi\]/i","<bgsound src=\"\\1\"/>", $text);
if(substr_count($text,"[br/]")<=3){$text=str_replace("[br/]","<br/>",$text);}
$text=smilies($text);
return $text;
}

function register_globals($order='egpcs')
{
if(!function_exists('register_global_array')){
function register_global_array(array $superglobal){
foreach($superglobal as $varname => $value){
global $$varname;
$$varname=$value;}
}
}$order=explode("\r\n", trim(chunk_split($order, 1)));
foreach($order as $k){
switch(strtolower($k)){
case 'e': register_global_array($_ENV); break;
case 'g': register_global_array($_GET); break;
case 'p': register_global_array($_POST); break;
case 'c': register_global_array($_COOKIE); break;
case 's': register_global_array($_SERVER); break;}
}
}

function check_injection()
{ 
$badchars = array("DROP","TRUNCATE", "SELECT", "UPDATE", "DELETE" , "UNION", "WHERE", "FROM","INSERT","ORDER BY"); 
foreach($_REQUEST  as $value) { 
if(in_array(strtoupper($value), $badchars)) { 
$logfile= 'logs/log.txt'; //chmod 777 
$IP=$_SERVER['REMOTE_ADDR']; 
$logdetails= date("F j, Y, g:i a") . ': ' . '<a href=http://dnsstuff.com/tools/city.ch?ip='.$_SERVER['REMOTE_ADDR'].' target=_blank>'.$_SERVER['REMOTE_ADDR'].'</a>'; 
$fp=fopen($logfile, "r+"); 
fwrite($fp, $logdetails, strlen($logdetails)); 
fclose($fp); 
header('Location:http://google.com'); 
}else{ 
$check=preg_split("//", $value, -1, PREG_SPLIT_OFFSET_CAPTURE); 
foreach($check as $char){
if(in_array(strtoupper($char), $badchars)){
$logfile= 'logs/log.txt'; 
$IP=$_SERVER['REMOTE_ADDR']; 
$logdetails= date("F j, Y, g:i a") . ': ' . '<a href=http://dnsstuff.com/tools/city.ch?ip='.$_SERVER['REMOTE_ADDR'].' target=_blank>'.$_SERVER['REMOTE_ADDR'].'</a>'; 
$fp=fopen($logfile, "r+"); 
fwrite($fp, $logdetails, strlen($logdetails)); 
fclose($fp); 
header('Location:http://google.com');}
}
}
} 
} 
?>

I keep getting an error on line 262 Warning: strtoupper() expects parameter 1 to be string, array given in /home/gigglewa/public_html/core/functions.inc on line 262 if any could help that b get thanks..

softwarefreak Senior · 349 posts #2

Just edit these lines...

$check=preg_split("/ /", $value, -1, PREG_SPLIT_OFFSET_CAPTURE); 
foreach($check as $char){
if(in_array(strtoupper($char[0]), $badchars)) // this line of code is altered
{

I need some facebook likes, can you please help me 🤝 http://facebook.com/softwarefreakin I noticed social media is really powerful 🧙 Well DONE is better than well SAID

carebear Developer · 68 posts #3

hey softwarefreak I have tryed that but not working sorry

softwarefreak Senior · 349 posts #4

Don't say dat you're still getting this error -> Warning: strtoupper() expects parameter 1 to be string, array given in /home/gigglewa/public_html/core/functions.inc on line 262

if yes, then you haven't edited it correctly..

I need some facebook likes, can you please help me 🤝 http://facebook.com/softwarefreakin I noticed social media is really powerful 🧙 Well DONE is better than well SAID

arnage Lead · 811 posts #5

Whole that function check_injection() doesn't worth anything (TRUN/**/CATE). 🙂

<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***
carebear Developer · 68 posts #6

this is the line in haven trouble with if(in_array(strtoupper($char), $badchars)){

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close