bzr branch
http://gegoxaren.bato24.eu/bzr/booka/trunk
|
1
by Gustav Hartvigsson
initial code... |
1 |
<?php
|
|
11
by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs. |
2 |
session_start(); |
3 |
/*
|
|
4 |
dbEditor.php
|
|
5 |
*/
|
|
6 |
if(!$_SESSION[logedin]){ |
|
7 |
||
8 |
header('Location: ./BooKa.php'); |
|
9 |
}
|
|
|
28
by Gustav Hartvigsson
fixxed some strange behavior where reloding the dbEditor.php caused it to commit the same data again te the db. |
10 |
|
|
16
by Gustav Hartvigsson
Lots of broken code that i have no idea how to fix. |
11 |
$errorMsg = null; //ERRORMSG! |
|
28
by Gustav Hartvigsson
fixxed some strange behavior where reloding the dbEditor.php caused it to commit the same data again te the db. |
12 |
|
|
1
by Gustav Hartvigsson
initial code... |
13 |
include "./inc/dbConnect.php"; |
14 |
||
|
11
by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs. |
15 |
//manipulation of DB
|
16 |
$newname = $_POST[name]; |
|
17 |
$newphone = $_POST[phone]; |
|
18 |
$newmail = $_POST[email]; |
|
19 |
$newadress = $_POST[adress]; |
|
20 |
$newStartDate = $_POST[StartDate]; |
|
21 |
$newEndDate = $_POST[EndDate]; |
|
22 |
||
|
29
by Gustav Hartvigsson
iBah |
23 |
$valid = true; //this will be true untill it is changed. |
|
16
by Gustav Hartvigsson
Lots of broken code that i have no idea how to fix. |
24 |
|
|
24
by Gustav Hartvigsson
changed some stuff to use the CSS class 'warning'. |
25 |
include "./inc/formif.php";//ifs and buts for checking if inputed data is there. |
26 |
include "./inc/regex.php";//RegEX chexing of dates. |
|
|
28
by Gustav Hartvigsson
fixxed some strange behavior where reloding the dbEditor.php caused it to commit the same data again te the db. |
27 |
//TODO: figure out why the errorMsg is only set by regex.php ...
|
|
16
by Gustav Hartvigsson
Lots of broken code that i have no idea how to fix. |
28 |
|
29 |
if( $valid ){ |
|
|
11
by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs. |
30 |
|
31 |
$db->queryexec("BEGIN; |
|
32 |
INSERT INTO bookings(name, StartDate, EndDate, phone, mail, adress) VALUES('{$newname}', '{$newStartDate}', '{$newEndDate}', '{$newphone}', '{$newmail}', '{$newadress}'); |
|
33 |
COMMIT") or die("could not insert in to table"); |
|
|
28
by Gustav Hartvigsson
fixxed some strange behavior where reloding the dbEditor.php caused it to commit the same data again te the db. |
34 |
sleep(.5); |
35 |
header('Location: ./dbEditor.php'); |
|
|
11
by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs. |
36 |
}
|
37 |
//end of DB manipulation.
|
|
38 |
||
|
1
by Gustav Hartvigsson
initial code... |
39 |
include "./inc/head.php"; |
40 |
?>
|
|
41 |
||
|
11
by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs. |
42 |
<div class="head"><img src="./img/Logo.png" alt="BooKa´s logo" /></div>
|
43 |
|
|
44 |
<div class="menu2">
|
|
|
26
by Gustav Hartvigsson
added so that webpage is served as XHTML, and then some coding errors in XHTML code... |
45 |
<h2> You are logedin <a href="logout.php"> [logout] </a><a href="BooKa.php"> [Return] </a> </h2>
|
|
11
by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs. |
46 |
<hr />
|
|
16
by Gustav Hartvigsson
Lots of broken code that i have no idea how to fix. |
47 |
<?php |
48 |
if($errorMsg!=null){ |
|
|
28
by Gustav Hartvigsson
fixxed some strange behavior where reloding the dbEditor.php caused it to commit the same data again te the db. |
49 |
echo " <p class='warning'>".$errorMsg."</p> <!-- this paragraph is created by the php script -->"; |
|
16
by Gustav Hartvigsson
Lots of broken code that i have no idea how to fix. |
50 |
}
|
51 |
?>
|
|
|
13
by Gustav Hartvigsson
Fixed stiff with the url's cousing the admin panel to not show. |
52 |
|
|
11
by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs. |
53 |
<form action="dbEditor.php" method="post">
|
54 |
<div class="lefta">
|
|
|
29.1.1
by gustav.hartvigsson
Fixed a parsing error, namly replaced all <? with <?php. |
55 |
<label for="name" <?php echo $nameunset ?>>Name</label> <input type="text" name="name" <?php echo $nameunset ?> /> <br /> |
56 |
<label for="phone" <?php echo $phoneunset ?>>Phone number</label> <input type="text" name="phone" id="phone" <?php echo $phoneunset ?> /><br /> |
|
57 |
<label for="email" <?php echo $emailunset ?>>e-mail address</label> <input type="text" name="email" id="email" <?php echo $emailunset ?> /><br /> |
|
|
11
by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs. |
58 |
</div>
|
59 |
<div class="righta">
|
|
|
29.1.1
by gustav.hartvigsson
Fixed a parsing error, namly replaced all <? with <?php. |
60 |
<label for="adress" <?php echo $adressunset ?> >adress</label> <input type="text" name="adress" id="adress" <?php echo $adressunset ?> /> <br /> |
61 |
<label for="StartDate" <?php echo $StartDateunset ?>>Start Date </label> <input type="text" name="StartDate" id="StartDate" <?php echo $StartDateunset ?> /><br /> |
|
62 |
<label for="EndDate" <?php echo $EndDateunset ?> >End Date</label> <input type="text" name="EndDate" id="EndDate" <?php echo $EndDateunset ?> /> <br /> |
|
|
11
by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs. |
63 |
</div>
|
64 |
<input type="hidden" name="fromadd" value="true" />
|
|
65 |
<p><input type="submit" value="add" name="add" class="add" /></p>
|
|
66 |
</form>
|
|
67 |
|
|
|
16
by Gustav Hartvigsson
Lots of broken code that i have no idea how to fix. |
68 |
|
|
14
by Gustav Hartvigsson
Fixed error in dbEditor where it said that the remove button did not work. |
69 |
<h2> current DB structure. </h2>
|
|
11
by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs. |
70 |
|
|
16
by Gustav Hartvigsson
Lots of broken code that i have no idea how to fix. |
71 |
<table> <!-- tabell -->
|
|
11
by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs. |
72 |
<tr> <!-- row one -->
|
73 |
<td> id </td>
|
|
74 |
<td> Name </td>
|
|
75 |
<td> Start Date </td>
|
|
76 |
<td> End Date </td>
|
|
77 |
<td> Phone Number </td>
|
|
78 |
<td> E-mail </td>
|
|
79 |
<td> Adress </td>
|
|
80 |
<td> remove </td>
|
|
81 |
</tr> <!-- end of row one -->
|
|
|
29.1.1
by gustav.hartvigsson
Fixed a parsing error, namly replaced all <? with <?php. |
82 |
<?php |
|
11
by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs. |
83 |
|
84 |
$result = $db->query("SELECT * FROM bookings") or die("could not do query!"); |
|
85 |
foreach($result as $row){ |
|
86 |
?>
|
|
87 |
<tr> <!-- Row two and up -->
|
|
|
29.1.1
by gustav.hartvigsson
Fixed a parsing error, namly replaced all <? with <?php. |
88 |
<td> <?php echo $row[id]?> </td> |
89 |
<td> <?php echo $row[name]?> </td> |
|
90 |
<td> <?php echo $row[StartDate]?> </td> |
|
91 |
<td> <?php echo $row[EndDate]?> </td> |
|
92 |
<td> <?php echo $row[phone]?> </td> |
|
93 |
<td> <?php echo $row[mail]?> </td> |
|
94 |
<td> <?php echo $row[adress]?> </td> |
|
|
11
by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs. |
95 |
<td>
|
96 |
<form action="removeFromDB.php" method="post">
|
|
97 |
<p>
|
|
98 |
<input type="submit" value="remove" />
|
|
99 |
<input type="hidden" value="<? echo $row[id]?>" name="id"/> |
|
100 |
</p>
|
|
101 |
</form>
|
|
102 |
</td>
|
|
103 |
</tr> <!-- end of row two and up -->
|
|
|
29.1.1
by gustav.hartvigsson
Fixed a parsing error, namly replaced all <? with <?php. |
104 |
<?php |
|
11
by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs. |
105 |
}
|
106 |
?>
|
|
107 |
</table>
|
|
108 |
|
|
109 |
</div>
|
|
110 |
||
|
29.1.1
by gustav.hartvigsson
Fixed a parsing error, namly replaced all <? with <?php. |
111 |
<?php
|
|
11
by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs. |
112 |
|
113 |
include "./inc/foot.php" |
|
|
1
by Gustav Hartvigsson
initial code... |
114 |
?>
|
|
11
by Gustav Hartvigsson
merging Neo to trunk. freezing neo branshs. |
115 |
|
116 |