/booka/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/booka/trunk
29.1.1 by gustav.hartvigsson
Fixed a parsing error, namly replaced all <? with <?php.
1
<?php
11 by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs.
2
	/*
3
	firstrun.php
4
	*/
5
$username1 = $_POST[userName];
6
$password1 = $_POST[userPassword];
7
$password2 = $_POST[userPassword2];
1 by Gustav Hartvigsson
initial code...
8
20 by Gustav Hartvigsson
Made the firstrun.php more user friendly.
9
include "./inc/head.php";
10
11 by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs.
11
if(file_exists("./cfg/lock.lock")){
20 by Gustav Hartvigsson
Made the firstrun.php more user friendly.
12
	?>
30 by Gustav Hartvigsson
have no idea wheat has changed here...
13
		<p class="warning">This instalation locked, you need to remove ./cfg/lock.lock</p>
20 by Gustav Hartvigsson
Made the firstrun.php more user friendly.
14
		<p class="warning">Klick <a href="./BooKa.php"> here </a> to return to the BooKa page.</p>
29.1.1 by gustav.hartvigsson
Fixed a parsing error, namly replaced all <? with <?php.
15
	<?php
11 by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs.
16
	
20 by Gustav Hartvigsson
Made the firstrun.php more user friendly.
17
	//header('Location: ./BooKa.php');
11 by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs.
18
	
19
} else {
1 by Gustav Hartvigsson
initial code...
20
11 by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs.
21
if($debug){
22
	echo "<p>";
23
	echo "{$username} <br/>";
24
	echo "{$password1} <br/>";
25
	echo "{$password2} <br/>";
26
	echo "</p>";
27
}
28
?>
29
	<div class="menu2">
30
		 <h1> Welcome to BooKa </h1>
31
		 <h2> a Mimimalistic booking software </h2>
32
		 <hr />
33
		 <p> here you register the abmin account </p>
34
		 <form action="firstrun.php" method="post" >
35
		 	<p>
36
		 		User name: <input type="text" name="userName" /> <br/>
37
		 		Password:  <input type="password" name="userPassword" /> <br />
38
		 		Password again: <input type="password" name="userPassword2" /> <br />
39
		 		<input type="hidden" name="reg" value="true" /> <br/>
40
		 		
29.1.1 by gustav.hartvigsson
Fixed a parsing error, namly replaced all <? with <?php.
41
		 		<?php
11 by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs.
42
		 		
43
		 		if($_POST[reg]){
44
		 			
45
		 			if($username1 == null) echo "you need to add a username <br />";
46
		 			if($password1 == null) echo "you need a password! <br />";
47
		 			if($password1 != $password2) echo "Passwords deos not match <br />";
48
		 			
49
		 		}
50
		 		
51
		 		?>
52
		 		
53
		 		<input type="submit" name="submitt" />
54
		 	</p>
55
		 </form>
56
	</div>
57
	
58
	
29.1.1 by gustav.hartvigsson
Fixed a parsing error, namly replaced all <? with <?php.
59
<?php
11 by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs.
60
}
61
62
if($username1 != null && $password1 != null && $password2 == $password1){
63
	include "./inc/dbConnect.php";
64
	
65
	$newpassword = md5($password1);
66
	//create users table
67
	//user group 1 is admin, 2 is "normal users"
68
	$db->queryExec("BEGIN;
69
		CREATE TABLE users(id INTEGER PRIMARY KEY, username CHAR(255), password CHAR(255), 'group' INTEGER);
70
		INSERT INTO users (username, password, 'group') VALUES('{$username1}' , '{$newpassword}', '1');
71
		COMMIT;") or die("could not do query");
72
	echo $db->error;
73
	//end of user table creation...
74
	echo "Registration complite";
75
	//This creates the bookins table
76
	$db->queryexec("BEGIN;
77
		CREATE TABLE bookings
78
		(id INTEGER PRIMARY KEY,
79
		name CHAR, phone CHAR,
80
		mail CHAR, adress CHAR,
81
		StartDate DATE, EndDate DATE);
82
		COMMIT;") or die("could not create table:");
83
	echo $db->error;
84
	//end of table creation...
85
	fopen("./cfg/lock.lock", 'w') or die("can't open file");
86
	
87
}
88
89
1 by Gustav Hartvigsson
initial code...
90
include "./inc/foot.php";
91
?>