-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.php
More file actions
40 lines (28 loc) · 717 Bytes
/
build.php
File metadata and controls
40 lines (28 loc) · 717 Bytes
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
<?php
$pathToDbInc = './db.inc';
include $pathToDbInc;
$sqlLink = mysqli_connect($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME);
if (!$sqlLink) {
fiveHundred();
}
else {
createDb($sqlLink);
}
//---------------------------
function createDb ($link) {
$sql = 'CREATE TABLE nodes(node_id CHAR(40) NOT NULL,PRIMARY KEY(node_id),node_string TEXT NOT NULL,access_date BIGINT NOT NULL)';
if (!mysqli_query($link, $sql)) {
echo mysqli_error($link);
}
}
//---------------------------
function fourOhFour () {
header('HTTP/1.0 404 Not Found');
echo "<h1>404 Not Found</h1>";
exit();
}
function fiveHundred () {
header('HTTP/1.0 500 Internal Server Error');
echo "<h1>500 Internal Server Error</h1>";
exit();
}