Is this connection string secure on shared hosting?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
amir
Forum Contributor
Posts: 287
Joined: Sat Oct 07, 2006 4:28 pm

Is this connection string secure on shared hosting?

Post by amir »

Hello,

We normally use connection string in this way

Code: Select all

<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
   die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>
I want to know that is it secure on Shared Hosting. If not please advise how can we make it secure?

TIA!
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

You mean, can people with access to your FTP see your username and password? Yes.

You could write your own encryption/decryption function and "hide" it from the other users if you really want to hide your password from them.
Post Reply