chore: version inicial del codigo fuente del LMS Estafeta
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
// =====================================================================
|
||||
// config.sample.php — Plantilla de configuración
|
||||
// Copia este archivo como `config.php` y ajusta los valores por entorno.
|
||||
// `config.php` está en .gitignore y NUNCA debe subirse al repositorio.
|
||||
// =====================================================================
|
||||
|
||||
// Endurecimiento de sesión (debe ejecutarse antes de session_start)
|
||||
if (session_status() === PHP_SESSION_NONE) {
|
||||
ini_set('session.use_strict_mode', '1');
|
||||
ini_set('session.use_only_cookies', '1');
|
||||
ini_set('session.cookie_httponly', '1');
|
||||
ini_set('session.cookie_samesite', 'Lax');
|
||||
if (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') {
|
||||
ini_set('session.cookie_secure', '1');
|
||||
}
|
||||
}
|
||||
|
||||
setlocale(LC_TIME, 'es_MX.UTF-8');
|
||||
unset($CFG);
|
||||
global $CFG;
|
||||
define("ROOTPATH", __DIR__ . DIRECTORY_SEPARATOR);
|
||||
$CFG = new stdClass();
|
||||
$CFG->sessionname = 'estafetalms360';
|
||||
|
||||
// URL base del sitio (debe terminar en "/")
|
||||
$CFG->wwwroot = getenv('APP_URL') ?: 'http://localhost/git/LMS-Estafeta/';
|
||||
$CFG->wwwuserhome = $CFG->wwwroot . 'dashboard.php';
|
||||
$CFG->realpath = dirname(__DIR__);
|
||||
$CFG->masteryscore = 80;
|
||||
|
||||
// Base de datos (preferentemente por variables de entorno)
|
||||
$dbname = getenv('DB_NAME') ?: 'estafeta_lms3';
|
||||
$dbhost = getenv('DB_HOST') ?: 'localhost';
|
||||
$dbuser = getenv('DB_USER') ?: 'root';
|
||||
$dbpass = getenv('DB_PASS') ?: '';
|
||||
|
||||
function dbConnect() {
|
||||
global $dbname, $dbhost, $dbuser, $dbpass, $link;
|
||||
$link = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
|
||||
if (!$link) {
|
||||
http_response_code(500);
|
||||
die('Error de conexión a la base de datos.');
|
||||
}
|
||||
mysqli_set_charset($link, 'utf8mb4');
|
||||
}
|
||||
|
||||
function getEncrypt($text) {
|
||||
return $text;
|
||||
}
|
||||
Reference in New Issue
Block a user