PDO CONNECTION
<?php
// 웃
$db_host = "127.0.0.1";
$db_name = "logger";
$db_user = "root";
$db_pass = "root";
try {
$db = new PDO("mysql:host=". $db_host . ";dbname=" . $db_name . ";charset=utf8;", $db_user, $db_pass,
array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, FALSE);
$db->exec("set names utf8");
} catch (PDOException $e) {
echo "<p>Your IP has been Logged & an Email has been dispatched to an Administrator on our team. </p>
<p>Connection not found. : (" .
$e->getMessage() . ")" .
"</p>";
die();
}
global $db;
// http://stackoverflow.com/questions/5741187/sql-injection-that-gets-around-mysql-real-escape-string/12118602#12118602
// ALWAYS USE : setAttribute(PDO::ATTR_EMULATE_PREPARES, FALSE)
?>