Jump to content

how to execute php code from sql?


siwelis

Recommended Posts

You would need to do what ldb358 just posted.

 

However, since this violates one of the prime rules of programming, separation of code and data/content (i.e. your data should not contain code), you must be extremely careful where this code came from and what it is.

 

A lot of web sites get taken over because they allow hackers to get their raw code to be executed on a server because it got ran tough an eval() or include() statement. If you accidentally run some content that came from a visitor through the eval() as part of the php code you have stored in a database and that content was not properly validate and happened to contain raw php code itself, a hacker just took over your web site.

 

Also, any syntax error in this code (or any syntax error that a hacker can trigger through content in an effort to probe your server for ways to break in or to simply shut down your site) stored in the database will halt ALL php code execution on your page (the eval() invokes an instance of the php language engine, both making this a slower process than you expect and parse errors in the code stops all php code execution.)

 

Are you sure what you are doing cannot be accomplished by separating the php code out so that you only store data or content in the database and keep the php code as part of the logic on your page?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.