Page 1 of 1

Embedded text editor??

Posted: Sun Nov 21, 2004 4:36 pm
by MeesterCat
For a student project I am creating an online php tutorial.

The idea being that there will be an example snippet of php demonstrating what is to be done (perhaps a very basic array) and then asking the user to have a go at coding it themselves.

Is there a way of allowing the user to write and 'compile' the code within the page and not have to use a separate text editor?

Or is this wishful thinking?!

Any thoughts would be appreciated (I am new to php!)...

Posted: Sun Nov 21, 2004 4:52 pm
by evilmonkey
[php_man]exec()[/php_man]
Watch out, it's VERY dangerous!

For example, what if instead creating and outputting a basic array, the user were to use the unlink() function? Or some other malicious code? What you are saying can be done, but I'd be very careful if I were you.

Posted: Sun Nov 21, 2004 5:11 pm
by Slippy
I agree with evil monkey; it is very dangerous to do this; you may be able to get away with it if you look for dangerous functions before compiling and return an error if anything is found. Although I can think of creative ways to hose your web server just using an echo function... like echo'ing out the database username and password.

Wishful thinking... or very trusting.

Posted: Mon Nov 22, 2004 4:39 am
by MeesterCat
Cheers guys!

A couple of things i totally hadnt thought of...

Looks like a hasty re-design is in order!