«« Next » « Previous
«« Next » « Previous

Link Details

All it takes is one vote. Make it yours. Login and vote now.
Link 84010 thumbnail

By roshanbh
via roshanbh.com.np
Submitted: May 30 2008 / 08:17

If you don't know how can we execute the PHP code which is entered through textbox or textarea then here is tips for you...
  • 1
  • 3
  • 133
  • 29

Comments

Add your comment
User 225135 avatar

Stefan Koopmanschap replied ago:

0 votes Vote down Vote up Reply

I wouldn't know a single situation where this would be useful. And calling eval() a useful function is stupid. There is a reason it sounds like evil ...

User 265881 avatar

Topnotch replied ago:

0 votes Vote down Vote up Reply

This will lead to numerous security vulnerabilities if widely used.

User 275423 avatar

lifewithryan replied ago:

0 votes Vote down Vote up Reply

I agree, extremely dangerous, but I "could" see a possible need for something similar. Say perhaps you had a content mgmt system that used something like TinyMCE and your up and coming web master wanted to do some dynamic stuff for a given entry, however, you don't want him mucking with the actual code anywhere. However, I certainly wouldn't use eval, not that my solution would be anymore elegant, but in this case, I'd implement a bbcode type parser where you'd wrap the PHP code in some tags that you would then parse into actual php when the page is rendered. Still VERY VERY dangerous and not recommended, especially with eval...

User 262632 avatar

roshanbh replied ago:

0 votes Vote down Vote up Reply

well I've seen few of the places where you've to executed the PHP code inside the textbox, I certainly agree that you can't use it widely not in the user end thats for sure, it's very dangerous.

But sometime you may need to use it at admininstrator sections. I can tell you some examples where you need to do this

1) Few wordpress plugin require to place PHP code, how can you place it in the sider bar of wordpress ?? you must execute the PHP code in that case, we are allowing just administrator to do this, not to each and every user to execute the PHP code

2) In drupal's admin you can see that there is option to place the PHP code inside the textarea for execution...

these are the few examples where the eval is useful and comes handy, and I don't think these reason are stupid...

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (1)



Voters Against This Link (3)