millercj Posted February 20, 2008 Share Posted February 20, 2008 I'm looking for some security tips... Currently I connect to my databases through a statement in a php file such as require ('connect.php'); and then the contents of connect.php being <?php $host = 'localhost'; $dbuser = 'xxxx'; $dbpass = 'xxxx'; $dbname = 'xxxx'; $connect = @mysql_connect ($host, $dbuser, $dbpass) or die ('Could not connect to MySQL!'); $select_db = @mysql_select_db ($dbname) or die ('Could not select database!'); ?> Is this the most secure way to connect to a database? Quote Link to comment Share on other sites More sharing options...
priti Posted February 20, 2008 Share Posted February 20, 2008 This is the most opted way to connect to Db.you can also use database connection classes availabel on PHP classes or PHP freaks tutorial also if you follow OOPs in your coding approach. let someone else experienced also speaks on this topic.For security issues the discussion is endless so i think someone else should also speak on this. Gr8 day Quote Link to comment Share on other sites More sharing options...
millercj Posted February 20, 2008 Author Share Posted February 20, 2008 anyone else? Quote Link to comment Share on other sites More sharing options...
revraz Posted February 20, 2008 Share Posted February 20, 2008 Nothing else to add really. Quote Link to comment Share on other sites More sharing options...
jerastraub Posted February 21, 2008 Share Posted February 21, 2008 This is the way that I have always seen to do a DB connect. I have also seen that most people actually put it in a folder like so: <? include("inc/config.php"); ?> Quote Link to comment Share on other sites More sharing options...
bpops Posted February 21, 2008 Share Posted February 21, 2008 It's the way I do it. 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.