Get and launch PHP code from $_GET
Posted: Thu Nov 05, 2009 8:50 am
Hello!
I have next task to resolve %)
I need to creat some php code wich allows take php code from $_GET and launch it. Php code may contains php commands with php variables (like $p) and MySQL queries (like 'SELECT * FROM tablename').
For example:
I type url like this:
http://mysite.com/index.php?php=$q=1; $q=2; echo $q1.$q2; connect(); $query='SELECT * FROM tablename';$q=query($query); close(); $q=convert($q); forech( $q as $line ) { echo $line; }
So php code in $_GET['php'] = "$q=1; $q=2; echo $q1.$q2; connect(); $query='SELECT * FROM tablename';$q=query($query); close(); $q=convert($q); forech( $q as $line ) { echo $line; }"
How can i launch (run/execute) it in my index.php script.
I used eval() function, but it outputed some warnings and not worked correctly.
How can i do it
Thanks.
I have next task to resolve %)
I need to creat some php code wich allows take php code from $_GET and launch it. Php code may contains php commands with php variables (like $p) and MySQL queries (like 'SELECT * FROM tablename').
For example:
I type url like this:
http://mysite.com/index.php?php=$q=1; $q=2; echo $q1.$q2; connect(); $query='SELECT * FROM tablename';$q=query($query); close(); $q=convert($q); forech( $q as $line ) { echo $line; }
So php code in $_GET['php'] = "$q=1; $q=2; echo $q1.$q2; connect(); $query='SELECT * FROM tablename';$q=query($query); close(); $q=convert($q); forech( $q as $line ) { echo $line; }"
How can i launch (run/execute) it in my index.php script.
I used eval() function, but it outputed some warnings and not worked correctly.
How can i do it
Thanks.