Question

I know you can connect to a database with mysqli_connect("example.com","user","pass");, but wouldn't anyone who has access to the file have access to the database since he can see the user and password? How to change that?

Was it helpful?

Solution 2

You always will need the password and username to connect.

You can of course deny access to the file that contains you data by a .htaccess file. However it is always smart to keep those settings in a settings file that is placed outside of your browse able content (and preferably your git or svn repo as well).

Like that people need access to your server (or a big error in the code) to be able to access that file.

OTHER TIPS

PHP is a server-side language. You can't see php code in your browser. Unless your php "echo" or "output" something out. You can see "html","css","javascript" codes by clicking veiw source on your browser. But you'll never see "PHP" or "ASP" code because they are server side. The server process the command , not the browser. So you can be sure that no one will see your password unless they gain access to your website's files.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top