Jump to content

Database file echoing problem.


iStriide

Recommended Posts

I have a file in a mysql database and when I echo it shows all of the php code from the file in the database on the page when it is echoed. How can I fix this problem. I notice a lot of websites coded from php have things like ?go=register or ?page=login something like that. Could you guys tell me how to do things like that. Im pretty sure when people do things like ?go=register the register is the code of a file in a mysql database.

Link to comment
Share on other sites

Those are URL parameters you can retrieve with GET.

 

file.php \\ No url parameters

file.php?do=whatever \\ One url parameter

file.php?do=whatever&action=whatever&etc=etcetera \\ Multiple url parameters

 

Then you can retrieve these via $_GET super variable.

 

For instance: echo $_GET['do'] \\ Prints out 'whatever'

 

 

Never trust user submitted data, including url parameters. Always sanitize this data.

Link to comment
Share on other sites

I have a file in a mysql database and when I echo it shows all of the php code from the file in the database on the page when it is echoed. How can I fix this problem.

php code is not usually locate in database. It locates in files and uses by include_once(or similar) command.

If your code is a string from database you must use eval command to run it.

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.