-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.php
More file actions
22 lines (21 loc) · 795 Bytes
/
install.php
File metadata and controls
22 lines (21 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
include_once $_SERVER['DOCUMENT_ROOT']."/attlestar/php/utils.php";
$data = loadJson($_SERVER['DOCUMENT_ROOT'].'/config.json');
$host=$data['host'];
$root=$data['root'];
$root_password=$data['password'];
$db=$data['db'];
try {
print("-> creating database " . $db . "... <br />");
$dbh = new PDO("mysql:host=$host", $root, $root_password);
$dbh->exec("CREATE DATABASE `$db`") or die(print_r($dbh->errorInfo(), true));
print("-> database " . $db . " created !<br /><br />");
print("-> importing data..<br />");
$req = file_get_contents ("./rush02db.sql");
$dbh = new PDO("mysql:host=$host;dbname=" . $db, $root, $root_password);
$dbh->exec($req);
print("-> data imported !<br />");
} catch (PDOException $e) {
die("DB ERROR: ". $e->getMessage());
}
?>