/*
firstrun.php
*/
$username1 = $_POST[userName];
$password1 = $_POST[userPassword];
$password2 = $_POST[userPassword2];
include "./inc/head.php";
if(file_exists("./cfg/lock.lock")){
?>
This isntalation locked, you need to remove ./cfg/lock.lock
Klick here to return to the BooKa page.
//header('Location: ./BooKa.php');
} else {
if($debug){
echo "";
echo "{$username}
";
echo "{$password1}
";
echo "{$password2}
";
echo "
";
}
?>
}
if($username1 != null && $password1 != null && $password2 == $password1){
include "./inc/dbConnect.php";
$newpassword = md5($password1);
//create users table
//user group 1 is admin, 2 is "normal users"
$db->queryExec("BEGIN;
CREATE TABLE users(id INTEGER PRIMARY KEY, username CHAR(255), password CHAR(255), 'group' INTEGER);
INSERT INTO users (username, password, 'group') VALUES('{$username1}' , '{$newpassword}', '1');
COMMIT;") or die("could not do query");
echo $db->error;
//end of user table creation...
echo "Registration complite";
//This creates the bookins table
$db->queryexec("BEGIN;
CREATE TABLE bookings
(id INTEGER PRIMARY KEY,
name CHAR, phone CHAR,
mail CHAR, adress CHAR,
StartDate DATE, EndDate DATE);
COMMIT;") or die("could not create table:");
echo $db->error;
//end of table creation...
fopen("./cfg/lock.lock", 'w') or die("can't open file");
}
include "./inc/foot.php";
?>