-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.php
More file actions
74 lines (60 loc) · 1.75 KB
/
config.php
File metadata and controls
74 lines (60 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
define("URL", "http://{$_SERVER['HTTP_HOST']}/");
define("ROOT", "{$_SERVER['DOCUMENT_ROOT']}/");
define("STYLE", "/styles/");
define("HEADER", ROOT . "home/header.php");
define("HEAD", ROOT . "home/head.php");
define("ASIDE", ROOT . "home/aside.php");
define("HOME", ROOT . "home/home.php");
define("FOOT", ROOT . "home/foot.php");
define("FOOTER", ROOT . "home/footer.php");
define("SIDEBAR", ROOT . "src/sidebar.php");
define("CSS", "/src/css/");
define("JS", "/src/js/");
define("SVG", "/src/svg/");
define("IMG", "/src/img/");
define("FPDF", ROOT . "/src/fpdf/");
define("REPORT", ROOT . "process/pdfReports/");
include 'dbconfig.php';
require_once __DIR__."/login/logFun.php";
function getAction(){
return isset($_GET['a']) ? $_GET['a'] : null;
}
function connectdb()
{
try {
$db = mysqli_connect(DBHOST, DBUSER, DBPASSW, DBNAME);
//echo "<p>Conectado<p>";
return $db;
} catch (Exception $e) {
error_log($e->getMessage());
return false;
}
}
function validateSession(){
//Notice: session_start(): Ignoring session_start() because a session is already active
//Por eso agregue este if
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
if(!isset($_SESSION['num'])){
header("Location: /login/");
exit();
}
}
function nullDb($param)
{
return $param == '' ? "NULL" : $param;
}
function crudRedirect($action, $listFile, $addFile, $editFile, $deleteFile = ""){
switch($action){
case 'add': include $addFile;
break;
case 'edit': include $editFile;
break;
case 'del': include $deleteFile;
break;
default: include $listFile;
break;
}
}