<?php

	include("../M0/session_start.php") ;

	if ( $_SESSION['level'] < 8 ) {
		header('Location: ' . $root_dir . '/M5/gestion_sondes.php');
		exit();
	}

	include("../M0/communs_en_tete_HTML.html") ;
	$back_link = "../M5/gestion_sondes.php";
	include('../M0/communs_en_tete_home_back.html');

	$return_path = "./get_code_for_one_sonde.php" ;
	include('../M0/display_user_site_without_BAT_NIV.php');
	
?>

<font size="1" face="Arial, Helvetica, sans-serif">&nbsp;</font>

<form name="form2" id="form2" method="post" action="./server_side_create_one_sonde_of_one_site_execute.php">

<table align="center" width="<?php echo $tables_width ; ?>"  border="2" cellspacing="2" cellpadding="2" bordercolor="#ffffff" bgcolor="#000033">	

	<tr align="center">
		<td colspan="2">
		
			<font size="4" color="lightblue" face="Arial, Helvetica, sans-serif">
				</br><u>- pré-inscription d'une sonde -</u></br></br>
			</font>	

			<table width="98%">
			
				<font size="1" face="Arial, Helvetica, sans-serif">&nbsp;</font>

				<tr>

					<?php
						//-----------------------------------------------------------------------------------------------------------------
						// routine de création des mots de passe
						//-----------------------------------------------------------------------------------------------------------------
						function CarAleatoire($taille) {
							  // Liste des caractères possibles
							  $cars="abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ123456789";
							  $mdp='';
							  $long=strlen($cars);

							  srand((double)microtime()*1000000); //Initialise le générateur de nombres aléatoires

							  for($i=0;$i<$taille;$i++) $mdp=$mdp.substr($cars,rand(0,$long-1),1);

							  return $mdp;
						}
						
						$PWD_12 = CarAleatoire(12) ;

					?>



					<td align="right" width="23%"><label>password :&nbsp;</label></td>
					<td align="left">
						<input type="text" size="28" name="target_PWD" id="target_PWD" value="<?php echo($PWD_12); ?>" class="txtField_A" style="width:91%" />
					</td>
				</tr>
				<tr>
					<td align="right" ><label>nom :&nbsp;</label></td>
					<td align="left">
						<input type="text" size="28" name="target_NAME" id="target_NAME" value="" class="txtField_A" style="width:91%" />
					</td>
				</tr>
				<tr>
					<td align="right" ><label>altitude :&nbsp;</label></td>
					<td align="left">
						<input id="target_QNH" name="target_QNH" type="text"  value="0000" size="2" maxlength="4" onkeypress="return (event.charCode !=8 && event.charCode ==0 || ( (event.charCode >= 48 && event.charCode <= 57) ) )" class="txtField_A" style="width:70px" >
					</td>
				</tr>
				<tr>
					<td align="right" ><label>bâtiment :&nbsp;</label></td>
					<td align="left">
						<select name="target_BAT" id="target_BAT" size="1" class="txtField_M1" style="width:70px" >
							<?php
								include ("../M0/selection_BAT_no_select.php");
							?>
						</select>
					</td>
				</tr>
				<tr>
					<td align="right" ><label>étage :&nbsp;</label></td>
					<td align="left">
						<select name="target_NIVEAU" id="target_NIVEAU" size="1" class="txtField_M1" style="width:70px" >
							<?php
								include ("../M0/selection_NIVEAU_no_select.php");
							?>
						</select>
					</td>
				</tr>
				<tr>
					<td align="right" ><label>hardware :&nbsp;</label></td>
					<td align="left">
						<select name="target_HW" id="target_HW" size="1" class="txtField_M1" style="width:70px" >
							<?php
								include ("../M0/selection_HW.php");
							?>
						</select>
					</td>
				</tr>
				<tr>
					<td align="right" ><label>wifi SSID :&nbsp;</label></td>
					<td align="left">
						<input type="text" size="28" name="target_SSID" id="target_SSID" value="" class="txtField_A" style="width:91%" />
					</td>
				</tr>
				<tr>
					<td align="right"><label>wifi PSK :&nbsp;</label></td>
					<td align="left">
						<input type="text" size="28" name="target_PSK" id="target_PSK" value="" class="txtField_A" style="width:91%"  />
					</td>
				</tr>


				<tr>
					<td>
						<font size="1" face="Arial, Helvetica, sans-serif">&nbsp;</font>
					</td>
				</tr>

				<tr align="center" >
					<td align="center" colspan="2" style="text-align: center;" >
						<input type="submit" name="retour" value="créer la sonde" class="button_A" style="width:390px;" >
					</td>
				</tr>
	


			</table>

			<font size="1" face="Arial, Helvetica, sans-serif">&nbsp;</font>
			
		</td>
	</tr>
	
</table>

</form>

 </body>
</html>