PS error

Forumas skirtas spręsti problemas iškilusias su CS 1.6 serveriais.
Post Reply
Tomax
Gana aktyvus vartotojas
Posts: 381
Joined: 2012 Nov 01 14:32
Skype: Privatus
Location: Narnija
Contact:

PS error

Post by Tomax »

Viskas buvo normaliai ir visiškai iš niekur pradėjo rodyti tokį errorą:

Code: Select all

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /var/www/stats/includes/class_simplexml.php(242) : eval()'d code on line 6   
class_simplexml.php

Code: Select all

<?php/*    Class from phpclasses.org:    http://www.phpclasses.org/browse/package/4484.html     Slightly modified by Jason Morriss <stormtrooper @at@ psychostats.com>*/ /** * The Main XML Parser Class * */class simplexml {    var $result = array();    var $ignore_level = 0;    var $skip_empty_values = false;    var $php_errormsg;    var $evalCode="";     /**     * Adds Items to Array     *     * @param int $level     * @param array $tags     * @param $value     * @param string $type     */    function array_insert($level, $tags, $value, $type)    {        $temp = '';        for ($c = $this->ignore_level + 1; $c < $level + 1; $c++) {            if (isset($tags[$c]) && (is_numeric(trim($tags[$c])) || trim($tags[$c]))) {                if (is_numeric($tags[$c])) {                    $temp .= '[' . $tags[$c] . ']';                } else {                    $temp .= '["' . $tags[$c] . '"]';                }            }        }        $this->evalCode .= '$this->result' . $temp . "='" . addslashes($value) . "';//(" . $type . ")\n";        #echo $code. "\n";    }     /**     * Define the repeated tags in XML file so we can set an index     *     * @param array $array     * @return array     */    function xml_tags($array)    {   $repeats_temp = array();        $repeats_count = array();        $repeats = array();            if (is_array($array)) {            $n = count($array) - 1;            for ($i = 0; $i < $n; $i++) {                $idn = $array[$i]['tag'].$array[$i]['level'];                if(in_array($idn,$repeats_temp)){                    $repeats_count[array_search($idn,$repeats_temp)]+=1;                }else{                    array_push($repeats_temp,$idn);                    $repeats_count[array_search($idn,$repeats_temp)]=1;                }            }        }        $n = count($repeats_count);        for($i=0;$i<$n;$i++){            if($repeats_count[$i]>1){                array_push($repeats,$repeats_temp[$i]);            }        }        unset($repeats_temp);        unset($repeats_count);        return array_unique($repeats);    }      /**     * Converts Array Variable to Object Variable     *     * @param array $arg_array     * @return $tmp     */    function array2object ($arg_array)    {        if (is_array($arg_array)) {            $keys = array_keys($arg_array);            if(!is_numeric($keys[0])) $tmp = new SimpleXMLObject;            foreach ($keys as $key) {                if (is_numeric($key)) $has_number = true;                if (is_string($key)) $has_string = true;            }            if (isset($has_number) and !isset($has_string)) {                foreach ($arg_array as $key => $value) {                    $tmp[] = $this->array2object($value);                }            } elseif (isset($has_string)) {                foreach ($arg_array as $key => $value) {                    if (is_string($key))                    $tmp->$key = $this->array2object($value);                }            }        } elseif (is_object($arg_array)) {            foreach ($arg_array as $key => $value) {                if (is_array($value) or is_object($value))                $tmp->$key = $this->array2object($value);                else                $tmp->$key = $value;            }        } else {            $tmp = $arg_array;        }        return $tmp; //return the object    }     /**     * Reindexes the whole array with ascending numbers     *     * @param array $array     * @return array     */    function array_reindex($array)    {        if (is_array($array)) {            if(count($array) == 1 && $array[0] != ''){                return $this->array_reindex($array[0]);            }else{                foreach($array as $keys => $items) {                    if (is_array($items)) {                        if (is_numeric($keys)) {                            $array[$keys] = $this->array_reindex($items);                        } else {                            $array[$keys] = $this->array_reindex(array_merge(array(), $items));                        }                    }                }            }        }         return $array;    }      /**     * Parse the XML generation to array object     *     * @param array $array     * @return array     */    function xml_reorganize($array)    {        $count = count($array);        $repeat = $this->xml_tags($array);        $repeatedone = false;        $tags = array();        $k = 0;        for ($i = 0; $i < $count; $i++) {            switch ($array[$i]['type']) {                case 'open':                    array_push($tags, $array[$i]['tag']);                    if ($i > 0 && ($array[$i]['tag'] == $array[$i-1]['tag']) && ($array[$i-1]['type'] == 'close'))                    $k++;                    if (isset($array[$i]['value']) && ($array[$i]['value'] || !$this->skip_empty_values)) {                        array_push($tags, '@content');                        $this->array_insert(count($tags), $tags, $array[$i]['value'], "open");                        array_pop($tags);                    }                     if (in_array($array[$i]['tag'] . $array[$i]['level'], $repeat)) {                        if (($repeatedone == $array[$i]['tag'] . $array[$i]['level']) && ($repeatedone)) {                            array_push($tags, strval($k++));                        } else {                            $repeatedone = $array[$i]['tag'] . $array[$i]['level'];                            array_push($tags, strval($k));                        }                    }                     if (isset($array[$i]['attributes']) && $array[$i]['attributes'] && $array[$i]['level'] != $this->ignore_level) {                        array_push($tags, '@attributes');                        foreach ($array[$i]['attributes'] as $attrkey => $attr) {                            array_push($tags, $attrkey);                            $this->array_insert(count($tags), $tags, $attr, "open");                            array_pop($tags);                        }                        array_pop($tags);                    }                    break;                 case 'close':                    array_pop($tags);                    if (in_array($array[$i]['tag'] . $array[$i]['level'], $repeat)) {                        if ($repeatedone == $array[$i]['tag'] . $array[$i]['level']) {                            array_pop($tags);                        } else {                            $repeatedone = $array[$i + 1]['tag'] . $array[$i + 1]['level'];                            array_pop($tags);                        }                    }                    break;                 case 'complete':                    array_push($tags, $array[$i]['tag']);                    if (in_array($array[$i]['tag'] . $array[$i]['level'], $repeat)) {                        if ($repeatedone == $array[$i]['tag'] . $array[$i]['level'] && $repeatedone) {                            array_push($tags, strval($k));                        } else {                            $repeatedone = $array[$i]['tag'] . $array[$i]['level'];                            array_push($tags, strval($k));                        }                    }                     if (isset($array[$i]['value']) && ($array[$i]['value'] || !$this->skip_empty_values)) {                        if (isset($array[$i]['attributes']) && $array[$i]['attributes']) {                            array_push($tags, '@content');                            $this->array_insert(count($tags), $tags, $array[$i]['value'], "complete");                            array_pop($tags);                        } else {                            $this->array_insert(count($tags), $tags, $array[$i]['value'], "complete");                        }                    }                     if (isset($array[$i]['attributes']) && $array[$i]['attributes']) {                        array_push($tags, '@attributes');                        foreach ($array[$i]['attributes'] as $attrkey => $attr) {                            array_push($tags, $attrkey);                            $this->array_insert(count($tags), $tags, $attr, "complete");                            array_pop($tags);                        }                        array_pop($tags);                    }                     if (in_array($array[$i]['tag'] . $array[$i]['level'], $repeat)) {                        array_pop($tags);                        $k++;                    }                     array_pop($tags);                    break;            }        }        eval($this->evalCode);        $last = $this->array_reindex($this->result);        return $last;    }     /**     * Get the XML contents and parse like SimpleXML     *     * @param string $file     * @param string $resulttype     * @param string $encoding     * @return array/object     */    function xml_load_file($file, $resulttype = 'object', $encoding = 'UTF-8')    {        $php_errormsg="";        $this->result="";        $this->evalCode="";        $values="";        $data = file_get_contents($file);        if (!$data) return 'Cannot open xml document: ' . (isset($php_errormsg) ? $php_errormsg : $file);        return $this->xml_load_string($data, $resulttype, $encoding);    }     function xml_load_string($data, $resulttype = 'object', $encoding = 'UTF-8') {        $parser = xml_parser_create($encoding);        xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);        xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);        $ok = xml_parse_into_struct($parser, $data, $values);        if (!$ok) {            $errmsg = sprintf("XML parse error %d '%s' at line %d, column %d (byte index %d)",            xml_get_error_code($parser),            xml_error_string(xml_get_error_code($parser)),            xml_get_current_line_number($parser),            xml_get_current_column_number($parser),            xml_get_current_byte_index($parser));        }         xml_parser_free($parser);        if (!$ok) return $errmsg;        if ($resulttype == 'array') return $this->xml_reorganize($values);        // default $resulttype is 'object'        return $this->array2object($this->xml_reorganize($values));    }}  /** * If the result will be an object, this container class is used. * */ class SimpleXMLObject {    function attributes(){        $container = get_object_vars($this);        return (object) $container["@attributes"];    }    function content(){        $container = get_object_vars($this);        return (object) $container["@content"];    }} ?> 
Image

User avatar
aaarnas
Vyr. diskusijų administratorius
Posts: 3891
Joined: 2010 Aug 31 13:21
Skype: fiarno
Contact:

Re: PS error

Post by aaarnas »

Jei iš niekur nieko, tai gal php versiją pakeitei.

Pagal error, kažkas negerai su kabutėmis kode, kuris perduodamas į eval.
PRIEŠ šitą:
eval($this->evalCode);

pridėk:
echo $this->evalCode;

Ir pažiūrėk kokią eilutę atspausdina. Jei su echo neišeina pamatyti, tai į failą įrašyk:

Code: Select all

 $file = fopen("check.txt", "wt");fputs($file, $this->evalCode);fclose($file); 
Palikau CS pasaulį ;/ . Nebepasiekiamas.

Tomax
Gana aktyvus vartotojas
Posts: 381
Joined: 2012 Nov 01 14:32
Skype: Privatus
Location: Narnija
Contact:

Re: PS error

Post by Tomax »

Su echo $this->evalCode;

Code: Select all

$this->result["theme"][0]["css"][0]["@attributes"]["href"]='../default/css/overall.css';//(complete) $this->result["theme"][0]["css"][1]["@attributes"]["href"]='../default/css/content.css';//(complete) $this->result["theme"][0]["css"][2]["@attributes"]["href"]='css/blue.css';//(complete) $this->result["theme"][0]["css"][2]["@attributes"]["loadlast"]='1';//(complete) $this->result["theme"][0]["script"][3]=' var themeurl = ''/stats/themes/default''; var iconsurl = ''/stats/img/icons''; ';//(complete) $this->result["theme"][0]["script"][4]["@attributes"]["src"]='../default/js/jquery.js';//(complete) $this->result["theme"][0]["script"][5]["@attributes"]["src"]='../default/js/overall.js';//(complete) $this->result["flash"][6]["@attributes"]["bgcolor"]='#C5CEDC';//(open) $this->result["flash"][6]["@attributes"]["bg_inner1"]='#eeeeff';//(open) $this->result["flash"][6]["@attributes"]["bg_inner2"]='#ced4e1';//(open) $this->result["flash"][6]["@attributes"]["inner_angle"]='90';//(open) $this->result["flash"][6]["pie"][7]["@attributes"]["bgcolor"]='';//(open) $this->result["flash"][6]["pie"][7]["title"][7]["@content"]='Country Breakdown';//(complete) $this->result["flash"][6]["pie"][7]["title"][7]["@attributes"]["style"]='font-size: 16px';//(complete) $this->result["flash"][6]["pie"][7]["labels"]["@attributes"]["style"]='display: none';//(complete) $this->result["flash"][6]["pie"][7]["tooltip"][8]='#x_label##val#%';//(complete) $this->result["flash"][6]["pie"][7]["slices"][9]["@attributes"]["border"]='#505050';//(open) $this->result["flash"][6]["pie"][7]["slices"][9]["slice"][9]["@attributes"]["color"]='#0033FF';//(complete) $this->result["flash"][6]["pie"][7]["slices"][9]["slice"][10]["@attributes"]["color"]='#00B3FF';//(complete) $this->result["flash"][6]["pie"][7]["slices"][9]["slice"][11]["@attributes"]["color"]='#00FFCC';//(complete) $this->result["flash"][6]["pie"][7]["slices"][9]["slice"][12]["@attributes"]["color"]='#00FF4D';//(complete) $this->result["flash"][6]["pie"][7]["slices"][9]["slice"][13]["@attributes"]["color"]='#CC00FF';//(complete) $this->result["flash"][6]["pie"][7]["slices"][9]["slice"][14]["@attributes"]["color"]='#7A95FF';//(complete) $this->result["flash"][6]["pie"][7]["slices"][9]["slice"][15]["@attributes"]["color"]='#FFD83D';//(complete) $this->result["flash"][6]["pie"][7]["slices"][9]["slice"][16]["@attributes"]["color"]='#B3FF00';//(complete) $this->result["flash"][6]["pie"][7]["slices"][9]["slice"][17]["@attributes"]["color"]='#FF0033';//(complete) $this->result["flash"][6]["pie"][7]["slices"][9]["slice"][18]["@attributes"]["color"]='#FFCC00';//(complete) $this->result["flash"][6]["last24"][19]["@attributes"]["bgcolor"]='';//(open) $this->result["flash"][6]["last24"][19]["@attributes"]["bg_inner1"]='';//(open) $this->result["flash"][6]["last24"][19]["@attributes"]["bg_inner2"]='';//(open) $this->result["flash"][6]["last24"][19]["title"][19]["@content"]='Last 24 Hours';//(complete) $this->result["flash"][6]["last24"][19]["title"][19]["@attributes"]["style"]='font-size: 16px';//(complete) $this->result["flash"][6]["last24"][19]["tooltip"][20]='#key##val# (#x_label#)';//(complete) $this->result["flash"][6]["last24"][19]["lines"][21]["@attributes"]["key_size"]='9';//(open) $this->result["flash"][6]["last24"][19]["lines"][21]["line"][21]["@attributes"]["width"]='3';//(complete) $this->result["flash"][6]["last24"][19]["lines"][21]["line"][21]["@attributes"]["key"]='Average Kills';//(complete) $this->result["flash"][6]["last24"][19]["lines"][21]["line"][21]["@attributes"]["color"]='#9999ee';//(complete) $this->result["flash"][6]["last24"][19]["lines"][21]["line"][22]["@attributes"]["width"]='2';//(complete) $this->result["flash"][6]["last24"][19]["lines"][21]["line"][22]["@attributes"]["dot_size"]='5';//(complete) $this->result["flash"][6]["last24"][19]["lines"][21]["line"][22]["@attributes"]["key"]='Kills';//(complete) $this->result["flash"][6]["last24"][19]["lines"][21]["line"][22]["@attributes"]["color"]='#5555ff';//(complete) $this->result["flash"][6]["last24"][19]["lines"][21]["line"][23]["@attributes"]["width"]='1';//(complete) $this->result["flash"][6]["last24"][19]["lines"][21]["line"][23]["@attributes"]["key"]='Connections';//(complete) $this->result["flash"][6]["last24"][19]["lines"][21]["line"][23]["@attributes"]["color"]='#000000';//(complete) $this->result["flash"][6]["conn"][24]["@attributes"]["bgcolor"]='';//(open) $this->result["flash"][6]["conn"][24]["@attributes"]["bg_inner1"]='';//(open) $this->result["flash"][6]["conn"][24]["@attributes"]["bg_inner2"]='';//(open) $this->result["flash"][6]["conn"][24]["title"][24]["@content"]='Daily Connections';//(complete) $this->result["flash"][6]["conn"][24]["title"][24]["@attributes"]["style"]='font-size: 16px';//(complete) $this->result["flash"][6]["conn"][24]["tooltip"][25]='#x_label##key#: #val# (Avg: %d)';//(complete) $this->result["flash"][6]["conn"][24]["line"]["@attributes"]["width"]='3';//(complete) $this->result["flash"][6]["conn"][24]["line"]["@attributes"]["key"]='Average Connections!';//(complete) $this->result["flash"][6]["conn"][24]["line"]["@attributes"]["size"]='9';//(complete) $this->result["flash"][6]["conn"][24]["line"]["@attributes"]["color"]='#9999ee';//(complete) $this->result["flash"][6]["conn"][24]["bar3d"]["@attributes"]["alpha"]='75';//(complete) $this->result["flash"][6]["conn"][24]["bar3d"]["@attributes"]["key"]='Connections';//(complete) $this->result["flash"][6]["conn"][24]["bar3d"]["@attributes"]["size"]='9';//(complete) $this->result["flash"][6]["conn"][24]["bar3d"]["@attributes"]["color1"]='#5555ff';//(complete) $this->result["flash"][6]["conn"][24]["bar3d"]["@attributes"]["color2"]='#3333DD';//(complete) $this->result["flash"][6]["plrskill"][26]["@attributes"]["bgcolor"]='';//(open) $this->result["flash"][6]["plrskill"][26]["@attributes"]["bg_inner1"]='';//(open) $this->result["flash"][6]["plrskill"][26]["@attributes"]["bg_inner2"]='';//(open) $this->result["flash"][6]["plrskill"][26]["title"][27]["@attributes"]["style"]='font-size: 12px';//(complete) $this->result["flash"][6]["plrskill"][26]["lines"][28]["@attributes"]["key_size"]='9';//(open) $this->result["flash"][6]["plrskill"][26]["lines"][28]["line"][28]["@attributes"]["width"]='2';//(complete) $this->result["flash"][6]["plrskill"][26]["lines"][28]["line"][28]["@attributes"]["key"]='Average';//(complete) $this->result["flash"][6]["plrskill"][26]["lines"][28]["line"][28]["@attributes"]["color"]='#9999ee';//(complete) $this->result["flash"][6]["plrskill"][26]["lines"][28]["line"][29]["@attributes"]["width"]='3';//(complete) $this->result["flash"][6]["plrskill"][26]["lines"][28]["line"][29]["@attributes"]["key"]='Skill';//(complete) $this->result["flash"][6]["plrskill"][26]["lines"][28]["line"][29]["@attributes"]["color"]='#5555ff';//(complete) $this->result["image"][30]["common"][31]["margin"][31]["@attributes"]["top"]='0';//(complete) $this->result["image"][30]["common"][31]["margin"][31]["@attributes"]["right"]='0';//(complete) $this->result["image"][30]["common"][31]["margin"][31]["@attributes"]["bottom"]='0';//(complete) $this->result["image"][30]["common"][31]["margin"][31]["@attributes"]["left"]='0';//(complete) $this->result["image"][30]["common"][31]["footer"][32]["@attributes"]["show"]='1';//(open) $this->result["image"][30]["common"][31]["footer"][32]["@attributes"]["color"]='#999999';//(open) $this->result["image"][30]["common"][31]["footer"][32]["@attributes"]["font"]='FF_FONT0';//(open) $this->result["image"][30]["common"][31]["footer"][32]["left"]='PsychoStats v%s';//(complete) $this->result["image"][30]["common"][31]["footer"][32]["right"]='M d @ H:i:s';//(complete) $this->result["image"][30]["session"][32]["@attributes"]["interval"]='2';//(open) $this->result["image"][30]["session"][32]["@attributes"]["font"]='FF_FONT0';//(open) $this->result["image"][30]["session"][32]["@attributes"]["showfooter"]='1';//(open) $this->result["image"][30]["session"][32]["margin"][33]["@attributes"]["top"]='5';//(complete) $this->result["image"][30]["session"][32]["margin"][33]["@attributes"]["right"]='5';//(complete) $this->result["image"][30]["session"][32]["margin"][33]["@attributes"]["bottom"]='';//(complete) $this->result["image"][30]["session"][32]["margin"][33]["@attributes"]["left"]='6';//(complete) $this->result["image"][30]["session"][32]["frame"]["@attributes"]["margin"]='#EEEEEE';//(complete) $this->result["image"][30]["session"][32]["frame"]["@attributes"]["color"]='gray';//(complete) $this->result["image"][30]["session"][32]["frame"]["@attributes"]["width"]='0';//(complete) $this->result["image"][30]["session"][32]["header"]["@attributes"]["color"]='black';//(complete) $this->result["image"][30]["session"][32]["header"]["@attributes"]["bgcolor"]='#C5D5FA';//(complete) $this->result["image"][30]["session"][32]["header"]["@attributes"]["hourstyle"]='HOURSTYLE_H24';//(complete) $this->result["image"][30]["session"][32]["hgrid"]["@attributes"]["show"]='1';//(complete) $this->result["image"][30]["session"][32]["hgrid"]["@attributes"]["color1"]='#[email protected]';//(complete) $this->result["image"][30]["session"][32]["hgrid"]["@attributes"]["color2"]='#[email protected]';//(complete) $this->result["image"][30]["session"][32]["hgrid2"]["@attributes"]["show"]='1';//(complete) $this->result["image"][30]["session"][32]["hgrid2"]["@attributes"]["color1"]='[email protected]';//(complete) $this->result["image"][30]["session"][32]["hgrid2"]["@attributes"]["color2"]='#[email protected]';//(complete) $this->result["image"][30]["session"][32]["bar"]["@attributes"]["showempty"]='0';//(complete) $this->result["image"][30]["session"][32]["bar"]["@attributes"]["vmargin"]='0.4';//(complete) $this->result["image"][30]["session"][32]["bar"]["@attributes"]["patternfill"]='#C5D5FA';//(complete) $this->result["image"][30]["session"][32]["bar"]["@attributes"]["fill"]='darkgreen';//(complete) $this->result["image"][30]["session"][32]["bar"]["@attributes"]["pattern"]='BAND_SOLID';//(complete) $this->result["image"][30]["session"][32]["bar"]["@attributes"]["shadow"]='';//(complete) Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /var/www/stats/includes/class_simplexml.php(243) : eval()'d code on line 6
Su $file = fopen("check.txt", "wt");
fputs($file, $this->evalCode);
fclose($file);

Code: Select all

Warning: fopen(check.txt): failed to open stream: Permission denied in /var/www/stats/includes/class_simplexml.php on line 242 Warning: fputs() expects parameter 1 to be resource, boolean given in /var/www/stats/includes/class_simplexml.php on line 243 Warning: fclose() expects parameter 1 to be resource, boolean given in /var/www/stats/includes/class_simplexml.php on line 244 Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /var/www/stats/includes/class_simplexml.php(245) : eval()'d code on line 6 
Image

User avatar
aaarnas
Vyr. diskusijų administratorius
Posts: 3891
Joined: 2010 Aug 31 13:21
Skype: fiarno
Contact:

Re: PS error

Post by aaarnas »

Šitoj eilutėj kažkas su kabutėm ne taip man atrodo:

Code: Select all

$this->result["theme"][0]["script"][3]=' var themeurl = ''/stats/themes/default''; var iconsurl = ''/stats/img/icons''; ';//(complete)
Čia naudojamos '' (dvigubos) kabutės, kad escapint. O reikia matyt su \' būtinai.
Palikau CS pasaulį ;/ . Nebepasiekiamas.

Tomax
Gana aktyvus vartotojas
Posts: 381
Joined: 2012 Nov 01 14:32
Skype: Privatus
Location: Narnija
Contact:

Re: PS error

Post by Tomax »

O kaip sutvarkyta turėtų atrodyt?
Image

User avatar
aaarnas
Vyr. diskusijų administratorius
Posts: 3891
Joined: 2010 Aug 31 13:21
Skype: fiarno
Contact:

Re: PS error

Post by aaarnas »

Negaliu garantuot kol kas, bet addslashes funkcija grybauja. Reikėtų kažką kitką.
Palikau CS pasaulį ;/ . Nebepasiekiamas.

Tomax
Gana aktyvus vartotojas
Posts: 381
Joined: 2012 Nov 01 14:32
Skype: Privatus
Location: Narnija
Contact:

Re: PS error

Post by Tomax »

Gal yra, kas galėtų padėti su šia klaida?
Image

Post Reply

Who is online

Users browsing this forum: Amazon [Bot] and 3 guests