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 Link to comment https://forums.phpfreaks.com/topic/28527-how-to-make-mysql_connect-more-secure/ 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"); ?> Link to comment https://forums.phpfreaks.com/topic/28527-how-to-make-mysql_connect-more-secure/#findComment-130538 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. Link to comment https://forums.phpfreaks.com/topic/28527-how-to-make-mysql_connect-more-secure/#findComment-130546 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 Link to comment https://forums.phpfreaks.com/topic/28527-how-to-make-mysql_connect-more-secure/#findComment-131428 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.