<?php
function doConn($params){
	$s=$params[0]; $d=$params[1]; $u=$params[2]; $p=$params[3];
	$port = 3306;
	
	$L = mysqli_connect($s, $u, $p, $d, $port);
	// echo mysqli_errno($L);
	// echo mysqli_error($L);
	return $L;
}
function doPDOConn($params){
	$s=$params[0]; $d=$params[1]; $u=$params[2]; $p=$params[3];
	$port = 3306;
	
	try {
		$pdo = new PDO('mysql:host='.$s.';dbname='.$d.';port='.$port, $u, $p);
		$pdo->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );

		return $pdo;
	} catch (PDOException $e) {
		print "Error!: " . $e->getMessage() . "<br/>";
		return NULL;
		die();
	}	
}

$LINK = doConn($LOC_PARAMS);	
$PDO = doPDOConn($LOC_PARAMS);
	

// echo APP_ROOT.'conn/conn_err.html';
// EXIT;

if(!$LINK){
	header('Location: '.APP_ROOT.'conn/conn_err.html?ref='.rawurlencode($_SERVER['PHP_SELF']));
	exit;
}


?>