3
this file contains the first run info....
4
will not be abel te exec it it has already been run.
9
$passwordFile = "./cfg/adminpassword.md5";
10
$usernameFile = "./cfg/adminusername.u";
11
$sitenameFile = "./cfg/sitename.u";
12
include "./inc/dbConnect.php";
14
include "./inc/head.php";
15
if(file_exists("./cfg/hasrun.lock")){ //looks for a lockfile
17
echo "You are trying to run the install scrit, but it is not permited:<br /> \n
18
try to delite <code> ./conf/hasrun.lock </code> <br /> \n
19
or the site is proporly configured... return to <a href='./'>index</a> for start using the site! \n";
24
echo "debug: lock file deos not exist.<br /> \n";
28
include "./inc/admin_reg_form.html";
30
if($formdata[password] != $formdata[password2] || $formdata[password] == null){
32
echo "<em>the passwords does not match... or is empty.. </em> <br />";
37
echo "debug: creating MD5 version of password <br /> \n";
40
$passmd5 = md5($formdata[password]);
43
echo "debug:md5 is: " . $passmd5 . "<br /> \n";
44
echo "debug: MD5 created, now wirting to file. <br /> \n";
47
$fh = fopen($passwordFile, 'w') or die("can't open file");
48
fwrite($fh, $passmd5);
52
if($formdata[Name] != null){
57
echo "debug: saving username to file. <br /> \n";
61
$fh = fopen($usernameFile, 'w') or die("can't open file");
62
fwrite($fh, $formdata[Name]);
65
if($formdata[sitename] == null) {
67
echo "<em>Sitename is empty.</em><br /> \n";
71
$fh = fopen($sitenameFile, 'w') or die("can't open file");
72
fwrite($fh, $formdata[sitename]);
78
echo "creating database <br /> \n";
80
$db->query("CREATE TABLE booking (id COUNT(4) PRIMARY KEY,
81
name CHAR(255), email CHAR(255), Startdate DATE, EndDate DATE);") or die("could not create DB.."); //FIXME!
82
fopen("./cfg/hasrun.lock", "w"); //FIXME: device a better way to lock...
86
echo "<em>Username can not be empty...</em> <br /> \n";
96
include "./inc/foot.php";