iStriide Posted September 14, 2011 Share Posted September 14, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/247093-database-file-echoing-problem/ Share on other sites More sharing options...
Pandemikk Posted September 14, 2011 Share Posted September 14, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/247093-database-file-echoing-problem/#findComment-1269047 Share on other sites More sharing options...
web_craftsman Posted September 14, 2011 Share Posted September 14, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/247093-database-file-echoing-problem/#findComment-1269065 Share on other sites More sharing options...
voip03 Posted September 14, 2011 Share Posted September 14, 2011 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 Please read this article http://www.vnoel.com/PHP/Adding-Parameters-To-A-URL-in-PHP.html Quote Link to comment https://forums.phpfreaks.com/topic/247093-database-file-echoing-problem/#findComment-1269069 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.