<?php

REQUIRE 'pu.php';



?>
<HTML>
<HEAD>
<TITLE>Esimene</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1257">
<!-- ImageReady Preload Script (Esimene.psd) -->
<SCRIPT TYPE="text/javascript">
<!--

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		Broneerimine_03_over = newImage("images/Broneerimine_03-over.gif");
		Broneerimine_04_Broneerimine_03_over = newImage("images/Broneerimine_04-Broneerimin.gif");
		Broneerimine_05_over = newImage("images/Broneerimine_05-over.gif");
		Broneerimine_07_over = newImage("images/Broneerimine_07-over.gif");
		Broneerimine_11_Broneerimine_07_over = newImage("images/Broneerimine_11-Broneerimin.gif");
		preloadFlag = true;
	}
}

function kontrolliVormi(){
  
  var kuupikkused=new Array(31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
  
  if(kuupikkused[document.vorm1.alg_Kuu.selectedIndex]<document.vorm1.alg_Paev.selectedIndex+1){
     
     alert("Liiga suur algus kuupäev");
     return false;
}
  if(kuupikkused[document.vorm1.lopp_Kuu.selectedIndex]<document.vorm1.lopp_Paev.selectedIndex+1){
   

     alert("Liiga suur lopp kuupäev");
     alert(kuupikkused[document.vorm1.alg_Kuu.selectedIndex]);
     
     return false;
}
 
 return true;
}

// -->
</SCRIPT>
<!-- End Preload Script -->
</HEAD>
<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 ONLOAD="preloadImages();">






<!-- ImageReady Slices (Esimene.psd) -->
<TABLE WIDTH=700 BORDER=0 CELLPADDING=0 CELLSPACING=0>
	<TR>
		<TD COLSPAN=7>
			<IMG SRC="images/Broneerimine_01.gif" WIDTH=700 HEIGHT=30 ALT=""></TD>
	</TR>
	<TR>
		<TD ROWSPAN=2>
			<IMG SRC="images/Broneerimine_02.gif" WIDTH=23 HEIGHT=70 ALT=""></TD>
		<TD>
			<A HREF="Broneerimine.php"
				ONMOUSEOVER="changeImages('Broneerimine_03', 'images/Broneerimine_03-over.gif', 'Broneerimine_04', 'images/Broneerimine_04-Broneerimin.gif'); return true;"
				ONMOUSEOUT="changeImages('Broneerimine_03', 'images/Broneerimine_03.gif', 'Broneerimine_04', 'images/Broneerimine_04.gif'); return true;">
				<IMG NAME="Broneerimine_03" SRC="images/Broneerimine_03.gif" WIDTH=160 HEIGHT=36 BORDER=0 ALT=""></A></TD>
		<TD ROWSPAN=2>
			<IMG NAME="Broneerimine_04" SRC="images/Broneerimine_04.gif" WIDTH=17 HEIGHT=70 ALT=""></TD>
		<TD>
			<A HREF="Seadmed.php"
				ONMOUSEOVER="changeImages('Broneerimine_05', 'images/Broneerimine_05-over.gif'); return true;"
				ONMOUSEOUT="changeImages('Broneerimine_05', 'images/Broneerimine_05.gif'); return true;">
				<IMG NAME="Broneerimine_05" SRC="images/Broneerimine_05.gif" WIDTH=158 HEIGHT=36 BORDER=0 ALT=""></A></TD>
		<TD ROWSPAN=2>
			<IMG SRC="images/Broneerimine_06.gif" WIDTH=16 HEIGHT=70 ALT=""></TD>
		<TD>
			<A HREF="Kasutajad.php"
				ONMOUSEOVER="changeImages('Broneerimine_07', 'images/Broneerimine_07-over.gif', 'Broneerimine_11', 'images/Broneerimine_11-Broneerimin.gif'); return true;"
				ONMOUSEOUT="changeImages('Broneerimine_07', 'images/Broneerimine_07.gif', 'Broneerimine_11', 'images/Broneerimine_11.gif'); return true;">
				<IMG NAME="Broneerimine_07" SRC="images/Broneerimine_07.gif" WIDTH=159 HEIGHT=36 BORDER=0 ALT=""></A></TD>
		<TD ROWSPAN=2>
			<IMG SRC="images/Broneerimine_08.gif" WIDTH=167 HEIGHT=70 ALT=""></TD>
	</TR>
	<TR>
		<TD>
			<IMG SRC="images/Broneerimine_09.gif" WIDTH=160 HEIGHT=34 ALT=""></TD>
		<TD>
			<IMG SRC="images/Broneerimine_10.gif" WIDTH=158 HEIGHT=34 ALT=""></TD>
		<TD>
			<IMG NAME="Broneerimine_11" SRC="images/Broneerimine_11.gif" WIDTH=159 HEIGHT=34 ALT=""></TD>
	</TR>
</TABLE>
<!-- End ImageReady Slices -->





<form name="vorm1" action="broneering.php" onSubmit="return kontrolliVormi();">
<br>
<font size=4>Väike Kasutusjuhend.<br>
<br></font>
<font size=3>
Vali rippmenüüdest seade ning klass, seejärel vali algus (päev, kuu, aasta ning kell)
<br>Vajuta nuppu Lisa. Kui on vaja rentida välja ruumi ennast vali seadmete kategooriast <B>"RUUMI RENT"</B><br>
Aga ennem lisamist kontrolli kas keegi pole juba seda rentinud.<br>
Kasutades <A HREF="Otsi.php">otsingut.</A>

</font>

<br><br>

SEADE:</TD><TD><select name="nimi">

	<?php
       mysql_connect("localhost","allan","swiuno97");
       mysql_select_db("allan");
     $lause="SELECT nimi FROM SEADMED";

        $vastus=mysql_query($lause);
        while($rida=mysql_fetch_array($vastus)){
		echo "<option value='$rida[nimi]'>$rida[nimi]</option>\n";

        }?>>
		   </select><BR><BR>
KLASS:</TD><TD><select name="klass">

<?php
       mysql_connect("localhost","allan","swiuno97");
       mysql_select_db("allan");
     $lause="SELECT KLASS_nimi FROM KLASS";

        $vastus=mysql_query($lause);
        while($rida=mysql_fetch_array($vastus)){
		 echo "<option value='$rida[KLASS_nimi]'>$rida[KLASS_nimi]</option>\n";
        }?> </select>
<BR><BR>
<table><TR><td>
ALGUS:<select name="alg_Paev">
<option value=01>1</option>
<option value=02>2</option>
<option value=03>3</option>
<option value=04>4</option>
<option value=05>5</option>
<option value=06>6</option>
<option value=07>7</option>
<option value=08>8</option>
<option value=09>9</option>
<option value=10>10</option>
<option value=11>11</option>
<option value=12>12</option>
<option value=13>13</option>
<option value=14>14</option>
<option value=15>15</option>
<option value=16>16</option>
<option value=17>17</option>
<option value=18>18</option>
<option value=19>19</option>
<option value=20>20</option>
<option value=21>21</option>
<option value=22>22</option>
<option value=23>23</option>
<option value=24>24</option>
<option value=25>25</option>
<option value=26>26</option>
<option value=27>27</option>
<option value=28>28</option>
<option value=29>29</option>
<option value=30>30</option>
<option value=31>31</option>
</select>
</td><td>
<select name="alg_Kuu">
<option value=01>Jaanuar</option>
<option value=02>Veebruar</option>
<option value=03>Märts</option>
<option value=04>Aprill</option>
<option value=05>Mai</option>
<option value=06>Juuni</option>
<option value=07>Juuli</option>
<option value=08>August</option>
<option value=09>September</option>
<option value=10>Oktoober</option>
<option value=11>November</option>
<option value=12>Detsember</option>
</select>

</td><td>

<select name="alg_Aasta">
<option value=2005>2005</option>
<option value=2006>2006</option>
<option value=2007>2007</option>
<option value=2008>2008</option>
<option value=2009>2009</option>
</select>
</td><td>
<select name="alg_Kell">

<option value=08>8:00</option>
<option value=09>9:00</option>
<option value=10>10:00</option>
<option value=11>11:00</option>
<option value=12>12:00</option>
<option value=13>13:00</option>
<option value=14>14:00</option>
<option value=15>15:00</option>
<option value=16>16:00</option>
<option value=17>17:00</option>

</select></td></TR>
<TR><td>


LÕPP ..:<select name="lopp_Paev">
<option value=01>1</option>
<option value=02>2</option>
<option value=03>3</option>
<option value=04>4</option>
<option value=05>5</option>
<option value=06>6</option>
<option value=07>7</option>
<option value=08>8</option>
<option value=09>9</option>
<option value=10>10</option>
<option value=11>11</option>
<option value=12>12</option>
<option value=13>13</option>
<option value=14>14</option>
<option value=15>15</option>
<option value=16>16</option>
<option value=17>17</option>
<option value=18>18</option>
<option value=19>19</option>
<option value=20>20</option>
<option value=21>21</option>
<option value=22>22</option>
<option value=23>23</option>
<option value=24>24</option>
<option value=25>25</option>
<option value=26>26</option>
<option value=27>27</option>
<option value=28>28</option>
<option value=29>29</option>
<option value=30>30</option>
<option value=31>31</option>
</select>

</td>
<td>

<select name="lopp_Kuu">
<option value=01>Jaanuar</option>
<option value=02>Veebruar</option>
<option value=03>Märts</option>
<option value=04>Aprill</option>
<option value=05>Mai</option>
<option value=06>Juuni</option>
<option value=07>Juuli</option>
<option value=08>August</option>
<option value=09>September</option>
<option value=10>Oktoober</option>
<option value=11>November</option>
<option value=12>Detsember</option>
</select>

</td><td>

<select name="lopp_Aasta">
<option value=2005>2005</option>
<option value=2006>2006</option>
<option value=2007>2007</option>
<option value=2008>2008</option>
<option value=2009>2009</option>
</select>

</td><td>

<select name="lopp_Kell">


<option value=08>8:00</option>
<option value=09>9:00</option>
<option value=10>10:00</option>
<option value=11>11:00</option>
<option value=12>12:00</option>
<option value=13>13:00</option>
<option value=14>14:00</option>
<option value=15>15:00</option>
<option value=16>16:00</option>
<option value=17>17:00</option>

</select>
</td></TR></table>

<BR><BR>

</table>
<input type="submit" value="Lisa" />
   </form>



<?php
 //include('puuu.php');
  mysql_connect("localhost","kasutajanimi","parool");
  mysql_select_db("baas");

error_reporting(E_NO);

session_start(); 

$muutuja=$_SESSION["kasutaja"];
$string="RUUMI RENT!";
  
  $lause="SELECT id,SEADE,KLASS,DATE_FORMAT(BRON_algus, '%d/%m/%Y/%h:00') AS AEG,DATE_FORMAT(BRON_lopp, '%d/%m/%Y/%h:00') AS AEG2 FROM BRONEERINGUD where BRONNIA='$muutuja' && SEADE!='$string'";
  $vastus=mysql_query($lause);


  $lause2="SELECT id,SEADE,KLASS,DATE_FORMAT(BRON_algus, '%d/%m/%Y/%h:00') AS AEG,DATE_FORMAT(BRON_lopp, '%d/%m/%Y/%h:00') AS AEG2 FROM BRONEERINGUD where BRONNIA='$muutuja' && SEADE='$string'";
  $vastus2=mysql_query($lause2);

echo "<table>";
    
echo "<form action='masskustutus1.php'>";
echo "Oled selliseid seadmeid broneerinud!";

while($rida=mysql_fetch_array($vastus))


 {

echo "
     <tr>
     
     <td><input type='checkbox' name='ruut[]' value='$rida[id]'></td>
     <td>$rida[SEADE]</td>
     <td>$rida[KLASS]</td>
     <td>$rida[AEG]</td>
     <td> kuni </td>
     <td>$rida[AEG2]</td>
     	 
     
     </tr>
";

   }  

echo "<tr><td colspan='2'>Oled selliseid ruume broneerinud!</td></tr>";

while($rida2=mysql_fetch_array($vastus2))


 {

echo "
     <tr>
     
     <td><input type='checkbox' name='ruut[]' value='$rida2[id]'></td>
     <td>$rida2[SEADE]</td>
     <td>$rida2[KLASS]</td>
     <td>$rida2[AEG]</td>
     <td> kuni </td>
     <td>$rida2[AEG2]</td>
     	 
     
     </tr>
";

   }  



 echo"</table>";
echo"<input type='submit' value='Kustuta'></form>";
  mysql_close();
?>

</BODY>
</HTML>
