I hate PHP5

Can somebody tell me what is wrong with this php script and how can i solve this problem ?
I have errors after upgrading from php4 to php5.

I don’t know what to do anymore I Fix one thing and then something else goes wrong. :mad:

http://www.counterservis.com/x/signup.php

<?php

class counter
{
	var $username;
	var $password;
	var $url;
	var $email;
	var $hits;
	var $counter_type;
	var $add_site;
	var $use_cookie;
	var $admin_can_email;
	var $use_commas;
	var $hide_stats;
	var $messages;
	var $i;
	var $p1;
	var $p2;
	var $p3;
	var $p4;
	var $p5;
	var $value; 
	var $c;
	var $newc;
	var $d;
	var $z;
	var $last_id;
	var $id; 
	var $siteurl;
	var $min_pass_length; 
	var $max_pass_length;
	var $chars;
	var $mail_msg;
	var $your_email;
	var $uid;
	var $colour;
	var $php_self;
	var $ccuser;
	var $ccpass;
	var $new;
	var $start_day;
	var $hours;
	var $minutes;
	var $seconds;
	var $array1;
	var $array2;
	var $ip;
	var $ex1;
	var $ex2;
	var $ex3;
	var $status;
	var $rules;
	var $language;
	
	function counter()
	{
		$thisXXX->username=addslashes($GLOBALS['username']);
		$thisXXX->password=addslashes($GLOBALS['password']);
		$thisXXX->url=addslashes(htmlspecialchars($GLOBALS['url']));
		$thisXXX->email=addslashes($GLOBALS['email']);
		$thisXXX->hits=$GLOBALS['counter_value'];
		$thisXXX->counter_type=substr(addslashes($GLOBALS['counter_type']),0,50);
		$thisXXX->add_site=$GLOBALS['add_site'];
		$thisXXX->show_site=$thisXXX->add_site;
		$thisXXX->use_cookie=$GLOBALS['use_cookie'];
		$thisXXX->admin_can_email=$GLOBALS['admin_can_email'];
		$thisXXX->use_commas=$GLOBALS['use_commas'];
		$thisXXX->hide_stats=$GLOBALS['hide_stats'];
		$thisXXX->uid=$GLOBALS['i'];
		$thisXXX->expand1=$GLOBALS['ex1'];
		$thisXXX->expand2=$GLOBALS['ex2'];
		$thisXXX->expand3=$GLOBALS['ex3'];
		$thisXXX->z=$GLOBALS['l'];
		$thisXXX->php_self=$GLOBALS['PHP_SELF'];
		
		include("config.inc.php");	
	}

	function newuser()
	
	{
		require("mysql_connect.php");
		require("lang/english/newuser.inc.php");
		
		$thisXXX->z=$thisXXX->i=0;
		$thisXXX->add_site=($thisXXX->add_site=="on")?1:0;
		$thisXXX->use_cookie=($thisXXX->use_cookie=="on")?1:0;
		$thisXXX->admin_can_email=($thisXXX->admin_can_email=="on")?1:0;
		$thisXXX->use_commas=($thisXXX->use_commas=="on")?1:0;
		$thisXXX->hide_stats=($thisXXX->hide_stats=="on")?1:0;
		$thisXXX->show_site=($thisXXX->show_site=="on")?1:0;

		echo '';
		if(ereg("^[A-Za-z0-9_]{1,255}$",$thisXXX->username))
		{
			if($thisXXX->c=@mysql_query("select username from CC_users where username='$thisXXX->username'"))
			{
				$thisXXX->d=mysql_fetch_object($thisXXX->c);
				if(is_object($thisXXX->d))
				{
					$thisXXX->messages[$thisXXX->i++]= '<font face="Arial" size="2">'.$lang['no_username'].'</font>';
					unset($thisXXX->username);
				}
				else
				{
					$thisXXX->z++;
				}
			}
			else
			{
				$thisXXX->messages[$thisXXX->i++]=mysql_error();
			}
		}
		else 
		{
			$thisXXX->messages[$thisXXX->i++]='<font face="Arial" size="2">'.$lang['invalid_username'].'</font>';
			unset($thisXXX->username);
		}


		if(eregi("^[https?://.+\\..+]{1,255}",$thisXXX->url))
		{
			$thisXXX->z++;
		}
		else
		{
			$thisXXX->messages[$thisXXX->i++]='<font face="Arial" size="2">'.$lang['invalid_url'].'</font>';
			unset($thisXXX->url);
		}


		if(eregi("^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,4})$",$thisXXX->email))
		{
			if ($thisXXX->unique_email=="yes")
			{
				if($thisXXX->c=@mysql_query("select email from CC_users where email='$thisXXX->email'"))
				{
					if(mysql_num_rows($thisXXX->c)>0)
					{
						$thisXXX->messages[$thisXXX->i++]= '<font face="Arial" size="2">'.$lang['duplicate_email'].'</font>';
						unset($thisXXX->email);
					}
					else
					{
						$thisXXX->z++;
					}
				}
				else
				{
					$thisXXX->messages[$thisXXX->i++]=mysql_error();
				}
			} else {
				$thisXXX->z++;
			}
		}
		else
		{
			$thisXXX->messages[$thisXXX->i++]='<font face="Arial" size="2">'.$lang['invalid_email'].'</font>';
			unset($thisXXX->email);
		}


		if(ereg("^[0-9]{1,6}$",$thisXXX->hits))
		{
			$thisXXX->z++;
		}
		else
		{
			$thisXXX->messages[$thisXXX->i++]='<font face="Arial" size="2">'.$lang['invalid_counter'].'</font>';
			unset($thisXXX->hits);
		}


		if($thisXXX->z==4)
		{
			$thisXXX->gen_password();
			if(@mysql_query("insert into CC_users (username,password,email,url,show_site,email_me,hide_stats) values ('$thisXXX->username',md5('$thisXXX->password'),'$thisXXX->email','$thisXXX->url','$thisXXX->show_site','$thisXXX->admin_can_email','$thisXXX->hide_stats')"))
			#if(@mysql_query("insert into CC_users (username,password,email,url,show_site,email_me,hide_stats) values ('$thisXXX->username',md5('$thisXXX->password'),'$thisXXX->email','$thisXXX->url','$thisXXX->show_site','$thisXXX->admin_can_email','$thisXXX->hide_stats')"))
			{
				
				$thisXXX->last_id=mysql_insert_id();
				if(@mysql_query("insert into CC_counter (id,hits,counter_type,last_access,use_cookie,use_comma) values ('$thisXXX->last_id','$thisXXX->hits','$thisXXX->counter_type','".time()."','1','$thisXXX->use_commas')"))
				{
					mysql_query("create table _$thisXXX->last_id (id int(255) unsigned not null auto_increment,time int(15) default 0 not null,referer varchar(255) default 'null',ip varchar(255) not null,browser varchar(100) not null,os varchar(100) not null,screen varchar(10) not null,depth tinyint(2) unsigned not null default '0',spare1 varchar(255) not null, spare2 varchar(255) not null, spare3 varchar(255) not null, primary key(id), unique id(id),index(time),index(browser),index(os),index(screen),index(depth),index(spare1),index(spare2),index(spare3))") or die(mysql_error());

					echo "<font size='4' face='Arial'><b>",$lang['signup_complete'],"</b></font><br><br><b>",$lang['account_url'],":</b> $thisXXX->url<br><b>",$lang['account_username'],":</b> $thisXXX->username";
					
					if ($thisXXX->show_pass == "yes")
						echo "<br><b>",$lang['account_password'],":</b> ",$thisXXX->password;
					
					echo "<br><br><font size=2 face='Arial'>",$lang['signup_msg'],"<p></font>";
					
					print "<textarea name='select1' cols='45' rows='10'>";
					echo  ($thisXXX->get_counter_code2($thisXXX->last_id));
					print "</textarea><br>";
					
					 
					$thisXXX->welcome_mail();
				}
				else
				{
					mysql_query("delete from CC_counter where id='$thisXXX->last_id'");
					die(mysql_error());
				}
			}
			else
			{
				die(mysql_error());
			}
			
		}
		else
		{
			foreach($thisXXX->messages as $thisXXX->value)
				echo "<li> $thisXXX->value";
			$thisXXX->signup_form();
		}
		mysql_close();	
	}
	
	function signup_form()
	{
		require "mysql_connect.php";
		require("lang/english/signupform.inc.php");
		
		$thisXXX->add_site=($thisXXX->add_site)?" checked":"";
		$thisXXX->use_cookie=($thisXXX->use_cookie)?" checked":"";
		$thisXXX->admin_can_email=($thisXXX->admin_can_email)?" checked":"";
		$thisXXX->use_commas=($thisXXX->use_commas)?" checked":"";
		$thisXXX->hide_stats=($thisXXX->hide_stats)?" checked":"";
		
		if ($thisXXX->use_pay == "yes")
			$thisXXX->status="free";
		else
			$thisXXX->status="paid";

		echo "<form method=post action=signup.php>
		<input type=hidden name=signup value=yes><input type=hidden value=yes name=agree><font face='Arial,Geneva, Helvetica, san-serif' size='2'><table border=\\"0\\" cellpadding=\\"4\\" bordercolor=\\"#000000\\"><tr><td><div align=right><font size=2><strong>",$lang['username'],": 
        </strong></font></div></td><td><input type=text name=username maxlength=255 value=\\"",$thisXXX->username,"\\"></td></tr><tr><td><div align=\\"right\\"><font size=2><strong>",$lang['email'],":</strong> 
        &nbsp;</font></div></td><td><input type=text name=email maxlength=255 value=\\"",$thisXXX->email,"\\"></td></tr><tr><td><div align=right><font size=2><strong>",$lang['url'],":</strong> 
        &nbsp;</font></div></td><td><input type=text name=url maxlength=255 value=\\"",$thisXXX->url,"\\"></td></tr><tr><td><div align=right><font size=2>
        <strong>",$lang['counter_value'],":</strong> &nbsp;</font></div></td><td><input type=text name=counter_value maxlength=6 value=\\"",$thisXXX->hits,"\\"></td></tr><tr><td valign=top><div align=right><font size=2>
        <strong>",$lang['counter_style'],":</strong> &nbsp;</font></div></td><td>";
        
		print $thisXXX->counterImages(1);

      	echo "</td></tr><tr><td colspan=2>";

		print $thisXXX->counterOptions();

      	echo "</td></tr><tr><td colspan=2><div align=\\"center\\"><input class=submit type=submit value=",$lang['signup'],"></div></table></font>";
	}
	
	function signup_form2()
	{
		require "mysql_connect.php";
		require("lang/english/signupform.inc.php");
		
		if ($thisXXX->use_pay == "yes")
			$thisXXX->status="free";
		else
			$thisXXX->status="paid";
	
		echo "<form method=post action=signup.php>
		<input type=hidden name=signup value=yes><input type=hidden value=yes name=agree><font face='Arial,Geneva, Helvetica, san-serif' size='2'><table border=\\"0\\" cellpadding=\\"4\\" bordercolor=\\"#000000\\"><tr><td><div align=right><font size=2><strong>",$lang['username'],": 
        </strong></font></div></td><td><input type=text name=username maxlength=255></td></tr><tr><td><div align=right><font size=2><strong>",$lang['email'],":</strong> 
        &nbsp;</font></div></td><td><input type=text name=email maxlength=255></td></tr><tr><td><div align=right><font size=2><strong>",$lang['url'],":</strong> 
        &nbsp;</font></div></td><td><input type=text name=url maxlength=255 value=\\"http://\\"></td></tr><tr><td><div align=right><font size=2>
        <strong>",$lang['counter_value'],":</strong> &nbsp;</font></div></td><td><input type=text name=counter_value maxlength=6 value=\\"0\\"></td></tr><tr><td valign=top><div align=right><font size=2>
        <strong>",$lang['counter_style'],":</strong> &nbsp;</font></div></td><td>";
        
		print $thisXXX->counterImages(1);
      	
      	echo "</td></tr><tr><td colspan=2>";
      	
		print $thisXXX->counterOptions();

      	echo "</td></tr><tr><td colspan=2><div align=\\"center\\"><input class=submit type=submit value=",$lang['signup'],"></div></table></font>";

	}

	function gen_password()
	{
		mt_srand((double)microtime()*1000000^getmypid());
		$thisXXX->pass_length=mt_rand($thisXXX->min_pass_length,$thisXXX->max_pass_length);
		while(strlen($thisXXX->password)<$thisXXX->pass_length)
			$thisXXX->password.=substr($thisXXX->chars,(mt_rand()%strlen($thisXXX->chars)),1);
	}

	function get_counter_code($id)
	{
		$thisXXX->id=$id;
		return "<script language=\\"javascript\\">\
var data, p;\
var agt=navigator.userAgent.toLowerCase();\
p='http';\
if((location.href.substr(0,6)=='https:')||(location.href.substr(0,6)=='HTTPS:')) {p='https';} data = '&r=' + escape(document.referrer) + '&n=' + escape(navigator.userAgent) + '&p=' + escape(navigator.userAgent)\
if(navigator.userAgent.substring(0,1)>'3') {data = data + '&sd=' + screen.colorDepth + '&sw=' + escape(screen.width+ 'x'+screen.height)};\
document.write('<a href=\\"$thisXXX->siteurl\\" target=\\"_blank\\" >');\
document.write('<img border=0 hspace=0 '+'vspace=0 src=\\"$thisXXX->siteurl/counter.php?i=$thisXXX->id' + data + '\\"> </a>');\
</script>\
";
	}

	
	function get_counter_code2($id)
	{
		$thisXXX->id=$id;
		return "<!-- Counter Service - CounterServis.Com - Begin --><!-- Counter Service - CounterServis.Com - End -->";

	}
	
	function welcome_mail()
	{
		$thisXXX->i=$thisXXX->get_counter_code($thisXXX->last_id);
		//if(!$thisXXX->password) $thisXXX->gen_password();
		include("config.inc.php");
		mail($thisXXX->email,"$thisXXX->sitename",$thisXXX->mail_msg,"From:<$thisXXX->your_email>");
	}

	
###########################
###########################  BEGIN
###########################  STATS
###########################
	
	
	function stats($id,$colour1,$colour2)
	{
		if(is_numeric($id))
		{
			require("mysql_connect.php");
			require("lang/english/stats.inc.php");
			
			if (!isset($locale))
				$locale = "en_US";
				
			setlocale(LC_TIME, $locale);

			$thisXXX->c=mysql_query("select t1.url,t1.username,t2.hits,t2.totalhits from CC_users as t1, CC_counter as t2 where t1.id='$id' and t2.id='$id'");
			$thisXXX->d=mysql_fetch_object($thisXXX->c);
			if(is_object($thisXXX->d))
			{
				
				echo '<table width="100%" border="0" cellpadding="4" cellspacing="0" class="bottom">';
				
				if(isset($GLOBALS['HTTP_COOKIE_VARS']['ccuser'])){
					if ($GLOBALS['HTTP_COOKIE_VARS']['ccuser']==$thisXXX->d->username){
						echo "<tr><td class=\\"menitabla\\"><center><font face=\\"Arial\\"><font size=2><b> | <a href=login.php>",$lang['counter_options'],"</a> | <a href=login.php?t=cp>",$lang['change_pass'],"</a> | <a href=logout.php>",$lang['logout'],"</a> | <br> | <b><a href=login.php?t=co>",$lang['retrieve_counter_code'],"</a></b> | <a href=login.php?t=cs>",$lang['clear_stats'],"</a> |</font></center></td></tr>";
					}
				}
					
				echo '<tr><td align="center" class="menitabla2">';
				echo "<font face=\\"Arial\\"><font size=3>",$lang['site_stats_for']," <a href=".$thisXXX->d->url." target=new>".$thisXXX->d->url."</a></font> <br><font size=1>",$lang['statistics_last_updated_on'],": Real Time</font></td></tr>";
				
				echo '</table><br>';
					if (!isset($thisXXX->num_top_referrers))
						$thisXXX->num_top_referrers=20;
					
					if (!isset($thisXXX->num_last_referrers))
						$thisXXX->num_last_referrers=10;
					
					if (!isset($thisXXX->num_top_search))
						$thisXXX->num_top_search=20;
					
					if (!isset($thisXXX->num_last_search))
						$thisXXX->num_last_search=10;

					if (!isset($thisXXX->num_detailed))
						$thisXXX->num_detailed=25;
				
					if($thisXXX->expand1=="yes"){$line1="[<a href='$thisXXX->php_self?i=$id&ex1=&ex2=$thisXXX->expand2&ex3=$thisXXX->expand3'>".$lang['close']."</a>] <font color=\\"#006600\\"><b>".$lang['visitor_activity']."</b></font> <font size=1>(".$lang['top']." ".$thisXXX->num_top_referrers." ".$lang['referrers'].", ".$lang['last']." ".$thisXXX->num_last_referrers." ".$lang['referrers'].", ".$lang['top']." ".$thisXXX->num_top_search." ".$lang['keywords'].", ".$lang['last']." ".$thisXXX->num_last_search." ".$lang['keywords'].")</font><br>";}
					else if($thisXXX->expand1==""){$line1="[<a href='$thisXXX->php_self?i=$id&ex1=yes&ex2=$thisXXX->expand2&ex3=$thisXXX->expand3'>".$lang['view']."</a>] <font color=\\"#006600\\"><b>".$lang['visitor_activity']."</b></font> <font size=1>(".$lang['top']." ".$thisXXX->num_top_referrers." ".$lang['referrers'].", ".$lang['last']." ".$thisXXX->num_last_referrers." ".$lang['referrers'].", ".$lang['top']." ".$thisXXX->num_top_search." ".$lang['keywords'].", ".$lang['last']." ".$thisXXX->num_last_search." ".$lang['keywords'].")</font><br>";}
					else {}
					
					if($thisXXX->expand2=="yes"){$line2="[<a href='$thisXXX->php_self?i=$id&ex1=$thisXXX->expand1&ex2=&ex3=$thisXXX->expand3'>".$lang['close']."</a>] <font color=\\"#006600\\"><b>".$lang['visitor_technology']."</b></font> <font size=1>(".$lang['operating_systems'].", ".$lang['web_browsers'].", ".$lang['screen_resolutions'].")</font><br>";}
					else if($thisXXX->expand2==""){$line2="[<a href='$thisXXX->php_self?i=$id&ex1=$thisXXX->expand1&ex2=yes$thisXXX->expand2&ex3=$thisXXX->expand3'>".$lang['view']."</a>] <font color=\\"#006600\\"><b>".$lang['visitor_technology']."</b></font> <font size=1>(".$lang['operating_systems'].", ".$lang['web_browsers'].", ".$lang['screen_resolutions'].")</font><br>";}
					else {}
					
					if($thisXXX->expand3=="yes"){$line3="[<a href='$thisXXX->php_self?i=$id&ex1=$thisXXX->expand1&ex2=$thisXXX->expand2&ex3='>".$lang['close']."</a>] <font color=\\"#006600\\"><b>".$lang['detailed_analysis']."</b></font><br>";}
					else if($thisXXX->expand3==""){$line3="[<a href='$thisXXX->php_self?i=$id&ex1=$thisXXX->expand1&ex2=$thisXXX->expand2&ex3=yes'>".$lang['view']."</a>] <font color=\\"#006600\\"><b>".$lang['detailed_analysis']."</b></font><br>";}
					else {}

					echo '<table width="100%" border="0" cellpadding="4" cellspacing="0" class="bottom"><tr><td bgcolor="white"><font face=arial size=2>';
					echo $line1;
					echo $line2;
					echo $line3;
					echo '</font></td></tr></table><br>';

		  		echo '<table width="100%" valign="left" cellspacing="0" cellpadding="0"><tr><td>';
				echo '<table width="100%" valign="left" cellspacing="0" cellpadding="0"><tr><td width="266">';
				echo '<table width="250" border="0" cellpadding="4" cellspacing="0" class="bottom">';
				echo '<tr><td width="60%" class="menitabla3"><font size="2" face=arial>',$lang['total_visitors'],':</font></td><td bgcolor="white" width="41%"> <div align="center"><font size="2" face="arial"><strong>'.$thisXXX->d->hits.'</strong></font></div></td></tr>';
				echo '<tr><td width="60%" class="menitabla3"><font size="2" face=arial>',$lang['total_hits'],':</font></td><td bgcolor="white" width="41%"> <div align="center"><font size="2" face="arial"><strong>'.$thisXXX->d->totalhits.'</strong></font></div></td></tr>';
				echo '</td></tr></table>';
				echo '</td><td width="332">';
				echo '<table width="250" border="0" cellpadding="4" cellspacing="0" class="bottom">';

				$day=date("d",time());
				$month=date("m",time());
				$year=date("Y",time());	
				$thisXXX->start_day2 = mktime (0,0,0,$month,$day,$year);
				
				$thisXXX->c2=mysql_query("select count(*) from _$id where time >= $thisXXX->start_day2"); //get the total number of hits AFTER 00:00:00 today
				$thisXXX->array12[]=date("D d",$thisXXX->start_day2).','.$thisXXX->array22[]=mysql_result($thisXXX->c2,0);  //get the day name and day month and total of hits eg Sun 28, 123

				rsort($thisXXX->array22);
				$thisXXX->p12=$thisXXX->array22['0'];
				unset($thisXXX->array22);
				foreach($thisXXX->array12 as $thisXXX->value2)
				{
					$thisXXX->colour=($thisXXX->i++&1)?$colour1:$colour2;
					$thisXXX->value2=explode(",",$thisXXX->value2);
					$thisXXX->p32=($thisXXX->value2['1']/$thisXXX->p12)*100;
					echo '<tr><td width="60%" class="menitabla3"><font size="2" face=arial Arial, Helvetica, sans-serif>',$lang['todays_visitors'],':</font></td><td bgcolor="white"><div align="center"><font face="arial"><strong><font size="2">';
					echo $thisXXX->value2['1']; //TOTAL HITS FOR TODAY
					echo "</font></strong></font></div></td></tr>";	
				}
				

				$day=date("d",time());
				$month=date("m",time());
				$year=date("Y",time());	
				$thisXXX->start_day3 = mktime (0,0,0,$month,$day,$year);
				
				$thisXXX->c3=mysql_query("select count(*) from _$id where time >= $thisXXX->start_day3");
				$thisXXX->array13[]=date("D d",$thisXXX->start_day3).','.$thisXXX->array23[]=mysql_result($thisXXX->c3,0); 

				rsort($thisXXX->array23);
				$thisXXX->p13=$thisXXX->array23['0'];
				unset($thisXXX->array23);
				foreach($thisXXX->array13 as $thisXXX->value3)
				{
					$thisXXX->colour=($thisXXX->i++&1)?$colour1:$colour2;
					$thisXXX->value3=explode(",",$thisXXX->value3);
					$thisXXX->p33=($thisXXX->value3['1']/$thisXXX->p13)*100;
					$currhour = date("G",time());
					$estimate = number_format($thisXXX->value2['1'] + (24-$currhour)*($thisXXX->value3['1']/24),0); //estimate is current visitors plus number of hours left in day, times number of visitors for the day, divided by 24 hours
					echo '<tr><td width="60%" class="menitabla3"><font size="2" face=arial Arial, Helvetica, sans-serif>',$lang['todays_forecast'],'<b>*</b>:</font></td><td bgcolor="white"><div align="center"><font face="arial"><strong><font size="2">';
					echo "$estimate"; //HITS FORECAST FOR TODAY
					echo "</font></strong></font></div></td></tr>";
					echo '</td></tr></table></td></tr></table>';
					echo '<table width="100%" valign="left" cellspacing="0" cellpadding="5" >';
					echo '<tr><td><font size="1" face="Verdana, Arial, Helvetica, sans-serif">* ',$lang['forecast_star'],'.</font></td></tr>';
					echo '</table></table>';
					echo'<div style="padding-bottom: 2"><!-- Banner 728x90 BEGIN --><!-- Banner 728x90 END --></div>';
				}

				if(!$thisXXX->z)
				{
					$day=date("d",time())+1;
					$month=date("m",time());
					$year=date("Y",time());	
					$thisXXX->start_day = mktime (0,0,0,$month,$day,$year);

					for($thisXXX->i=0;$thisXXX->i<$thisXXX->keep_stats;$thisXXX->i++) //loop through for all days we are showing stats for
					{
						$day=date("d",time())-$thisXXX->i;
						$month=date("m",time());
						$year=date("Y",time());
						$thisXXX->new = mktime (0,0,0,$month,$day,$year);
						
						$thisXXX->c=mysql_query("select count(*) from _$id where time >= $thisXXX->new and time <= $thisXXX->start_day");
						$thisXXX->array1[]=strftime("%a %d",$thisXXX->new).','.$thisXXX->array2[]=mysql_result($thisXXX->c,0);
						$thisXXX->start_day=$thisXXX->new;
					}

					rsort($thisXXX->array2);
					$thisXXX->p1=$thisXXX->array2['0'];
					unset($thisXXX->array2);

				if ($thisXXX->visitors_graph_align != "horizontal" && $thisXXX->visitors_graph_align != "vertical" || !isset($thisXXX->visitors_graph_align))
					$thisXXX->visitors_graph_align = "vertical";
					
				if ($thisXXX->visitors_graph_align == "vertical"){
					echo '<table width="100%" border="0" cellpadding="4" cellspacing="0" class="bottom"><tr> <td class="top"> <strong><font size="3" face="Geneva, Arial, Helvetica, sans-serif" color=white>',$lang['visitors_report'],':</font></strong></td></tr><tr><td bgcolor="white">';
					echo "<table width=\\"100%\\" height=\\"100\\" border=\\"0\\" cellspacing=\\"0\\" cellpadding=\\"0\\"><tr>";
					$j = 0;
					foreach($thisXXX->array1 as $thisXXX->value)
					{
						$thisXXX->value=explode(",",$thisXXX->value);
						$thisXXX->colour=($thisXXX->i++&1)?$colour1:$colour2;
						$thisXXX->p3=($thisXXX->value['1']/$thisXXX->p1)*100;

						echo "<td valign=\\"bottom\\"><table width=\\"100%\\" cellpadding=\\"0\\" cellspacing=\\"0\\"><tr><td valign=\\"bottom\\" height=\\"10\\"><div align=center><font face=\\"arial\\" size=1>".$thisXXX->value['1']."</font></div></td></tr><tr><td valign=\\"bottom\\"><div align=center><table width=\\"" . (500/$thisXXX->keep_stats - (500/$thisXXX->keep_stats * 0.08)) . "\\" height=\\"100%\\" border=\\"0\\" cellpadding=\\"0\\" cellspacing=\\"0\\" bordercolor=\\"#000000\\"><tr><td height=\\"$thisXXX->p3\\" width=\\"" . 500/$thisXXX->keep_stats . "\\" valign=\\"bottom\\" bgcolor=$thisXXX->colour></td></tr></table></div></td></tr><tr><td valign=\\"bottom\\" height=\\"10\\"><div align=center><font face=\\"arial\\" size=\\"1\\">";
						
						if ((500/$thisXXX->keep_stats) > 36 ){
							echo $thisXXX->value['0'];
							
							if ($show_percent == "yes"){
								$yesterday=explode(",",$thisXXX->array1[$j+1]);
								$percent = number_format((($thisXXX->value['1']-$yesterday[1])/$yesterday[1])*(100/1),0,".","");

								if ($percent == 0)
									echo "<br>&nbsp;";
								elseif ($percent > 0)
									echo "<br><font color=\\"green\\">+" . $percent . "%</font>";
								else
									echo "<br><font color=\\"red\\">" . $percent . "%</font>";
									
								$j++;
							}
						} else {
							echo strtoupper(substr($thisXXX->value['0'],0,1))." ".substr($thisXXX->value['0'],4);
						}
							
						echo "</font></div></td></tr></table></td>";
					
					}
	
					echo "</tr></table>";
					echo '</td></tr></table>';
				}

				if ($thisXXX->visitors_graph_align == "horizontal"){
					echo '<table width="100%" border="0" cellpadding="4" cellspacing="0" class="bottom"><tr> <td class="top"> <strong><font size="3" face="Geneva, Arial, Helvetica, sans-serif" color=white>Visitors Report For The Last '.$thisXXX->keep_stats.' Days:</font></strong></td></tr><tr><td bgcolor="white">';
					echo "<table width=\\"100%\\" height=\\"100\\" border=\\"0\\" cellspacing=\\"0\\" cellpadding=\\"0\\">";
					foreach($thisXXX->array1 as $thisXXX->value)
					{
						$thisXXX->value=explode(",",$thisXXX->value);

						$thisXXX->colour=($thisXXX->i++&1)?$colour1:$colour2;
						$thisXXX->p3=($thisXXX->value['1']/$thisXXX->p1)*500;

						echo "<tr><td height=\\"25\\"><div align=\\"right\\"><font face=\\"arial\\" size=1>".$thisXXX->value['0']."</font></div></td><td width=\\"5\\"></td><td><table height=\\"4\\" cellpadding=\\"0\\" cellspacing=\\"0\\"><tr><td><table border=\\"0\\" bordercolor=\\"black\\" cellspacing=\\"0\\"><tr><td width=\\"$thisXXX->p3\\" height=\\"10\\" valign=\\"bottom\\" bgcolor=$thisXXX->colour></td></tr></table></td><td width=\\"5\\"></td><td><font face=\\"arial\\" size=\\"1\\">".$thisXXX->value['1']."</font></td></tr></table></td></tr>";
					
					}

					echo "</table>";
					echo '</td></tr></table>';
				}
					
					
					if($thisXXX->expand1=="yes"){

					echo '<br><table width="100%" border="0" cellpadding="4" cellspacing="0" class="bottom"><tr><td class="top"><strong><font size="3" color=white face="Geneva, Arial, Helvetica, sans-serif">',$lang['top'],' '.$thisXXX->num_top_referrers.' ',$lang['referrers'],': </font></strong></td></tr><tr><td bgcolor="white">';
					echo "<table width=\\"100%\\" border=\\"0\\" cellpadding=\\"4\\" cellspacing=\\"0\\" bgcolor=\\"#FFFFFF\\">";
					$thisXXX->url=str_replace("http://www.","http://",$thisXXX->d->url);
					$thisXXX->c=mysql_query("select referer,count(*) as g from _$id where referer not like '".$thisXXX->d->url."%' and referer not like '$thisXXX->url%' group by referer order by g desc limit " . $thisXXX->num_top_referrers);
					while($thisXXX->d=mysql_fetch_object($thisXXX->c))
					{
						$thisXXX->p3=$thisXXX->d->g;
						$thisXXX->p4++;

						$thisXXX->d->referer2 = $thisXXX->referers($thisXXX->d->referer);

						if (strlen($thisXXX->d->referer2) > 200) $size="1";
						else $size="2";

						echo "<tr><td width=\\"55\\"><div align=center><font face=arial size=2><b>",$thisXXX->d->g,"</b></font></div></td><td class=\\"menitabla3\\"><font face=arial size=$size>",stripslashes($thisXXX->d->referer2),"</font></td></tr>";
					}
					

					echo '</table>';
					echo '</td></tr></table>';
					
					


				echo '<br><table width="100%" border="0" cellpadding="4" cellspacing="0" class="bottom"><tr><td class="top"><strong><font size="3" color=white face="Geneva, Arial, Helvetica, sans-serif">',$lang['last'],' '.$thisXXX->num_last_referrers.' ',$lang['referrers'],':</font></strong></td><tr><td bgcolor=#FFFFFF>';
				echo "<a name=stats></a><table border=0 width=100% bgcolor=\\"#FFFFFF\\" cellpadding=4 cellspacing=0>";
				if(!is_numeric($thisXXX->z))
					$thisXXX->z=0;
				$thisXXX->c=mysql_query("select * from _$id order by id desc limit $thisXXX->z,".$thisXXX->num_last_referrers);
				unset($thisXXX->i);
				while($thisXXX->d=mysql_fetch_object($thisXXX->c))
				{					
					$thisXXX->d->referer2 = $thisXXX->referers($thisXXX->d->referer);
					
					if (strlen($thisXXX->d->referer2) > 200) $size="1";
					else $size="2";
					
					echo "<font face='Arial'><tr><td width=55><font face=arial size=1><div align=center>",date("d/m/Y H:i:s",$thisXXX->d->time),"</div></font></td><td class=\\"menitabla3\\"><font face=arial size=$size>",stripslashes($thisXXX->d->referer2),"</font></td>";
				}
					echo '</table></td></tr></table>';
				
					
					/////////// FLAG STATS BEGIN
					echo '<br><table width="100%" border="0" cellpadding="4" cellspacing="0" class="bottom"><tr><td class="top"><strong><font size="3" color=white face="Geneva, Arial, Helvetica, sans-serif">',$lang['top'],' '.$thisXXX->num_last_search.' ',$lang['country'],':</font></strong></td></tr><tr><td bgcolor="white">';
					echo "<table width=\\"100%\\" border=\\"0\\" cellpadding=\\"4\\" cellspacing=\\"0\\" bgcolor=\\"#FFFFFF\\">";
					unset($thisXXX->p4);
					unset($thisXXX->p2);
					unset($thisXXX->p3);
					
					
					$thisXXX->c=mysql_query("select spare2,count(*) as g from _$id where spare2 <> '' AND spare2 <> 'null' group by spare2 order by g desc limit ". $thisXXX->num_last_search);
					while($thisXXX->d=mysql_fetch_object($thisXXX->c))
					{
						if(!$thisXXX->p4)
						$thisXXX->p3=$thisXXX->d->g;
						$thisXXX->p4++;
						$thisXXX->colour=($thisXXX->i++&1)?$colour1:$colour2;
						$thisXXX->p2=($thisXXX->d->g/$thisXXX->p3)*100;
						$thisXXX->p2= round($thisXXX->p2)*2;
						
						$match=array(" ","/");
						$replace=array("_","-");
						$flag = str_replace($match,$replace,$thisXXX->d->spare2);
						if (preg_match('/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/', $flag)) { $flag = "unknown"; }
						$flag = strtolower($flag);
						echo "<tr><td class=\\"menitabla3\\"><img align=absmiddle src=data/flags/$flag.gif> <font face=arial size=2>",stripslashes(urldecode($thisXXX->d->spare2)),"</font></td><td width=\\"45\\"><div align=center><font face=arial size=2><b>",$thisXXX->d->g,"</b></font></div></td><td width=\\"200\\" bgcolor=\\"#FFFFFF\\"><table height=\\"10\\" width=\\"$thisXXX->p2\\" bgcolor=\\"$thisXXX->colour\\" cellpadding=\\"0\\" cellspacing=\\"0\\" border=\\"0\\" bordercolor=\\"#000000\\"><tr><td></td></tr></table></td></tr>";
						
					}
					
					echo '</table>';
					echo '</td></tr></table>';
					
					/////////// FLAG STATS END
					
				
					echo '<br><table width="100%" border="0" cellpadding="4" cellspacing="0" class="bottom"><tr><td class="top"><strong><font size="3" color=white face="Geneva, Arial, Helvetica, sans-serif">',$lang['top'],' '.$thisXXX->num_top_search.' ',$lang['keywords'],':</font></strong></td></tr><tr><td bgcolor="white">';
					echo "<table width=\\"100%\\" border=\\"0\\" cellpadding=\\"4\\" cellspacing=\\"0\\" bgcolor=\\"#FFFFFF\\">";
					unset($thisXXX->p4);
					unset($thisXXX->p2);
					unset($thisXXX->p3);
					
					
					$thisXXX->c=mysql_query("select spare1,count(*) as g from _$id where spare1 <> '' AND spare1 <> 'null' group by spare1 order by g desc limit ".$thisXXX->num_top_search);
					while($thisXXX->d=mysql_fetch_object($thisXXX->c))
					{
						if(!$thisXXX->p4)
							$thisXXX->p3=$thisXXX->d->g;
						$thisXXX->p4++;
						$thisXXX->colour=($thisXXX->i++&1)?$colour1:$colour2;
						$thisXXX->p2=($thisXXX->d->g/$thisXXX->p3)*100;
						$thisXXX->p2= round($thisXXX->p2)*2;
						
						
						echo "<tr><td class=\\"menitabla3\\"><font face=arial size=2>",stripslashes(urldecode($thisXXX->d->spare1)),"</font></td><td width=\\"45\\"><div align=center><font face=arial size=2><b>",$thisXXX->d->g,"</b></font></div></td><td width=\\"200\\" bgcolor=\\"#FFFFFF\\"><table height=\\"10\\" width=\\"$thisXXX->p2\\" bgcolor=\\"$thisXXX->colour\\" cellpadding=\\"0\\" cellspacing=\\"0\\" border=\\"0\\" bordercolor=\\"#000000\\"><tr><td></td></tr></table></td></tr>";
						
					}
					
					echo '</table>';
					echo '</td></tr></table>';
					
					echo '<br><table width="100%" border="0" cellpadding="4" cellspacing="0" class="bottom"><tr><td class="top"><strong><font size="3" color=white face="Geneva, Arial, Helvetica, sans-serif">',$lang['last'],' '.$thisXXX->num_last_search.' ',$lang['keywords'],':</font></strong></td><tr><td bgcolor=#FFFFFF>';
					echo "<a name=stats></a><table border=0 width=100% bgcolor=\\"#FFFFFF\\" cellpadding=4 cellspacing=0>";
					if(!is_numeric($thisXXX->z))
					$thisXXX->z=0;
					$thisXXX->c=mysql_query("select * from _$id where spare1 <> '' AND spare1 <> 'null' order by id desc limit $thisXXX->z," . $thisXXX->num_last_search);
					unset($thisXXX->i);
					while($thisXXX->d=mysql_fetch_object($thisXXX->c))
					{
						

					$thisXXX->colour=($thisXXX->i++&1)?$colour1:$colour2;

					echo "<font face='Arial'><tr><td width=55><font face=arial size=1><div align=center>",date("d/m/Y H:i:s",$thisXXX->d->time),"</div></font></td><td class=\\"menitabla3\\"><font face=arial size=2>",stripslashes(urldecode($thisXXX->d->spare1)),"</font></td>";
					}
					echo '</table></td></tr></table>';
}
else {}
if($thisXXX->expand2=="yes")
{
					echo '<br><table width="100%" border="0" cellpadding="4" cellspacing="0" class="bottom"><tr><td class="top"><strong><font color=white size="3" face="Geneva, Arial, Helvetica, sans-serif">',$lang['operating_systems'],' ',$lang['in_use'],':</font></strong></td></tr><tr><td bgcolor="white">';
					echo "<table width=\\"100%\\" border=\\"0\\" cellpadding=\\"4\\" cellspacing=\\"0\\" bgcolor=\\"#FFFFFF\\">";
					unset($thisXXX->p4);
					unset($thisXXX->p2);
					unset($thisXXX->p3);
					
					$thisXXX->c=mysql_query("select os,count(*) as g from _$id where os != '&nbsp;' group by os order by g desc limit 10");

					while($thisXXX->d=mysql_fetch_object($thisXXX->c))
					{
						if(!$thisXXX->p4)
							$thisXXX->p3=$thisXXX->d->g;
						$thisXXX->p4++;
						$thisXXX->colour=($thisXXX->i++&1)?$colour1:$colour2;
						$thisXXX->p2=($thisXXX->d->g/$thisXXX->p3)*100;
						$thisXXX->p2= round($thisXXX->p2)*2;
						

						 

						echo "<tr><td class=\\"menitabla3\\"><font face=arial size=2>",$thisXXX->d->os,"</font></td><td width=\\"45\\"><div align=center><font face=arial size=2><b>",$thisXXX->d->g,"</b></font></div></td><td width=\\"200\\" bgcolor=\\"#FFFFFF\\"><table height=\\"10\\" width=$thisXXX->p2 bgcolor=\\"$thisXXX->colour\\" cellpadding=\\"0\\" cellspacing=\\"0\\" border=\\"0\\" bordercolor=\\"#000000\\"><tr><td></td></tr></table></td></tr>";
						
					}
					unset($thisXXX->p4);
					
					echo '</table>';
					echo '</td></tr></table>';
					
				
				

					echo '<br><table width="100%" border="0" cellpadding="4" cellspacing="0" class="bottom"><tr><td class="top"><strong><font size="3" color=white face="Geneva, Arial, Helvetica, sans-serif">',$lang['web_browsers'],' ',$lang['in_use'],':</font></strong></td></tr><tr><td bgcolor="white">';
					echo "<table width=\\"100%\\" border=\\"0\\" cellpadding=\\"4\\" cellspacing=\\"0\\" bgcolor=\\"#FFFFFF\\">";
					unset($thisXXX->p4);
					unset($thisXXX->p2);
					unset($thisXXX->p3);
					$thisXXX->c=mysql_query("select browser,count(*) as g from _$id where browser != '&nbsp;' group by browser order by g desc limit 10");
					while($thisXXX->d=mysql_fetch_object($thisXXX->c))
					{
						if(!$thisXXX->p4)
							$thisXXX->p3=$thisXXX->d->g;
						$thisXXX->p4++;
						$thisXXX->colour=($thisXXX->i++&1)?$colour1:$colour2;
						$thisXXX->p2=($thisXXX->d->g/$thisXXX->p3)*100;
						$thisXXX->p2= round($thisXXX->p2)*2;
						
						echo "<tr><td class=\\"menitabla3\\"><font face=arial size=2>",stripslashes($thisXXX->d->browser),"</font></td><td width=\\"45\\"><div align=center><font face=arial size=2><b>",$thisXXX->d->g,"</b></font></div></td><td width=\\"200\\" bgcolor=\\"#FFFFFF\\"><table height=\\"10\\" width=\\"$thisXXX->p2\\" bgcolor=\\"$thisXXX->colour\\" cellpadding=\\"0\\" cellspacing=\\"0\\" border=\\"0\\" bordercolor=\\"#000000\\"><tr><td></td></tr></table></td></tr>";
						
					}
					
					echo '</table>';
					echo '</td></tr></table>';


					echo '<br><table width="100%" border="0" cellpadding="4" cellspacing="0" class="bottom"><tr><td class="top"><strong><font color=white size="3" face="Geneva, Arial, Helvetica, sans-serif">',$lang['screen_resolutions'],' ',$lang['in_use'],':</font></strong></td></tr><tr><td bgcolor="white">';
					echo "<table width=\\"100%\\" border=\\"0\\" cellpadding=\\"4\\" cellspacing=\\"0\\" bgcolor=\\"#FFFFFF\\">";
					unset($thisXXX->p4);
					$thisXXX->c=mysql_query("select screen,count(*) as g from _$id where screen != '&nbsp;' group by screen order by g desc limit 10");
					while($thisXXX->d=mysql_fetch_object($thisXXX->c))
					{
						if(!$thisXXX->p4)
							$thisXXX->p3=$thisXXX->d->g;
						$thisXXX->p4++;
						$thisXXX->colour=($thisXXX->i++&1)?$colour1:$colour2;
						$thisXXX->p2=($thisXXX->d->g/$thisXXX->p3)*100;
						$thisXXX->p2= round($thisXXX->p2)*2;
						
						echo "<tr><td class=\\"menitabla3\\"><font face=arial size=2>",stripslashes($thisXXX->d->screen),"</font></td><td width=\\"45\\"><div align=center><font face=arial size=2><b>",$thisXXX->d->g,"</b></font></div></td><td width=\\"200\\" bgcolor=\\"#FFFFFF\\"><table height=\\"10\\" width=\\"$thisXXX->p2\\" bgcolor=\\"$thisXXX->colour\\" cellpadding=\\"0\\" cellspacing=\\"0\\" border=\\"0\\" bordercolor=\\"#000000\\"><tr><td></td></tr></table></td></tr>";
					
					}
					unset($thisXXX->p4);

					echo '</table>';
					echo '</td></tr></table>';



}
else {}
				}

if($thisXXX->expand3=="yes")
{

				echo '<br><table width="100%" border="0" cellpadding="4" cellspacing="0" class="bottom"><tr><td class="top"><strong><font size="3" color=white face="Geneva, Arial, Helvetica, sans-serif">',$lang['detailed_analysis'],':</font></strong></td><tr><td bgcolor=#FFFFFF>';
				echo "<a name=stats></a><table border=0 width=100% bgcolor=\\"#FFFFFF\\" cellpadding=3 cellspacing=0><tr><td class=\\"menitabla3\\"><b><div align=center><font size=1 face=arial>",$lang['visit'],"</font></div></td><td class=\\"menitabla3\\" align=\\"center\\" width=20><b><font size=1 face=arial><div align=center> ",$lang['date_time']," </div></font></td><td class=\\"menitabla3\\"><b><div align=center><font size=1 face=arial>",$lang['ip'],"</font></div></td><td class=\\"menitabla3\\"><b><div align=center><font size=1 face=arial>",$lang['browser'],"</font></div></td><td class=\\"menitabla3\\"><b><div align=center><font size=1 face=arial>",$lang['os'],"</font></div></td><td class=\\"menitabla3\\"><b><div align=center><font size=1 face=arial>",$lang['screen'],"</font></div></td><td class=\\"menitabla3\\"><b><div align=center><font size=1 face=arial>",$lang['color'],"</font></div></td></tr></font>";
				if(!is_numeric($thisXXX->z))
					$thisXXX->z=0;
				$thisXXX->c=mysql_query("select * from _$id order by id desc limit $thisXXX->z,$thisXXX->num_detailed");
				unset($thisXXX->i);
				while($thisXXX->d=mysql_fetch_object($thisXXX->c))
				{
					if($thisXXX->d->referer)
					{
						$thisXXX->d->referer=stripslashes($thisXXX->d->referer);
						$thisXXX->d->referer='<a href='.$thisXXX->d->referer.' target=newindow>'.$thisXXX->d->referer.'</a>';
					}
					else
						$thisXXX->d->referer='self referred';
					$thisXXX->colour=($thisXXX->i++&1)?$colourDA1:$colourDA2;
					echo "<font face='Arial'><tr><td align=\\"center\\" bgcolor=\\"$thisXXX->colour\\"><font face=arial size=1><div align=center>",$thisXXX->d->id,"</div></font><td width=20 bgcolor=\\"$thisXXX->colour\\"><font face=arial size=1><div align=center>",date("d/m/Y H:i:s",$thisXXX->d->time),"</div></font></td><td align=\\"center\\" bgcolor=\\"$thisXXX->colour\\"><font face=arial size=1><div align=center>",stripslashes($thisXXX->d->ip),"</div></font></td><td width=80 align=\\"center\\" bgcolor=\\"$thisXXX->colour\\"><font face=arial size=1>",stripslashes($thisXXX->d->browser),"</font></td><td align=\\"center\\" bgcolor=\\"$thisXXX->colour\\"><font face=arial size=1>",stripslashes($thisXXX->d->os),"</font></td><td align=\\"center\\" bgcolor=\\"$thisXXX->colour\\"><font face=arial size=1>",stripslashes($thisXXX->d->screen),"</font></td><td align=\\"center\\" bgcolor=\\"$thisXXX->colour\\"><font face=arial size=1>",stripslashes($thisXXX->d->depth)," bit</font></td></tr></font>";
				}
				echo '</table></td></tr></table>';
				
				}
else {}
				
				if(mysql_num_rows($thisXXX->c)==25)
									
		
				flush();
				$thisXXX->seconds=time()-(60*60*24*$thisXXX->keep_stats);
				mysql_query("delete from _$id where time < $thisXXX->seconds");
			}
			else
			{
						
			}
			mysql_close();
		}
		else
		{
			echo "$id is an invalid ID";	
		}
		mysql_close();
	}
	
	function referers($referer=NULL)
	{
		require("config.inc.php");
		require("lang/english/stats.inc.php");
		
		if(!isset($referer)||empty($referer)){
			$output ='<b><font color=green>'.$lang['self_refer'].'</font></b>';
		} else if ( preg_match("/Google/i", $referer) ){
			$output = "<b>Google ".$lang['search']."</b>";
		} else if ( preg_match("/search.yahoo/i", $referer) ){
			$output = "<b>Yahoo ".$lang['search']."</b>";
		} else if ( preg_match("/Yahoo ".$lang['search']."/i", $referer) ){
			$output = "<b>Yahoo ".$lang['search']."</b>";
		} else if ( preg_match("/altavista/i", $referer) ){
			$output = "<b>Altavista ".$lang['search']."</b>";
		} else if ( preg_match("/search.aol/i", $referer) ){
			$output = "<b>AOL ".$lang['search']."</b>";
		} else if ( preg_match("/Aol ".$lang['search']."/i", $referer) ){
			$output = "<b>AOL ".$lang['search']."</b>";
		} else if ( preg_match("/excite/i", $referer) ){
			$output = "<b>Excite ".$lang['search']."</b>";
		} else if ( preg_match("/hotbot/i", $referer) ){
			$output = "<b>HotBot ".$lang['search']."</b>";
		} else if ( preg_match("/AllTheWeb/i", $referer) ){
			$output = "<b>AllTheWeb ".$lang['search']."</b>";
		} else if ( preg_match("/search.msn/i", $referer) ){
			$output = "<b>MSN ".$lang['search']."</b>";
		} else if ( preg_match("/MSN ".$lang['search']."/i", $referer) ){
			$output = "<b>MSN ".$lang['search']."</b>";
		} else if ( preg_match("/lycos/i", $referer) ){
			$output = "<b>Lycos ".$lang['search']."</b>";
		} else if ( preg_match("/Netscape/i", $referer) ){
			$output = "<b>Netscape ".$lang['search']."</b>";
		} else if ( preg_match("/WebCrawler/i", $referer) ){
			$output = "<b>WebCrawler ".$lang['search']."</b>";
		} else if ( preg_match("/ask.com|askjeeves.com|aj.com/i", $referer) ){
			$output = "<b>Ask Jeeves ".$lang['search']."</b>";
		} else if ( preg_match("/Search.com/", $referer) ){
			$output = "<b>Search.com ".$lang['search']."</b>";	
		} else if ( preg_match("/Hidden-Referrer/i", $referer) ){
			$output = "<b><font color=red> ".$lang['hidden_referrer']."</font></b>";
		} else if ( preg_match("/blockedReferrer/i", $referer) ){
			$output = "<b><font color=red> ".$lang['blocked_referrer']."</font></b>";			
		} else if ( preg_match("/pogodak/i", $referer) ){
			$output = "<b>Pogodak ".$lang['search']."</b>";
		} else {
			$displayLink = "";

			if (strlen($referer) > $url_len){
				for ($i = 0; $i < strlen($referer); $i = $i + $url_len){
					$displayLink .= substr($referer,$i,$url_len) . "<br>";
				}
			} else {
				$displayLink = $referer;
			}

			$output = "<a href=\\"".$referer."\\" target=anotherwindow>".$displayLink."</a>";
		}
		
		return $output;
	}

	function lost_pass()
	{
		require("lang/english/lostpass.inc.php");
		
		if(($thisXXX->username||$thisXXX->uid)&&$thisXXX->email)
		{
			if(!is_numeric($thisXXX->uid))
				$thisXXX->uid=0;
			$thisXXX->z='select id,username,email from CC_users where';
			if($thisXXX->username)
				$thisXXX->z.=" username='$thisXXX->username'";				
			if($thisXXX->uid)
				$thisXXX->z.=" id='$thisXXX->uid'";
			$thisXXX->z.=" and email='$thisXXX->email'";
			include("mysql_connect.php");
			$thisXXX->c=@mysql_query($thisXXX->z);
			$thisXXX->d=@mysql_fetch_object($thisXXX->c);
			
			if(is_object($thisXXX->d))
			{
				$thisXXX->email=$thisXXX->d->email;
				$thisXXX->username=$thisXXX->d->username;
				$thisXXX->uid=$thisXXX->d->id;
				$thisXXX->last_id=$thisXXX->d->id;
				$thisXXX->gen_password();
				$thisXXX->welcome_mail();
				mysql_query("update CC_users set password=md5('$thisXXX->password') where id='$thisXXX->uid'");
				
				echo '<font face=arial size=2><b><font color=green>',$lang['success'],'</font></b><br><br>',$lang['success_msg'],'</font>';
			}
			else
			{
				echo '<font face=arial size=2><b><font color=red>',$lang['error'],'</font></b><br><br>',$lang['error_msg'],'</font>';
			}
			mysql_close();
		}
		else
		{
			echo '<font face=arial size=2>',$lang['lost_pass_instructions'],'</font><br>';
			echo '<font face=arial size=2><form method=post action=lostpass.php><table><tr><td><font face="Arial" size=2><div align=right>',$lang['username'],':</div></font></td><td><input type=text name=username maxlength=255></td></tr><tr><td><font face="Arial" size=2><div align=right>',$lang['or_user_id'],'&nbsp;</div></font></td><td><input type=text name=i maxlength=255></td></tr><tr><td align=right><font face="Arial" size=2><div align="right">',$lang['email'],':</div></font></td><td><input type=text name=email maxlength=255></td></tr><tr><td>&nbsp;</td><td><input class=submit type=submit value="',$lang['retrieve'],'"></td></tr></table></form></font>';
			
		}
	}

	function login()
	{
		include("mysql_connect.php");
		require("lang/english/login.inc.php");
		$thisXXX->ccuser=substr(addslashes($GLOBALS['ccuser']),0,255);
		$thisXXX->ccpass=substr(addslashes($GLOBALS['ccpass']),0,255);

		if($thisXXX->ccuser&&$thisXXX->ccpass)
			$thisXXX->c=mysql_query("select id from CC_users where username='$thisXXX->ccuser' and password='$thisXXX->ccpass'");
		else
			$thisXXX->c=mysql_query("select id from CC_users where username='$thisXXX->username' and password=md5('$thisXXX->password')");
			#$thisXXX->c=mysql_query("select id from CC_users where username='$thisXXX->username' and password='$thisXXX->password'");
		$thisXXX->d=mysql_fetch_object($thisXXX->c);

		if(is_object($thisXXX->d))
		{
			if(!($thisXXX->ccuser&&$thisXXX->ccpass))
			{
				setcookie("ccuser",$thisXXX->username);
				setcookie("ccpass",md5($thisXXX->password));
			}
			return $thisXXX->d->id;
		}
		else
		{
			
			echo "<br><b><font color=red>",$lang['error'],"</font></b><br><br>",$lang['error_msg'];
			$thisXXX->login_form();
			
		}
		mysql_close();
	}

	function login_form()
	{
		require("lang/english/login.inc.php");
		echo "<br><br><form method=post action=login.php><table><tr><td><font face='Arial' size=2><div align=right>",$lang['username'],":</div></font></td><td><input type=text name=username maxlength=255></td></tr><tr><td><font face='Arial' size=2><div align=right>",$lang['password'],":</div></font></td><td><input type=password name=password></td></tr><tr><td colspan=2><div align=right><input class=submit type=submit value=\\"",$lang['login'],"\\"></div></td></tr></table></form>";
	}

	function stats_login_form()
	{
		require("lang/english/login.inc.php");
		echo "<br><br><form method=post action=stats.php><input type=\\"hidden\\" name=\\"i\\" value=\\"" . $GLOBALS['HTTP_GET_VARS']['i'] . "\\"><table><tr><td><font face='Arial' size=2><div align=right>",$lang['username'],":</div></font></td><td><input type=text name=username maxlength=255></td></tr><tr><td><font face='Arial' size=2><div align=right>",$lang['password'],":</div></font></td><td><input type=password name=password></td></tr><tr><td colspan=2><div align=right><input class=submit type=submit value=\\"",$lang['login'],"\\"></div></td></tr></table></form>";
	}


	function logout()
	{
		setcookie("ccuser");
		setcookie("ccpass");
		header("Location: $thisXXX->siteurl/");
	}

	function modify($id,$what)
	{
		require("lang/english/modify.inc.php");
		
		$thisXXX->uid=$id;
		$thisXXX->value=$what;

		echo "
		<font size=1><br></font>
		<table width=\\"100%\\" border=\\"0\\" cellpadding=\\"5\\" cellspacing=\\"0\\" class=\\"bottom\\">
  		<tr>
    		<td class=\\"menitabla\\">
    			<div align=\\"center\\"><font face=Arial size=2>| <a href=$thisXXX->php_self>",$lang['counter_options'],"</a> | <a href=$thisXXX->php_self?t=cp>",$lang['change_pass'],"</a> | <a href=$thisXXX->php_self?t=cs>",$lang['clear_stats'],"</a> | <a href=logout.php>",$lang['logout'],"</a> | <br> | <b><a href=stats.php?i=$id>",$lang['view_site_stats'],"</a></b> | <b><a href=$thisXXX->php_self?t=co>",$lang['retrieve_counter_code'],"</a></b> |</font></div>
    		</td>
  		</tr>
		</table><br>
		";
				
		require("mysql_connect.php");
		if($thisXXX->value=="cp")
		{
			$thisXXX->p1=$GLOBALS['password1'];
			$thisXXX->p2=$GLOBALS['password2'];
			$thisXXX->p3=$GLOBALS['Change'];
			if(($thisXXX->p1==$thisXXX->p2)&&$thisXXX->p3==$lang['change'])
			{
				mysql_query("update CC_users set password=md5('$thisXXX->p1') where id='$thisXXX->uid'");
				setcookie("ccpass",md5($thisXXX->p1));
				echo "<font face='Arial'><font size=4>",$lang['change_of_password'],":</font><br><br><b><font color=green>",$lang['success'],"</font></b><br><br>",$lang['pass_success_msg'],".</font>";
			}
			else
			{
				echo "
					<font face=\\"Arial\\" size=4>",$lang['change_of_password'],":</font><br><br>",$lang['change_pass_instructions'],"</font>
					<form method=post>
				
					<table>
						<tr>
							<td>
								<font face=\\"Arial\\" size=\\"2\\"><b>",$lang['new_password'],":</b></font>
							</td>
							<td>
								<input type=password name=password1>
							</td>
						</tr>
						<tr>
							<td>
								<font face=\\"Arial\\" size=\\"2\\"><b>",$lang['verify_password'],":</b></font>
							</td>
							<td>
								<input type=password name=password2>
							</td>
						</tr>
						<tr>
							<td>
								&nbsp;
							</td>
							<td>
								<input class=submit type=submit name=Change value=",$lang['change'],">
							</td>
						</tr>
					</table>
					
					</form>
				";
			}
		}
		elseif($thisXXX->value=="co")
		{
			echo "<font size=4>",$lang['retrieve_counter_code'],":</font><br><br>";
			echo "<textarea name='select1' wrap='PHYSICAL' cols='45' rows='10'>",($thisXXX->get_counter_code2($thisXXX->uid=$id)),"</textarea><br><br>";
			echo "<font size=4>",$lang['retrieve_useronline_code'],":</font><br><br>";
			echo "<textarea name='select1' wrap='PHYSICAL' cols='45' rows='10'><!-- Free User Online Service - CounterServis.Com - Begin --><SCRIPT language=\\"Javascript\\" src=\\"http://www.counterservis.com/online/online.php?proces=prikazi&id=$id\\"></SCRIPT><!-- Free User Online Service - CounterServis.Com - End --></textarea>";
		}
		elseif($thisXXX->value=="da")
		{
			$thisXXX->p1=$GLOBALS['delete_account'];
			if($thisXXX->p1=="Delete")
			{
				mysql_query("delete from CC_users where id='$thisXXX->uid'");
				mysql_query("delete from CC_counter where id='$thisXXX->uid'");
				mysql_query("drop table _$thisXXX->uid");
				
				$thisXXX->logout();
			}
			elseif($thisXXX->p1=="no")
			{

			}
			else
			{
				echo '<font face="Arial">',$lang['delete_instructions'],'</font><p><form method=post><input type=hidden name=t value=da><input class=submit type=submit name=delete_account value=',$lang['delete'],'></form>';
				
			}
		}
		elseif($thisXXX->value=="cs")
		{
			$thisXXX->p1=$GLOBALS['clear_stats'];
			if($thisXXX->p1=="Erase")
			{
				mysql_query("delete from _$thisXXX->uid");
				echo '<font face="Arial"><font size=4>',$lang['clear_account_statistics'],':</font><br><br><b><font color=green>',$lang['success'],'</font></b><br><br>',$lang['clearstats_success_msg'],'</font>';
				
			}
			elseif($thisXXX->p1=="no")
			{

			}
			else
			{
				echo '<font face="Arial"><font size=4>',$lang['clear_account_statistics'],':</font><br><br>',$lang['clear_stats_instructions'],'</font><p><form method=post><input type=hidden name=t value=da><input class=submit type=submit name=clear_stats value=',$lang['erase'].'></form>';
			}
		}
		else
		{
			$thisXXX->p1=$GLOBALS['modify'];
			if($thisXXX->p1=="yes")
			{
				if(eregi("^[https?://.+\\..+]{1,255}",$thisXXX->url)&&eregi("[.+\\@.+\\..+]{1,255}",$thisXXX->email)&&is_numeric($thisXXX->hits))
				{
					$thisXXX->ip=substr(addslashes($GLOBALS['ban_ip']),0,255);
					$thisXXX->add_site=($thisXXX->add_site=="on")?1:0;
					$thisXXX->use_cookie=($thisXXX->use_cookie=="on")?1:0;
					$thisXXX->admin_can_email=($thisXXX->admin_can_email=="on")?1:0;
					$thisXXX->use_commas=($thisXXX->use_commas=="on")?1:0;
					$thisXXX->hide_stats=($thisXXX->hide_stats=="on")?1:0;
					mysql_query("update CC_counter set hits='$thisXXX->hits',counter_type='$thisXXX->counter_type',use_cookie='$thisXXX->use_cookie',use_comma='$thisXXX->use_commas',ban_ip='$thisXXX->ip' where id='$thisXXX->uid'");
					mysql_query("update CC_users set email='$thisXXX->email',url='$thisXXX->url',show_site='$thisXXX->add_site',email_me='$thisXXX->admin_can_email',hide_stats='$thisXXX->hide_stats' where id='$thisXXX->uid'");
					echo '<font size=4>',$lang['modify_account_info'],':</font><br><br><b><font color=green>',$lang['success'],'</font></b><br><br>',$lang['success_msg'],'.';				
				}
				else
				{
					echo '<font face="Arial"><font size=4>',$lang['modify_account_info'],':</font><br><br><b><font color=red>',$lang['value_error'],'</font></b><br><br>',$lang['value_error_msg'],'</font>';
					
				}
			}
			else
			{
				$thisXXX->ip=substr(gethostbyaddr($GLOBALS['REMOTE_ADDR']),0,255);
				$thisXXX->c=mysql_query("select t1.id,t1.email,t1.url,t1.show_site,t1.email_me,t1.hide_stats,t1.pay_date,t2.hits,t2.counter_type,t2.use_cookie,t2.use_comma,t2.ban_ip from CC_users as t1, CC_counter as t2 where t1.id='$thisXXX->uid' and t2.id='$thisXXX->uid'");
				$thisXXX->d=mysql_fetch_object($thisXXX->c);
				if(is_object($thisXXX->d))
				{
					$thisXXX->add_site=($thisXXX->d->show_site)?" checked":"";
					$thisXXX->use_cookie=($thisXXX->d->use_cookie)?" checked":"";
					$thisXXX->admin_can_email=($thisXXX->d->email_me)?" checked":"";
					$thisXXX->use_commas=($thisXXX->d->use_comma)?" checked":"";
					$thisXXX->hide_stats=($thisXXX->d->hide_stats)?" checked":"";
					
					($thisXXX->use_pay=="yes")?$thisXXX->status = $thisXXX->userStatus($thisXXX->d->id):$thisXXX->status="paid";
				
					echo '<font size=4>',$lang['modify_account_info'],': </font>';
					
					if ($thisXXX->use_pay == "yes"){
						echo '<br>',$lang['you_are_currently_a'],' <b>',$lang[$thisXXX->status],'</b> ',$lang['user'],'.';
						if ($thisXXX->status == "free")
							echo ' <a href="mailto:',$thisXXX->your_email,'">',$lang['upgrade_now'],'</a><br><br>';
						elseif ($thisXXX->status == "paid"&&!empty($thisXXX->d->paydate))
							echo ' (',$lang['payment_received'],' ',date("Y-m-d H:i",$thisXXX->d->pay_date),')';
					}
					
					echo'
					<font face="Geneva, Arial, Helvetica, san-serif" size=2><table width="100%" border="0" cellpadding="5" bordercolor="#000000"><form method=post name=fc1><input type=hidden name=modify value=yes><tr>
					<td><div align=right><font size=2><strong>',$lang['email'],':</strong></font></div></td><td width="331"><input type=text name=email value="',$thisXXX->d->email,'" maxlength=255></td></tr>
					<tr><td><div align=right><font size=2><strong>',$lang['url'],':</strong></font></div></td><td><input type=text name=url value="',$thisXXX->d->url,'" maxlength=255></td></tr>
					<tr><td><div align=right><font size=2><strong>',$lang['counter_value'],':</strong></font></div></td><td><input type=text name=counter_value value="',$thisXXX->d->hits,'" maxlength=255></td></tr><tr><td><div align=right><font size=2><strong>',$lang['ban_ip'],':</strong>
          			</font></div></td><td><input type=text name=ban_ip maxlength=255 value="'.$thisXXX->d->ban_ip.'"> <input class=submit type=button onclick="document.forms.fc1.ban_ip.value=\\'',$thisXXX->ip,'\\'" value="',$lang['my_address_is'],'"></td></tr>
					<tr><td valign=top><div align=right><font size=2><strong>',$lang['counter_style'],':</strong></font></div></td><td>';
          			
					print $thisXXX->counterImages($thisXXX->d->counter_type);

          			echo "</td></tr><br><tr><td colspan=2>";
          			
					print $thisXXX->counterOptions();
          			
          			echo "</td></tr><tr><td colspan=2><div align=center><input class=submit type=\\"submit\\" value=\\"",$lang['modify'],"\\"><br></div></td>
    				</tr></form></table></font><br><br>";
				}
				else
				{
					echo '<b><font color=red>',$lang['error'],'</font></b><br><br>',$lang['user_error_msg'],'.';
					
				}
			}
			mysql_query("update CC_counter set last_access=".time()." where id='$thisXXX->uid'");
		}
		mysql_close();
	}

	function top10counters()
	{
		require("lang/english/top10.inc.php");
		
		$thisXXX->i=1;
		$thisXXX->c=mysql_query("select t1.id,t1.url,t1.hide_stats,t2.totalhits from CC_users as t1, CC_counter as t2 where t1.show_site=1 and t1.id=t2.id order by t2.totalhits desc limit ".$thisXXX->top10_limit);
			
		while($thisXXX->d=mysql_fetch_object($thisXXX->c)){
			echo '<tr><td>'.$thisXXX->i.'</td><td><a href='.$thisXXX->d->url.' target=_blank>'.$thisXXX->d->url.'</a></td><td>'.$thisXXX->d->totalhits.'</td><td>';
			
			if($thisXXX->d->hide_stats=="0"){
				echo '<a href="stats.php?i='.$thisXXX->d->id.'">',$lang['view'],'</a>';
			}
			
			echo '</td>';
			
			$thisXXX->i++;
		}
	}

	function site_list()
	{
		require("mysql_connect.php");
		$thisXXX->c=mysql_query("select url from CC_users where show_site=1 order by id desc");
		while($thisXXX->d=mysql_fetch_object($thisXXX->c))
			echo '<li> <a href='.$thisXXX->d->url.' target=_blank>'.$thisXXX->d->url.'</a>';
		mysql_close();
	}
	
function stats_mail()
{	
	if ($thisXXX->rules['email_me']['free'] == "1"||$thisXXX->rules['email_me']['paid'] == "1")
	{
		require("mysql_connect.php");
		require("lang/english/stats_mail.inc.php");
		
		$fp = fopen("stats_mail_head.txt","r");
		$header_string = fread($fp,filesize("stats_mail_head.txt")) . "\
\
";
		fclose($fp);
		
		$fp = fopen("stats_mail_foot.txt","r");
		$footer_string = "\
" . fread($fp,filesize("stats_mail_foot.txt"));
		fclose($fp);
		
		$thisXXX->c=mysql_query("select id,url,email from CC_users WHERE email_me = 1");
		while ($thisXXX->d=mysql_fetch_object($thisXXX->c))
		{
			$id = $thisXXX->d->id;
			$thisXXX->keep_stats = 7;


			$day=date("d",time())+1;
			$month=date("m",time());
			$year=date("Y",time());	
			$thisXXX->start_day = mktime (0,0,0,$month,$day,$year);
			
			for($thisXXX->i=0;$thisXXX->i<$thisXXX->keep_stats;$thisXXX->i++)
			{
				$day=date("d",time())-$thisXXX->i;
				$month=date("m",time());
				$year=date("Y",time());
				$thisXXX->new = mktime (0,0,0,$month,$day,$year);

				$thisXXX->c2=mysql_query("select count(*) from _$id where time >= $thisXXX->new and time <= $thisXXX->start_day");
				$thisXXX->array1[]=date("D d",$thisXXX->new).','.mysql_result($thisXXX->c2,0);
				$thisXXX->start_day=$thisXXX->new;
			}

			$url = $thisXXX->d->url;
			$time = date("l d F Y, H:i:s T",time());

			eval("\\$output=\\"$header_string\\";");
		
			foreach($thisXXX->array1 as $thisXXX->value)
			{
				$thisXXX->value=explode(",",$thisXXX->value);
				$output .= $thisXXX->value['0']." - ".$thisXXX->value['1']."\
";
			}
			unset($thisXXX->array1);
			
			eval("\\$output.=\\"$footer_string\\";");

			mail($thisXXX->d->email,"$thisXXX->sitename ".$lang['stats_for']." $url",$header.$output.$footer,"From: ".$thisXXX->your_email." <".$thisXXX->sitename.">\\r\
");
		}
	}
}


//---------------------
//shortcut functions
//---------------------

function counterOptions()
{
	require("lang/english/modify.inc.php");
	
	$output = "<font size=\\"2\\">";
	$output .= "<input type=hidden name=use_cookie$thisXXX->use_cookie value=checked><input type=checkbox name=use_commas$thisXXX->use_commas> ".$lang['use_commas'];
	if ($thisXXX->rules['hide_stats'][$thisXXX->status] == "1")
		$output .= "<br><input type=checkbox name=hide_stats$thisXXX->hide_stats> ".$lang['hide_stats'];
	if ($thisXXX->rules['email_me'][$thisXXX->status] == "1")
		$output .= "<br><input type=checkbox name=admin_can_email$thisXXX->admin_can_email> ".$lang['email_me'];
	if ($thisXXX->rules['show_site'][$thisXXX->status] == "1")
		$output .= "<br><input type=checkbox name=add_site$thisXXX->add_site> ".$lang['show_site'];
	$output .= "</font>";
	
	return $output;
}


function counterImages($currentValue)
{
	require("mysql_connect.php");
	require("lang/english/modify.inc.php");
	
	$output = "<table>";
	
	if (!isset($thisXXX->status)){
		if ($thisXXX->use_pay == "yes"){
			print $thisXXX->status = $thisXXX->userStatus($thisXXX->uid);
		} else {
			print $thisXXX->status = "paid";
		}
	}
	
	if ($thisXXX->rules['stealth'][$thisXXX->status] == "1"){
		$sql = "select id,filename,xpos,ypos,is_stealth from CC_image order by id";
	} else {
		$sql = "select id,filename,xpos,ypos,is_stealth from CC_image WHERE is_stealth = 0 order by id";
	}

	if($thisXXX->c=mysql_query($sql))
	{
		$i = 0;
		while($thisXXX->d=mysql_fetch_object($thisXXX->c))
		{
			if($i%2==0)
				$output.= "<tr>";
			$output.= "<td><input type=radio name=counter_type value=" . $thisXXX->d->id;
			
			if($thisXXX->d->id==$currentValue)
				$output.=" checked";

			$output.= "> </td><td nowrap><img src=images/" . $thisXXX->d->filename . ".png alt='counter no " . $thisXXX->d->id . "'>";
			if($thisXXX->d->is_stealth == 1)
				$output.= " <font size=\\"1\\">(".$lang['stealth_mode'].")</font>";
			$output.= "</td>";
			if($i%2!=0)
				$output.= "</tr>";

			$i++;
		}
	} else {
		$output .= "<tr><td><font face=arial size=2><b><font color=red>".$lang['error']."</font></b><br><br>".$lang['counter_error_msg']."</td></tr>";
	}
	
	$output.= "</table>";
	
	return $output;
}


function userStatus($username){
	include("mysql_connect.php");
	require("lang/english/modify.inc.php");	

	if (is_numeric($username)){
		$c=mysql_query("SELECT is_paid FROM CC_users WHERE id = $username LIMIT 1") or print(mysql_error());
	} else {
		$c=mysql_query("SELECT is_paid FROM CC_users WHERE username = '$username' LIMIT 1") or print(mysql_error());
	}
	
	$d=mysql_fetch_object($c) or die(mysql_error());
	
	if($d->is_paid == "1"){
		return $lang['paid'];
	} else {
		return $lang['free'];
	}
}

}

?>

Uhm, $this, not $thisXXX

$this = PHP page not loading, showing a blank or white screen
$thisXXX = errors but work

this script wont work with PHP5 (but works with PHP4)
:frowning:

What subversion of php 5 are you using? 5.1.x or 5.2.x of 5.3.x

I’m running

PHP Version 5.1.6
mysql-5.0.77
Apache/2.2.3 (Red Hat)

Well its a good thing it doesn’t work. That is some horrible code right their. I’m surprised it even worked before.

Also you should have updated to 5.3+ anything below is unsupported and will never get any security updates.

Off Topic:

I should think PHP 5 hates you too.

update from 5.1 to 5.3.2 but nothing has been changed after update.

Fatal error: Using $this when not in object context in /var/www/vhosts/counterservis.com/httpdocs/config.inc.php on line 22

UPGRADE > PHP Version 5.3.2
MySql 5.0.77
Linux 2.6.18-8.el5
UPGRADE > Parallels Plesk Panel v10.2.0_build1011110331.10 os_RedHat el5

If I had to guess, one of the class’s function is being called statically. Anyway, I’m not trying to be rude, but if you think changing $this to $thisXXX is a fix, you are in way over your head and will likely need to pay someone to get this to work in any short time frame. It could take you months to learn what you need to know to fix that code.

$thisXXX was just a try, orginal code ist without XXX but am still getting error Fatal error: Using $this when not in object context

http://www.counterservis.com/x/signup.php

Do you actually understand the concepts of object oriented programming? I suspect not or you wouldn’t have tried changing $this (which has a special meaning) to a different name that doesn’t have that special meaning.

You need to be able to understand object oriented programming to fix that code and if you don’t know it you might consider hiring someone who does to fix it for you.

you Know you’re right I fix one thing and then something else goes wrong.
<snip/>

instead of var, use PUBLIC or PRIVATE – making them VAR does not put them in object scope. Apart from the XXX nonsense (don’t know where you came up with that) that you’re saying VAR on all of them is likely the culprit as they are then local scope and not object scope. (and therein can’t be accessed via $this->)

Also, you don’t need to say public/private/var on EVERY line, you can make them a comma delimited list… and $GLOBALS? REALLY? REALLY?REALLY?!? ooph… that’s just bad.

Though… wow – 1990’s markup to go with the 1990’s PHP version?

Errr…object properties defined with “var” are accessible via “$this->”, PHP 5 is backwards compatibly to PHP 4 in this case. For PHP 5 “var” is an alias for “public”. However, I think what really needs to be changed is the properties themselves not just their scope. A dozen different properties and most seem like they are just temp and would have been better suited isolated in a method.

Furthermore, it also appears the purpose of this class is not to be used as an object but a poor mans namespace. Thus I can see the OP trying to call all the methods via static thus breaking “$this->”

Your error is in your config.inc.php. Can you show us that? Make sure you remove any usernames / passwords from the file.

From the error message. It looks like you are trying to use $this outside of a class.

this php will make me crazy :slight_smile:
I tried everything, still doesn’t work…

config.php

<?php

/*** Basic Site Variables (required) ***/
$this->siteurl="***"; // location of countercode software (without trailing slash).
$this->sitename="***"; // the name of the counter site
$this->adminpassword="***"; // the admin password
$this->your_email="***"; // define the admin's email address.

$this->language="english"; //the language used for the user interface

/*** MYSQL Config (required) ***/
$host = "localhost"; // MYSQL host
$data = "***"; // Mysql database name
$user = "***"; // Mysql username
$pass = "***"; // Mysql password

/*** Payment Options ***/
$this->use_pay = "no"; //offer different features to paid and free users


bbla bla bla

core.class.php

<?php

class counter
{
		
	
	var $username;
	var $password;
	var $url;
	var $email;
	var $hits;
	var $counter_type;
	var $add_site;
	var $use_cookie;
	var $admin_can_email;
	var $use_commas;
	var $hide_stats;
	var $messages;
	var $i;
	var $p1;
	var $p2;
	var $p3;
	var $p4;
	var $p5;
	var $value; 
	var $c;
	var $newc;
	var $d;
	var $z;
	var $last_id;
	var $id; 
	var $siteurl;
	var $min_pass_length; 
	var $max_pass_length;
	var $chars;
	var $mail_msg;
	var $your_email;
	var $uid;
	var $colour;
	var $php_self;
	var $ccuser;
	var $ccpass;
	var $new;
	var $start_day;
	var $hours;
	var $minutes;
	var $seconds;
	var $array1;
	var $array2;
	var $ip;
	var $ex1;
	var $ex2;
	var $ex3;
	var $status;
	var $rules;
	var $language;
	
	function counter()
	{
		$this->username=addslashes($GLOBALS['username']);
		$this->password=addslashes($GLOBALS['password']);
		$this->url=addslashes(htmlspecialchars($GLOBALS['url']));
		$this->email=addslashes($GLOBALS['email']);
		$this->hits=$GLOBALS['counter_value'];
		$this->counter_type=substr(addslashes($GLOBALS['counter_type']),0,50);
		$this->add_site=$GLOBALS['add_site'];
		$this->show_site=$this->add_site;
		$this->use_cookie=$GLOBALS['use_cookie'];
		$this->admin_can_email=$GLOBALS['admin_can_email'];
		$this->use_commas=$GLOBALS['use_commas'];
		$this->hide_stats=$GLOBALS['hide_stats'];
		$this->uid=$GLOBALS['i'];
		$this->expand1=$GLOBALS['ex1'];
		$this->expand2=$GLOBALS['ex2'];
		$this->expand3=$GLOBALS['ex3'];
		$this->z=$GLOBALS['l'];
		$this->php_self=$GLOBALS['PHP_SELF'];
		
		include("config.inc.php");	
	}

	function newuser()
	{
bla bla bla

Thank You All I made it :slight_smile:

I’m not far from being an OOP newbie myself, after many years of thinking procedurally it doesn’t come easy, but you can’t use $this outside of the class.

Inside a class it kinda means $this(class)->property

Outside of the class the syntax is more like

$my_class_object = new classObject;
$my_class_object->property = ‘whatever’;

Exactly.

Fatal error: Using $this when not in object context in /var/www/vhosts/counterservis.com/httpdocs/config.inc.php on line 22

Remember to read the errors for a hint at what’s wrong. In this case it spells it out specifically. This isn’t always the case but as long as you read it you can get an idea of what went wrong.