russia5 Posted September 6, 2006 Share Posted September 6, 2006 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 26Does 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[code]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 [/code] Link to comment https://forums.phpfreaks.com/topic/19959-parse-error-on/ Share on other sites More sharing options...
MarioRossi Posted September 6, 2006 Share Posted September 6, 2006 Your curly braces don't match up in the code. you are missing a } somewhere. Link to comment https://forums.phpfreaks.com/topic/19959-parse-error-on/#findComment-87445 Share on other sites More sharing options...
wildteen88 Posted September 7, 2006 Share Posted September 7, 2006 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 PHP4The following keywords is not compatible for PHP4public, protected, privateThe following functions is not available for PHP4:__construct, __destructWhejn defining a variable in OOP for PHP4 you use var instead of public, protected, or private, ge:[code=php:0]var $myvar[/code]The same for functions, to define a function in OOP for PHP4 you use:[code=php:0]function myfunc(balh)[/code]Note the lake of any public, protected, or private keywords before the function keyword. Link to comment https://forums.phpfreaks.com/topic/19959-parse-error-on/#findComment-87642 Share on other sites More sharing options...
russia5 Posted September 7, 2006 Author Share Posted September 7, 2006 Thankyou very Much! I am using PHP4. Greg Link to comment https://forums.phpfreaks.com/topic/19959-parse-error-on/#findComment-87663 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.