2015-11-03 01:25:08 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
define("ROOT", $_SERVER["DOCUMENT_ROOT"]);
|
2015-11-26 00:08:24 +01:00
|
|
|
define("SITE_NAME", "Lexiconga");
|
|
|
|
define("SITE_LOCATION", ROOT . "/.Lexiconga"); // For absolute file paths: SITE_LOCATION . "/whatever.php"
|
2015-11-03 01:25:08 +01:00
|
|
|
define("DATABASE_TYPE", "mysql"); //sqlite, mysql, pgsql
|
|
|
|
|
2015-11-26 00:08:24 +01:00
|
|
|
define("DATABASE_SERVERNAME", "host");
|
|
|
|
define("DATABASE_USERNAME", "username");
|
|
|
|
define("DATABASE_PASSWORD", "password");
|
|
|
|
define("DATABASE_NAME", "databasename");
|
|
|
|
|
|
|
|
$dbconnection = new PDO('mysql:host=' . DATABASE_SERVERNAME . ';dbname=' . DATABASE_NAME . ';charset=utf8', DATABASE_USERNAME, DATABASE_PASSWORD);
|
|
|
|
$dbconnection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
|
|
|
$dbconnection->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
|
|
|
|
$dbconnection->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
|
|
|
|
|
|
|
|
define("DATABASE_CONNECTION", $dbconnection);
|
|
|
|
|
|
|
|
/*function connection() {
|
2015-11-03 01:25:08 +01:00
|
|
|
// Fill this with relevant data.
|
|
|
|
$servername = "host";
|
|
|
|
$username = "username";
|
|
|
|
$password = "password";
|
|
|
|
$dbname = "database_name";
|
|
|
|
|
2015-11-26 00:08:24 +01:00
|
|
|
$conn = new PDO('mysql:host=' . DATABASE_SERVERNAME . ';dbname=' . DATABASE_NAME . ';charset=utf8', DATABASE_USERNAME, DATABASE_PASSWORD);
|
|
|
|
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
|
|
|
$conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
|
|
|
|
$conn->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
|
|
|
|
|
2015-11-03 01:25:08 +01:00
|
|
|
// Create connection
|
2015-11-26 00:08:24 +01:00
|
|
|
// $conn = mysqli_connect($servername, $username, $password, $dbname);
|
2015-11-03 01:25:08 +01:00
|
|
|
// Check connection
|
2015-11-26 00:08:24 +01:00
|
|
|
// if (!$conn) {
|
|
|
|
// die("Connection failed: " . mysqli_connect_error());
|
|
|
|
// }
|
2015-11-03 01:25:08 +01:00
|
|
|
|
|
|
|
return $conn;
|
2015-11-26 00:08:24 +01:00
|
|
|
}*/
|
2015-11-03 01:25:08 +01:00
|
|
|
?>
|