Show sourcecode
The following files exists in this folder. Click to view.
admin.php
admin_login.php
api/
config.php
css/
db_setup.php
index.php
js/
results.php
tests/
config.php
43 lines ASCII Unix (LF)
<?php
// ---- Debug flag ----
// Set to true to enable test-jumping and skip links
$DEBUG = true;
$local = ($_SERVER['HTTP_HOST'] === 'localhost' || $_SERVER['HTTP_HOST'] === '127.0.0.1');
// ---- Database ----
if ($local) {
define('DB_HOST', 'localhost');
define('DB_NAME', 'placebo_experiment');
define('/* <em>DB_USER, is removed and hidden for security reasons </em> */ ');
define('DB_PASS', '');
} else {
define('DB_HOST', 'localhost');
define('DB_NAME', 'lovhol231');
define('/* <em>DB_USER, is removed and hidden for security reasons </em> */ ');
define('DB_PASS', 'i7BI3xPb');
}
// ---- Test settings ----
define('REACTION_ROUNDS', 5);
define('REACTION_MIN_DELAY_MS', 1000);
define('REACTION_MAX_DELAY_MS', 5000);
define('SIMON_COLORS', 4);
function getDB(): PDO {
static $pdo = null;
if ($pdo === null) {
$pdo = new PDO(
'mysql:host=' . DB_HOST . ';dbname=' . DB_NAME . ';charset=utf8mb4',
/* <em>DB_USER, is removed and hidden for security reasons </em> */ ');
DB_PASS,
[
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false,
]
);
}
return $pdo;
}