Logical1 Posted April 12, 2009 Share Posted April 12, 2009 I have checked many manuals and instructions and have not been able to find any way to prevent having to include in the code the username and password for connecting to the database. It seem like a very insecure way of doing things. Does any one have a suggestion for not having to write the username and passwrods for the databse in the code? tx Link to comment https://forums.phpfreaks.com/topic/153767-how-to-protect-the-log-in-information/ Share on other sites More sharing options...
PFMaBiSmAd Posted April 12, 2009 Share Posted April 12, 2009 The raw php code in .php files cannot be seen unless you have direct (FTP, control panel) access to the raw file. Link to comment https://forums.phpfreaks.com/topic/153767-how-to-protect-the-log-in-information/#findComment-808149 Share on other sites More sharing options...
Logical1 Posted April 12, 2009 Author Share Posted April 12, 2009 I know that but still it is pretty silly to write password and usernames openly like that. ANy suggestions? Link to comment https://forums.phpfreaks.com/topic/153767-how-to-protect-the-log-in-information/#findComment-808219 Share on other sites More sharing options...
TGWSE_GY Posted April 13, 2009 Share Posted April 13, 2009 PFMaBiSmAd is right, unless you are showing your directory structure in your site when you change from page to page, they should not be able to get ahold of your raw .php files. It has been my experience if you make your sites dynamic you will not have to worry about your username and password for logging in to MYSQL. I know it seems insecure but it really isn't if your site is dynamic IMHO. Link to comment https://forums.phpfreaks.com/topic/153767-how-to-protect-the-log-in-information/#findComment-808437 Share on other sites More sharing options...
Logical1 Posted April 14, 2009 Author Share Posted April 14, 2009 The URL shows the location of files and one can figure out the directory structure. How can you not show that? Link to comment https://forums.phpfreaks.com/topic/153767-how-to-protect-the-log-in-information/#findComment-809131 Share on other sites More sharing options...
Maq Posted April 14, 2009 Share Posted April 14, 2009 How can you not show that? Perhaps [man]mod_rewrite()[/man]? http://www.phpfreaks.com/forums/index.php/board,50.0.html Link to comment https://forums.phpfreaks.com/topic/153767-how-to-protect-the-log-in-information/#findComment-809135 Share on other sites More sharing options...
PFMaBiSmAd Posted April 14, 2009 Share Posted April 14, 2009 Include files are typically placed in a folder that is outside of the document root folder so that they cannot be browsed to, but even if the file is somewhere within a public folder and the directory structure is deliberately shown (Apache: Options Indexes) you cannot access the php content of a .php file using the http protocol (try it if you don't believe.) Turn on Options Indexes to show a directory and browse to or do a "save link as" on a .php file and see what you get in the browser or in the saved file. The key is that the file is a .php file and any php code in it will be parsed and executed when it is requested. If you are foolish enough to use an extension other than .php, then yes the contents of that file can be seen. You are trying to make something that is a non-issue into a problem that does not exist. Link to comment https://forums.phpfreaks.com/topic/153767-how-to-protect-the-log-in-information/#findComment-809190 Share on other sites More sharing options...
TGWSE_GY Posted April 22, 2009 Share Posted April 22, 2009 You are trying to make something that is a non-issue into a problem that does not exist. I agree with PFMaBiSmAd, Logical1. However if you are still concerned with the directory structures showing you could do a system like myself (I use it to make coding easier) I have Content Conditions file where index.php is in my site root, and then in the Conditions file I say If Section =='MyPage') { require('MyPage.php') } elseif Then since my Content area is the only place that is not static I just put a php statement in index.php in the content area that calls content_conditions.php and it looks like this include('content_conditions.php'); Then when I make a link in any of my pages that are going to be in content conditions that looks like this index.php?section=MyPage and no my pages are dynamicly linked without ever showing my directory structure. All they ever see is http://mysite.com/index.php?section=MyPage. Hope this helps Link to comment https://forums.phpfreaks.com/topic/153767-how-to-protect-the-log-in-information/#findComment-816691 Share on other sites More sharing options...
TGWSE_GY Posted April 22, 2009 Share Posted April 22, 2009 If you would like to see a fully working example of this, send me a message and I will give you temporary access to a system that functions perfectly like this. Link to comment https://forums.phpfreaks.com/topic/153767-how-to-protect-the-log-in-information/#findComment-816695 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.