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
https://forums.phpfreaks.com/topic/247093-database-file-echoing-problem/
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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.