-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAutoLoad.php
More file actions
42 lines (36 loc) · 1.33 KB
/
AutoLoad.php
File metadata and controls
42 lines (36 loc) · 1.33 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
<?php
session_start();
require "includes/constants.php";
require "includes/dbConnection.php";
require "lang/en.php";
// Class Auto Load
function classAutoLoad($classname) {
$directories = ["contents", "layouts", "menus", "forms", "processes", "global"];
foreach ($directories as $dir) {
$filename = __DIR__ . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR . $classname . ".php";
if (file_exists($filename) && is_readable($filename)) {
require_once $filename;
}
}
}
spl_autoload_register('classAutoLoad');
// Create instances of all classes
$ObjLayouts = new layouts();
$ObjMenus = new menus();
$ObjHeadings = new headings();
$ObjCont = new contents();
$ObjForm = new user_forms();
$conn = new dbConnection(DBTYPE, HOSTNAME, DBPORT, HOSTUSER, HOSTPASS, DBNAME);
// Create process instances
$ObjAuth = new auth();
// Use only available variables in method calls
try {
$ObjAuth->signup($conn, null, null, $lang, null);
$ObjAuth->verify_code($conn, null, null, $lang, null);
$ObjAuth->set_passphrase($conn, null, null, $lang, null);
$ObjAuth->signin($conn, null, null, $lang, null);
$ObjAuth->signout($conn, null, null, $lang, null);
$ObjAuth->save_details($conn, null, null, $lang, null);
} catch (Exception $e) {
error_log("Error in authentication process: " . $e->getMessage());
}