Kod: Markera allt
<?php
if($_SERVER['REQUEST_URI'] == "/connectdb.inc.php") {
header("Location: index.php");
die(); // Added so no additional codes is executed after redirect
}
$dbhost = ''XXXXXXXXXX;
$dbuser = 'xxXxXXXXX;
$dbpass = 'XXXXx';
$dbname = 'xXXX-XXXXx';
// Connects to your Database
$mysqli = ($GLOBALS["___mysqli_ston"] = mysqli_connect($dbhost, $dbuser, $dbpass)) or die(mysql_error());
if (!$mysqli)
{
die('Could not connect: ' . ((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)));
}
//Open database
((bool)mysqli_query( $mysqli, "xxxxxxxx")) or die(mysql_error());
mysqli_query($GLOBALS["___mysqli_ston"], "SET NAMES utf8");
mysqli_query($GLOBALS["___mysqli_ston"], "SET CHARACTER SET utf8");
echo "connectdb.inc.php: DB Connection OK!";
?>Kod: Markera allt
$mysqli = new mysqli("xxxxxxxx", "xxxxxxxx", "xxxxxx", "xxxxxxxxx");
mysqli_query($GLOBALS["___mysqli_ston"], "SET NAMES utf8");
mysqli_query($GLOBALS["___mysqli_ston"], "SET CHARACTER SET utf8");



