Jump to content

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/78924-solved-new-mysqli-security/
Share on other sites

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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