Jump to content


Photo

Parse error on


  • Please log in to reply
3 replies to this topic

#1 russia5

russia5
  • Members
  • PipPipPip
  • Advanced Member
  • 94 posts

Posted 06 September 2006 - 10:42 PM

Hello group!  I have loaded a script off Zend Codex.  It is under security and it snuffs out injection of HTML and Java.

Problem is, I am getting this error.

Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/russia5/public_html/submission-russian.php on line 26

Does anyone have an idea of why I am getting this?  Here is the code.  (I have bolded where line 26 is below)

Thanks to all that try to help!  Greg

class InputFilter { 
    // class config vars 
[b]line 26 is the one right below here[/b]

    private $tagsArray;       // required 

[b]line 26 is right above here[/b]
    private $attrArray;        // default = empty array 
    private $tagsMethod;   // default = 0 
    private $attrMethod;        // default = 0 
         
    /**  
      * Constructor for inputFilter class. Only first parameter is required. 
      * @access constructor 
      * @param Array $tagsArray - list of user-defined tags 
      * @param Array $attrArray - list of user-defined attributes 
      * @param int $tagsMethod - 0= allow just user-defined, 1= allow all but user-defined 
      * @param int $attrMethod - 0= allow just user-defined, 1= allow all but user-defined 
      */ 
    public function __construct($tagsArray, $attrArray = array(), $tagsMethod = 0, $attrMethod = 0) {         
        $this->tagsArray = $tagsArray; 
        $this->attrArray = $attrArray; 
        $this->tagsMethod = $tagsMethod; 
        $this->attrMethod = $attrMethod; 
    } 
     
    /**  
      * Method to be called by another php script.  
      * @access public 
      * @param Mixed $source - input string/array-of-string to be 'cleaned' 
      * @return String $source - 'cleaned' version of input parameter 
      */ 
    public function process($source) { 
        if (is_array($source))     {                                                                                    // clean all elements in this array 
            for ($i = 0; $i < count($source); $i++) 
                if (is_string($source[$i])) $source[$i] = $this->remove($source[$i]); 
            return $source; 
        } else if (is_string($source)) return $this->remove($source);                            // clean this string 
        else return $source;     class InputFilter { 
    // class config vars 
    private $tagsArray;       // required 
    private $attrArray;        // default = empty array 
    private $tagsMethod;   // default = 0 
    private $attrMethod;        // default = 0 
         
    


#2 MarioRossi

MarioRossi
  • Members
  • PipPip
  • Member
  • 25 posts

Posted 06 September 2006 - 10:48 PM

Your curly braces don't match up in the code. you are missing a } somewhere.

#3 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 07 September 2006 - 11:14 AM

What version of PHP are you using? If its PHP4 then that code is not compatible with your version of PHP and this the reason why you are getting the above errors. It will only work on PHP5 as it is using PHP5 OO keyword/functions. These keyowrds/functions is not available for PHP4

The following keywords is not compatible for PHP4
public, protected, private

The following functions is not available for PHP4:
__construct, __destruct

Whejn defining a variable in OOP for PHP4 you use var instead of public, protected, or private, ge:
var $myvar


The same for functions, to define a function in OOP for PHP4 you use:
function myfunc(balh)

Note the lake of any public, protected, or private keywords before the function keyword.


#4 russia5

russia5
  • Members
  • PipPipPip
  • Advanced Member
  • 94 posts

Posted 07 September 2006 - 11:44 AM

Thankyou very Much!  I am using PHP4.  Greg




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users