Search Results

Search found 1 results on 1 pages for 'luxquarta'.

Page 1/1 | 1 

  • How to inject php code from database into php script ?

    - by luxquarta
    I want to store php code inside my database and then use it into my script. class A { public function getName() { return "lux"; } } // instantiates a new A $a = new A(); Inside my database there is data like "hello {$a->getName()}, how are you ?" In my php code I load the data into a variable $string $string = load_data_from_db(); echo $string; // echoes hello {$a->getName()}, how are you ? So now $string contains "hello {$a-getName()}, how are you ?" {$a-getName()} still being un-interpretated Question: I can't find how to write the rest of the code so that {$a-getName()} gets interpretated "into hello lux, how are you". Can someone help ? $new_string = ?????? echo $new_string; //echoes hello lux, how are you ? Is there a solution with eval() ? (please no debate about evil eval ;)) Or any other solution ?

    Read the article

1