Hi
I think what you are asking is how can you secure your database connection for the content management system?
Most web spaces have your root directory as /public_html
In that, you might have a directory called contentmanager, where all the php files to retrieve and display the content are kept. Inside that you might have an admin directory, where the content can be updated. THAT directory needs password protecting using .htaccess
You hosting package should allow you to do this. If you have CPanel control panel, there is a function to do this.
If you cannot set the .htaccess on that directory (it would have to be a very cheap (free) host that didn't let you do this) you would have to resort to a login via your script. That can be hacked, and there is little you can do to stop this. You can make it harder, but any budding hacker would get in, very quickly.
Trevor