robert.juric Posted November 26, 2007 Share Posted November 26, 2007 I've just started learning php/mysql and I was wondering how you normally handle security when you connect to the database. I've been using this statement at the beginning of my code: $mysqli = new mysqli("localhost", "user", "pass", "dbname"); I've only had this running on my laptop for development, but if it were a real environment how would you secure that? I know it wasn't designed to have the password open in the source code so I must be missing something? Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted November 26, 2007 Share Posted November 26, 2007 PHP code that is inside of <?php ?> tags in a file that is parsed by the php language engine is not visible when you browse to the file. You only get any output that is echoed/printed... by php. Unless you have an echo "the database password is pass"; in your php code, no one can see what it is through a browser. Quote Link to comment Share on other sites More sharing options...
robert.juric Posted November 26, 2007 Author Share Posted November 26, 2007 Oh ok. Thanks for the info! Quote Link to comment 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.