Hi,

I am using oracle to connect to my databases through php.

$db_conn = ociplogon("scott", "tiger", "DEMO");

The above line is coded in my php. I would like to avoid putting username and password in the php file.

How can I encrypt this information?

Thanks.

    I am using oracle to connect to my databases through php.

    $db_conn = ociplogon("scott", "tiger", "DEMO");

    The above line is coded in my php. I would like to avoid putting username and password in the php file.

    How can I encrypt this information?

    No need to encrypt it, Padma. Add a directory to your include_path that's outside your document root. In this directory, place a file -- I call mine dbsession.inc -- containing your sensitive database-related information:

    define("DB_LOGIN", "scott");
    define("DB_PASSWORD", "tiger");
    

    All you need to do is [MAN]include/MAN or [MAN]require/MAN this file, and open your database connection with:

    $dbh = ocilogon(DB_LOGIN, DB_PASSWORD);
    
      Write a Reply...