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? Link to comment https://forums.phpfreaks.com/topic/92030-connecting-to-database/ 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 Link to comment https://forums.phpfreaks.com/topic/92030-connecting-to-database/#findComment-471329 Share on other sites More sharing options...
millercj Posted February 20, 2008 Author Share Posted February 20, 2008 anyone else? Link to comment https://forums.phpfreaks.com/topic/92030-connecting-to-database/#findComment-471676 Share on other sites More sharing options...
revraz Posted February 20, 2008 Share Posted February 20, 2008 Nothing else to add really. Link to comment https://forums.phpfreaks.com/topic/92030-connecting-to-database/#findComment-471681 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"); ?> Link to comment https://forums.phpfreaks.com/topic/92030-connecting-to-database/#findComment-472525 Share on other sites More sharing options...
bpops Posted February 21, 2008 Share Posted February 21, 2008 It's the way I do it. Link to comment https://forums.phpfreaks.com/topic/92030-connecting-to-database/#findComment-472544 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.