airwinx Posted November 26, 2006 Share Posted November 26, 2006 Hi,As we know when you want to connect to ur mysql db, we normally use this $query=mysql_connect(...);,I wonder how should I make this more secure so that someone can't view my dbname, user & password?I have a php file that store all my infor of my mysql information, so when ever someone in my company browse through the file from the server they will see my db information(my password & userid). can someone has better idea of how should I store my db infor more secure........ :o Quote Link to comment Share on other sites More sharing options...
airwinx Posted November 26, 2006 Author Share Posted November 26, 2006 Hi,here it how it look in my php file that store my db infor:<?$db_user="abc";$db_pass="xyz_sample",$db = mysql_connect("localhost","$db_user","$db_pass") or die("cannot connect to db");$dbname = mysql_select_db("testing") or die("cannot connect to the db"); ?> Quote Link to comment Share on other sites More sharing options...
taith Posted November 26, 2006 Share Posted November 26, 2006 [code]<?function dbconnect($host, $username, $password, $database){ global $link; $link = mysql_connect("$host","$username","$password"); mysql_select_db("$database");}?>[/code]that way you can call the function, it will connect, and your user/password dont leave the function. Quote Link to comment Share on other sites More sharing options...
airwinx Posted November 28, 2006 Author Share Posted November 28, 2006 thank bro, I will try ur code. ;Dseem this is wat I am looking for Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.