-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.php
More file actions
32 lines (25 loc) · 1020 Bytes
/
init.php
File metadata and controls
32 lines (25 loc) · 1020 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
<?php
set_include_path(get_include_path().PATH_SEPARATOR.$_SERVER['DOCUMENT_ROOT']."/includes/");
require "global.php";
error_reporting(E_ALL);
// todo: if database already exists. abort!
$dbh = $site->get_database_handle();
// detect if table exists
// $query = sqlite_query($db, "SELECT name FROM sqlite_master WHERE type='table' and name='the_table_Im_looking_for'");
$sql = <<<_sql_
CREATE TABLE messages(
id INTEGER PRIMARY KEY AUTOINCREMENT,
[from] VARCHAR(50),
[to] VARCHAR(50),
subject VARCHAR(255),
body VARCHAR(255),
ip_address VARCHAR(15),
created DATETIME);
_sql_;
//echo $sql;
//$db->exec($sql);
$dbh->query($sql);
//$db->exec() or die($db->errorInfo());
// $sql = "INSERT INTO messages([from], [to], subject, body, ip_address, created) VALUES (?, ?, ?, ?, ?, ?);";
// $sth = $dbh->prepare($sql);
// $sth->execute(array("nobody@a1webconsulting.com", "webmaster@a1webconsulting.com", $site->domain, "test", $_SERVER['REMOTE_ADDR'], gmdate("YmdHisu", time())));