I want some input on what you guys think is the most secure way to connect to a MySQL database using PHP. Currently the way I'm doing it is a utility PHP file that I include in the top of all my other PHP files. The utility PHP file is this:
<?php
if(!defined('IN_PHP')){
die("hackerssss");
}
$mysql_host = "localhost";
$mysql_user = "root";
$mysql_pass = "root";
$mysql_db = cokertrading;
?>
Any suggestions?
$mysql_db = "cokertrading"
(unless it's a constant). Thatdefined('IN_PHP')
check is not really useful here, as you're only defining variables, and not connecting immediately. – Eyespotcokertrading
should have quotes. – Cassady