Hi Everybody,I am a newbie.I have problem with my website,who can fix error for me :

<?php

function HitCounter()
{
$counter_file = "../count.txt";
if (($fp = fopen($counter_file, "r"))) {
$counter_b = (int) fread($fp,20);
fclose($fp);
} else {
$counter_b = "Non posso aprire il file";
return $counter_b;
}
$counter_a = $counter_b + 1;
$fp = fopen($counter_file,"w");
fwrite($fp,$counter_a);
fclose($fp);
return $counter_b;
}

function gb2unicode($gb)
{
if(!trim($gb))
return $gb;
$filename="gb2312.txt";
$tmp=file($filename);
$codetable=array();
while(list($key,$value)=each($tmp))
$codetable[hexdec(substr($value,0,6))]=substr($value,9,4);
$utf="";
while($gb)
{
if (ord(substr($gb,0,1))>127)
{
$this=substr($gb,0,2); $gb=substr($gb,2,strlen($gb));
$utf.="&#x".$codetable[hexdec(bin2hex($this))-0x8080].";";
}
else
{
$gb=substr($gb,1,strlen($gb));
$utf.=substr($gb,0,1);
}
}
return $utf;
}

function unicode_to_utf8($str) {

    $utf8 = '';

    foreach( $str as $unicode ) {

        if ( $unicode < 128 ) {

            $utf8.= chr( $unicode );

        } elseif ( $unicode < 2048 ) {

            $utf8.= chr( 192 +  ( ( $unicode - ( $unicode % 64 ) ) / 64 ) );
            $utf8.= chr( 128 + ( $unicode % 64 ) );

        } else {

            $utf8.= chr( 224 + ( ( $unicode - ( $unicode % 4096 ) ) / 4096 ) );
            $utf8.= chr( 128 + ( ( ( $unicode % 4096 ) - ( $unicode % 64 ) ) / 64 ) );
            $utf8.= chr( 128 + ( $unicode % 64 ) );

        } // if

    } // foreach

    return $utf8;

} // unicode_to_utf8

function cutstring($mystring,$len){
// $mystring la xau can cat
$count=1;
$a="";
while ($count <=$len){
$pos = strpos ($mystring, " ");
$a=$a.substr($mystring,0,$pos+1);
$mystring=substr($mystring,($pos+1),strlen($mystring)-$pos);
$count++;
}
return $a;
}

function test($ngay)
{ $a='';
if ($ngay>2)
$a = $ngay.''.T1_ngay.'/ '.($ngay-1).' '.T1_night;
else if ($ngay==2)
$a= $ngay.''.T1_ngay.'/ '.($ngay-1).' '.T_night;
else
$a= '0'.T_ngay;

 return $a;   	
}

function Processdate($strdate)
{
$year = substr($strdate,0,4);
$month = substr($strdate,4,2);
$day = substr($strdate,6,2);
if ($strdate == '') return '';
else

return $day.'/'.$month.'/'.$year;

}
?>

Error line 34

    What the error message says. $this is a special variable that you can't just assign values to. Call it something else.

    Also, since you're a Newbie, see the Guidelines in the Newbies' Forum.

      14 days later
      hubm;10930797 wrote:

      Hi Everybody,I am a newbie.I have problem with my website,who can fix error for me :

      <?php

      function HitCounter()
      {
      $counter_file = "../count.txt";
      if (($fp = fopen($counter_file, "r"))) {
      $counter_b = (int) fread($fp,20);
      fclose($fp);
      } else {
      $counter_b = "Non posso aprire il file";
      return $counter_b;
      }
      $counter_a = $counter_b + 1;
      $fp = fopen($counter_file,"w");
      fwrite($fp,$counter_a);
      fclose($fp);
      return $counter_b;
      }

      function gb2unicode($gb)
      {
      if(!trim($gb))
      return $gb;
      $filename="gb2312.txt";
      $tmp=file($filename);
      $codetable=array();
      while(list($key,$value)=each($tmp))
      $codetable[hexdec(substr($value,0,6))]=substr($value,9,4);
      $utf="";
      while($gb)
      {
      if (ord(substr($gb,0,1))>127)
      {
      $this=substr($gb,0,2); $gb=substr($gb,2,strlen($gb));
      $utf.="&#x".$codetable[hexdec(bin2hex($this))-0x8080].";";
      }
      else
      {
      $gb=substr($gb,1,strlen($gb));
      $utf.=substr($gb,0,1);
      }
      }
      return $utf;
      }

      function unicode_to_utf8($str) {

          $utf8 = '';
      
          foreach( $str as $unicode ) {
      
              if ( $unicode < 128 ) {
      
                  $utf8.= chr( $unicode );
      
              } elseif ( $unicode < 2048 ) {
      
                  $utf8.= chr( 192 +  ( ( $unicode - ( $unicode % 64 ) ) / 64 ) );
                  $utf8.= chr( 128 + ( $unicode % 64 ) );
      
              } else {
      
                  $utf8.= chr( 224 + ( ( $unicode - ( $unicode % 4096 ) ) / 4096 ) );
                  $utf8.= chr( 128 + ( ( ( $unicode % 4096 ) - ( $unicode % 64 ) ) / 64 ) );
                  $utf8.= chr( 128 + ( $unicode % 64 ) );
      
              } // if
      
          } // foreach
      
          return $utf8;
      
      } // unicode_to_utf8

      function cutstring($mystring,$len){
      // $mystring la xau can cat
      $count=1;
      $a="";
      while ($count <=$len){
      $pos = strpos ($mystring, " ");
      $a=$a.substr($mystring,0,$pos+1);
      $mystring=substr($mystring,($pos+1),strlen($mystring)-$pos);
      $count++;
      }
      return $a;
      }

      function test($ngay)
      { $a='';
      if ($ngay>2)
      $a = $ngay.''.T1_ngay.'/ '.($ngay-1).' '.T1_night;
      else if ($ngay==2)
      $a= $ngay.''.T1_ngay.'/ '.($ngay-1).' '.T_night;
      else
      $a= '0'.T_ngay;

       return $a;   	
      }

      function Processdate($strdate)
      {
      $year = substr($strdate,0,4);
      $month = substr($strdate,4,2);
      $day = substr($strdate,6,2);
      if ($strdate == '') return '';
      else

      return $day.'/'.$month.'/'.$year;

      }
      ?>

      Error line 34

      Thanks for the post


      Watch Anime Online

        6 days later
        hubm;10930797 wrote:

        Hi Everybody,I am a newbie.I have problem with my website,who can fix error for me :

        <?php

        function HitCounter()
        {
        $counter_file = "../count.txt";
        if (($fp = fopen($counter_file, "r"))) {
        $counter_b = (int) fread($fp,20);
        fclose($fp);
        } else {
        $counter_b = "Non posso aprire il file";
        return $counter_b;
        }
        $counter_a = $counter_b + 1;
        $fp = fopen($counter_file,"w");
        fwrite($fp,$counter_a);
        fclose($fp);
        return $counter_b;
        }

        function gb2unicode($gb)
        {
        if(!trim($gb))
        return $gb;
        $filename="gb2312.txt";
        $tmp=file($filename);
        $codetable=array();
        while(list($key,$value)=each($tmp))
        $codetable[hexdec(substr($value,0,6))]=substr($value,9,4);
        $utf="";
        while($gb)
        {
        if (ord(substr($gb,0,1))>127)
        {
        $this=substr($gb,0,2); $gb=substr($gb,2,strlen($gb));
        $utf.="&#x".$codetable[hexdec(bin2hex($this))-0x8080].";";
        }
        else
        {
        $gb=substr($gb,1,strlen($gb));
        $utf.=substr($gb,0,1);
        }
        }
        return $utf;
        }

        function unicode_to_utf8($str) {

            $utf8 = '';
        
            foreach( $str as $unicode ) {
        
                if ( $unicode < 128 ) {
        
                    $utf8.= chr( $unicode );
        
                } elseif ( $unicode < 2048 ) {
        
                    $utf8.= chr( 192 +  ( ( $unicode - ( $unicode % 64 ) ) / 64 ) );
                    $utf8.= chr( 128 + ( $unicode % 64 ) );
        
                } else {
        
                    $utf8.= chr( 224 + ( ( $unicode - ( $unicode % 4096 ) ) / 4096 ) );
                    $utf8.= chr( 128 + ( ( ( $unicode % 4096 ) - ( $unicode % 64 ) ) / 64 ) );
                    $utf8.= chr( 128 + ( $unicode % 64 ) );
        
                } // if
        
            } // foreach
        
            return $utf8;
        
        } // unicode_to_utf8

        function cutstring($mystring,$len){
        // $mystring la xau can cat
        $count=1;
        $a="";
        while ($count <=$len){
        $pos = strpos ($mystring, " ");
        $a=$a.substr($mystring,0,$pos+1);
        $mystring=substr($mystring,($pos+1),strlen($mystring)-$pos);
        $count++;
        }
        return $a;
        }

        function test($ngay)
        { $a='';
        if ($ngay>2)
        $a = $ngay.''.T1_ngay.'/ '.($ngay-1).' '.T1_night;
        else if ($ngay==2)
        $a= $ngay.''.T1_ngay.'/ '.($ngay-1).' '.T_night;
        else
        $a= '0'.T_ngay;

         return $a;   	
        }

        function Processdate($strdate)
        {
        $year = substr($strdate,0,4);
        $month = substr($strdate,4,2);
        $day = substr($strdate,6,2);
        if ($strdate == '') return '';
        else

        return $day.'/'.$month.'/'.$year;

        }
        ?>

        Error line 34

        you are using $this as genera variable for assign value. that's why u are getting error message.
        you can not use this as simple variable it is a key word which is used for specific purpous.

        you are new in php you should read php manual in which there are all convention of variable declaring are defined.

          Write a Reply...