<?php

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

	if ( $_SESSION['level'] != 127 ) {
		header('Location: ' . $root_dir . '/M1/index_2.php');
		exit();
	}

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

	$return_path = "../M6_b/gestion_admins.php" ;
	include('../M0/display_user_only.php'); 

?>


<form name="form2" id="form2" method="post" action="">

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

	<tr align="center">
		<td colspan="2">
		
			<table width="98%">
			
				<tr align="center">
					<td>
						<div style="margin-top:10px;margin-bottom:10px;">
						<label 
							class="label_titres_menus" 
							style="font-size:21px;"
						>
							<u>- suppression d'un administrateur -</u>
						</label>
						</div>
					</td>
				</tr>
			</table>
			
			<table width="98%" align="center">
			
				<font size="1" face="Arial, Helvetica, sans-serif">&nbsp;</font>
				
				<tr>
				
					<td align="right"  width="18%" >
						<label>
							admin :&nbsp;
						</label>
					</td>
					
					<td align="left">
					
						<?php

							include('../M0/get_super_users.php');
							
							if ( $get_super_users_erreur == 0 ) {
								
								if ( sizeof($aqcm_SUPER_USER_ID) >= 1 ) {
									
									echo( '<select name="select_user_id" id="select_user_id" size="1" class="txtField_A" style="width:330px;" >' ) ;
									
									for ($i = 0; $i < sizeof($aqcm_SUPER_USER_ID); $i++) {
										
										if ( ( $aqcm_SUPER_USER_ID[$i] != $_SESSION["login"] ) && ( $aqcm_SUPER_USER_LEVEL[$i] < 127 ) ) {
											
											echo( '<option value="' . $aqcm_SUPER_USER_ID[$i] . '" >' ) ;
											echo( "$aqcm_SUPER_USER_ID[$i] ($aqcm_SUPER_USER_LEVEL[$i])" ) ;
											echo( "</option>" ) ;
										
										}

									}
									echo( '</select>' ) ;
									
								}
								else {
								echo( '<label>' ) ;
								echo( 'erreur : liste des utilisateurs vide !!!' ) ;
								echo( '</label>' ) ;
								}
								
							}
							else {
								echo( '<label>' ) ;
								echo( 'erreur (' . strval( $get_super_users_erreur ) . ') !!!' ) ;
								echo( '</label>' ) ;
							}

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



				
				<tr>
					<td align="center" colspan="2">
					
						<?php

								echo( '<input type="submit" onclick="my_confirm_function()" value="supprimer l\'administrateur sélectionné" class="button_A" >' ) ;
						?>
						</br></br>	
					</td>
				</tr>
				
			</table>
			
			
		</td>
	</tr>
	
</table>

</form>


<script>

function my_confirm_function() {
	var msg="attention : voulez-vous vraiment détruire l'administrateur sépectionné ?";
	var txt;
	var r = confirm(msg);
	if (r == true) {
			txt = "./delete_user_of_one_site_target_execute.php";
	} else {
		txt = "./delete_user_of_one_site_target.php";
	}
	document.getElementById("form2").action = txt;

}

</script>


 </body>
</html>