- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.php
More file actions
Latest commit
65 lines (55 loc) · 1.49 KB
/
Copy pathconfig.php
File metadata and controls
65 lines (55 loc) · 1.49 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
<?php
//start a session
session_start();
//database config
$db_user='';
$db_pass='';
$db_host='localhost';
$db_name='';
//Domain name, like jec006.com
$domain='';
//Site secret for use in hashing passwords
//WARNING: do not change this after you have users on your site
//this will result in all users being unable to login
$secret = 'sdaf3456fvjlday5l$jlka2#@lksdeb-sd';
functiongetDB(){
global$db_user;
global$db_pass;
global$db_host;
global$db_name;
returnnewmysqli($db_host, $db_user, $db_pass, $db_name);
}
// These are support functions for a site using classes
/**
* A utility function to load the file for a class
*/
functionload_class($name){
require_once(get_class_path($name));
$name = strtoupper(substr($name, 0, 1)) . substr($name, 1);
return$name;
}
/**
* Helper to centralize the config for getting a path and filename for a class
*/
functionget_class_path($name){
returndirname(__FILE__) . '/' . $name . '.class.php';
}
/**
* Set an error message to be shown the next time errors are printed
*/
functionreport_error($type, $detail = '') {
global$error_queue;
$error_queue($type, $detail);
}
/**
* Retrieve the available errors and print them out
* Generally this will be handled by the request handler
*/
functionprint_errors() {
global$error_queue;
echo'<ul class="error-queue">';
foreach ($error_queueas$error) {
echo'<li class="error">' . $error[0] . '<span class="code">' . $error[1] . '</span><li>';
}
echo'</ul>';
}