CodeIgniter Forums

Full Version: Encrypt password in database.php
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

I assume that everybody know the database section under the config.
$db['default']['hostname'] = "localhost";
$db['default']['username'] = "";
$db['default']['password'] = "";
$db['default']['database'] = "";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "";
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";
I would like to make a portable website as some kind of demo. Is there a way to encrypt my password in this section?

El Forum

Short answer: no.

And in my opinion pretty pointless, as the database is accessable via lots of other ways as well. Or is your demo connecting to a secured database over the internet?

If you want to encrypt it, you will need an encryption key, otherwise you will not be able to decrypt it. And where are you going to store that? Kind of chicken-and-egg problem. At some point, someone has to enter a password to make it secure. Or you have to come up with a way to do encryption with a certificate.

El Forum

Correct. Because it is taking from a larger project. Will change the password for this demo. Will be easier I think.