Far Cry Posted January 20, 2011 Share Posted January 20, 2011 Hi there, I have this connect script I have made. I was wondering if it's secure or not, if not... What would be a good way to do so... <?php class connect{ public $host = "localhost"; public $dbuser = ""; public $dbpass = ""; public $db = ""; } $connect = new connect(); mysql_connect($connect->host,$connect->dbuser,$connect->dbpass) or die("Could not connect!"); mysql_select_db($connect->db); ?> Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted January 20, 2011 Share Posted January 20, 2011 not sure why you'd use a class, but it's as secure as it can be considering a connection to localhost. Quote Link to comment Share on other sites More sharing options...
Far Cry Posted January 20, 2011 Author Share Posted January 20, 2011 not sure why you'd use a class, but it's as secure as it can be considering a connection to localhost. Well, I want to make sure it's as secure as can be before I upload it to my live server Quote Link to comment Share on other sites More sharing options...
parino_esquilado Posted January 20, 2011 Share Posted January 20, 2011 Close any script that uses mysql with mysql_close($link); Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted January 20, 2011 Share Posted January 20, 2011 not sure why you'd use a class, but it's as secure as it can be considering a connection to localhost. Well, I want to make sure it's as secure as can be before I upload it to my live server Using a class in the way you have doesn't enhance security, as far as I know. Close any script that uses mysql with mysql_close($link); This is not necessary, as PHP automatically closes the connection at the end of script execution. See: http://php.net/manual/en/function.mysql-close.php 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.