Re: password in md5 to connect to mysql instead of clear password

From: Date: Fri, 25 Feb 2005 08:09:07 +0000
Subject: Re: password in md5 to connect to mysql instead of clear password
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-38666@lists.php.net to get a copy of this message
Not answering your question but I'd put the connect info into a separate include file. This should then be placed in a directory that can be accessed by the Web Server but not by any other user (except root). Then when you need to establish a connection you just need to include the file. graeme. Gael Lams wrote:
Hi all I use the classic following rows to connect to a mysql database. I always put $passsword in clear in the php connection file and I wonder whether there is a way to have it in md5 so that someone reading the file could not use it to connect to the db. I googled a bit but find only threads explaining how to have password saved in md5 inside a mysql table which is not I would like to do Regards, Gaël
       function SQLConnect()
       {
               $server_name = 'localhost';
               $db_name = 'cmsdb';
               $user_name = 'user';
               $password = 'clearpassword';
               if (!$dbconnect =
mysql_connect($server_name, $user_name, $password))
               {
                       echo "Connection failed to the
host 'localhost'.";
                       exit;
               }
               if (!mysql_select_db($db_name))
               {
                       echo "Cannot connect to
database '.$db_name.'";
                       exit;
               }
       }
__________________________________ Do you Yahoo!? Yahoo! Mail - Easier than ever with enhanced search. Learn more. http://info.mail.yahoo.com/mail_250
-- Experience is a good teacher, but she sends in terrific bills. Minna Antrim

« previous php.db (#38666) next »