Skip to content
admin_users.php 10.1 KiB
Newer Older
Seblu's avatar
Seblu committed
<?php

function dispAdminUsers () {




if ($_SESSION["user_right"] < $GLOBALS["EPTV"] )
{
	return("T'es ouf");
}

	get_time();


$result = getAllUsers();


$str = '
		
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr>
		<td bgcolor="#000000">
		<table width="100%" border="0" cellspacing="1" cellpadding="2">
			<tr>
			<td>
				<b>
				<font color="#ffffff">
				&nbsp a l l &nbsp u s e r s
				</font>
				</b> 
			</td>
			</tr>
		';

			if ($_SESSION["user_right"] == $GLOBALS["ROOT"]) {
			$str .= '
				<tr>
				<td>
					<FORM name="new_user" method="post" action="index.php?section=AdminHome&section_admin=AdminAddUser">
					<INPUT class="button" TYPE="submit" NAME="action" VALUE="  NOUVEAU USER  "><BR> </TD>
					</FORM>
				</td>
				</tr>
				';
			}
		$str .= '
						
			<tr>
Seblu's avatar
Seblu committed
			<td bgcolor="#303030">
Seblu's avatar
Seblu committed
			<table cellpadding="0" cellspacing="0" width="100%">
				<tr>
				<td>
				<table width="100%" border="0" cellspacing="0" cellpadding="4">

			<TR>
			<td><b>Login</b></td>
			<td><b>Pseudo</b></td>
			<td><b>Right</b></td>
			
			</TR>

			<TR>
	';
			$cpt = 1;
			while ($user = mysql_fetch_array($result)) {
 
				$element_id = $user["user_id"];

				$str .=	
					'<TD>
					<small><b>'.$cpt.'</b></small>

					'.$user["user_login"].'
		
				</TD>
				<TD>				
					'.$user["user_pseudo"].'
				</TD>
				<TD>
					<small>
					'.$name=get_right_name($user["user_right"]).'
					</small>
				</TD>
			';

			  if ($_SESSION["user_right"] == $GLOBALS["ROOT"]) {          
				$str .= '
					<TD width=10% align=right>
						<FORM name="update_user" method="post" action="index.php?section=AdminHome&section_admin=AdminModifUser&element_id='.$element_id.'">
						<INPUT class="button" TYPE="submit" NAME="action" VALUE="  MODIFIER  "> 
						</FORM>
					</TD>
					<TD width=10% align=right>
						<FORM name="supp_user" method="post" action="index.php?section=AdminHome&section_admin=AdminDelUser&element_id='.$element_id.'">
						<INPUT class="button" TYPE="submit" NAME="action" VALUE="  SUPPRIMER  ">
					</FORM>
					</TD>
				';
				}
			$str .= '
			</TR>';
			$cpt++;
			}

		$str .= '
				</table>
				</td>
				</tr>
			</table>
			</td>
			</tr>
		</table>
		</td>
		</tr>
	</table>
	
	';


return $str;


}





function	dispAdminAddUser() {

 $date = get_date();

 $str = '		
<table width="80%" border="0" cellspacing="0" cellpadding="0">
	<tr>
	<td bgcolor="#000000">
	<table width="100%" border="0" cellspacing="1" cellpadding="2">
		<tr>
		<td>
			<b>
			<font color="#ffffff">
			&nbsp a d d &nbsp u s e r &nbsp t o &nbsp d a t a b a s e
			</font>
			</b> 
		</td>
		</tr>					
	<tr>
Seblu's avatar
Seblu committed
	<td bgcolor="#303030">
Seblu's avatar
Seblu committed
	<table cellpadding="0" cellspacing="0" width="100%">
		<tr>	
		    <form name="saisie" method="post" action="index.php?section=AdminHome&section_admin=AddUser&element_id='.$element_id.'">
		    <TABLE CELLSPACING="0" CELLPADDING="10" BORDER="0">
   
			    <TR><TD> Login: </TD>
			    <TD> <INPUT TYPE="text" NAME="user_get_login" VALUE="" SIZE="20" MAXLENGTH="20"> </TD>
			    </TR>
   	 
			    <TR><TD> Pseudo: </TD>
			    <TD> <INPUT TYPE="text" NAME="user_get_pseudo" VALUE="" SIZE="20" MAXLENGTH="20"> </TD>
			    </TR>

			    <TR><TD> Pass: </TD>
			    <TD> <INPUT TYPE="password" NAME="user_get_pass" VALUE="" SIZE="20" MAXLENGTH="20"> </TD>
			    </TR>

			    <TR><TD> Re Pass: </TD>
			    <TD> <INPUT TYPE="password" NAME="user_get_verif_pass" VALUE="" SIZE="20" MAXLENGTH="20"> </TD>
			    </TR>

			    <TR><TD> Mail: </TD>
			    <TD> <INPUT TYPE="text" NAME="user_get_mail" VALUE="" SIZE="30" MAXLENGTH="30"> </TD>
			    </TR>

			    <TR><TD> Numro de tlphone: </TD>
			    <TD> <INPUT TYPE="text" NAME="user_get_tel" VALUE="" SIZE="10" MAXLENGTH="10"> </TD>
			    </TR>


			    <TR><TD> Date d entree: </TD>
			    <TD> <INPUT TYPE="text" NAME="user_get_date" VALUE="'.$date.'" SIZE="8" MAXLENGTH="10"> </TD>
			    </TR>
    
			    <TR><TD>Right:</TD>
			    <TD>
			    <TABLE CELLSPACING"0" CELLPADDING="1" BORDER="0">
			   	 <TR> <TD>
				    <select name="user_get_right">
				    <option value="1">Basic</option>
				    <option value="2">Guest</option>
				    <option value="4">Epi Register</option>
				    <option value="5">Reporter</option>
				    <option value="6">Private Guest</option>
				    </TD></TR>
			    </TABLE>
			    </TD>
			    </TR>

			    <TR><TD>Signature: </TD>
			    <TD>
			    <TEXTAREA rows="3" cols="38" name="user_get_signature" ONFOCUS=""></textarea>
			    </TD>
			    </TR>
    
			    <TR><TD>Happy Comment: </TD>
			    <TD>
			    <TEXTAREA rows="3" cols="38" name="user_get_comment" ONFOCUS=""></textarea>
			    </TD>
			    </TR>


			    <TR>
				    <TD> </TD>
				    <TD> <INPUT class="button" TYPE="submit" NAME="action" VALUE="  INSCRIPTION  "> </TD>
			    </TR>
			    <TR>
			 	   <TD> </TD>
				   <TD> <INPUT class="button" TYPE="reset" NAME="action" VALUE=" RESET "> </TD>
			    </TR>
		    </TABLE>
		</FORM>
		</TR>
	</TABLE>
	</TD>
	</TR>
</TABLE>
';

return $str;

}




function	dispAdminModifUser() {

$element_id =$_GET['element_id'];

$result = getOneUserById($element_id);

$str = '		
<table width="80%" border="0" cellspacing="0" cellpadding="0">
	<tr>
	<td bgcolor="#000000">
	<table width="100%" border="0" cellspacing="1" cellpadding="2">
		<tr>
		<td>
			<b>
			<font color="#ffffff">
			&nbsp m o d i f y &nbsp u s e r
			</font>
			</b> 
		</td>
		</tr>					
	<tr>
Seblu's avatar
Seblu committed
	<td bgcolor="#303030">
Seblu's avatar
Seblu committed
	<table cellpadding="0" cellspacing="0" width="100%">
		<tr>	
	';

  if (mysql_num_rows($result)){
    $user = mysql_fetch_array($result);    
  }

  $str .= '
    <form name="saisie" method="post" action="index.php?section=AdminHome&section_admin=ModifUser&element_id='.$element_id.'">
	    <TABLE CELLSPACING="0" CELLPADDING="10" BORDER="0">
	   
 		   <TR><TD> Login: </TD>
		    <TD> <INPUT TYPE="text" NAME="user_get_login" VALUE="'.$user["user_login"].'" SIZE="20" MAXLENGTH="20"> </TD>
		    </TR>
    
		    <TR><TD> Pseudo: </TD>
		    <TD>  <INPUT TYPE="text" NAME="user_get_pseudo" VALUE="'.$user["user_pseudo"].'" SIZE="20" MAXLENGTH="20"> </TD>
	   	    </TR>	

		    </TR>
		    <TR><TD> Pass: </TD>
		    <TD> <INPUT TYPE="password" NAME="user_get_pass" VALUE="" SIZE="20" MAXLENGTH="20"> </TD>
		    </TR>

		    <TR><TD> Re Pass: </TD>
		    <TD> <INPUT TYPE="password" NAME="user_get_verif_pass" VALUE="" SIZE="20" MAXLENGTH="20"> </TD>
		    </TR>

		    <TR><TD> Mail: </TD>
		    <TD> <INPUT TYPE="text" NAME="user_get_mail" VALUE="'.$user["user_mail"].'" SIZE="50" MAXLENGTH="50"> </TD>
		    </TR>

    		    <TR><TD> Tel: </TD>
		    <TD> <INPUT TYPE="text" NAME="user_get_tel" VALUE="'.$user["user_tel"].'" SIZE="10" MAXLENGTH="10"> </TD>
		    </TR>

		    <TR><TD> Date: </TD>
		    <TD> <INPUT TYPE="text" NAME="user_get_date" VALUE="'.$user["user_date"].'" SIZE="8" MAXLENGTH="10"> </TD>
		    </TR>


		    <TR><TD>Right:</TD>
		    <TD>
		    <TABLE CELLSPACING"0" CELLPADDING="1" BORDER="0">
			    <TR> <TD>
			    <SELECT name="user_get_right">
			    <option value="1" '.$opt=get_selected_option(1,$user["user_right"]).'>Basic
			    <option value="2" '.$opt=get_selected_option(2,$user["user_right"]).'>Guest
			    <option value="4" '.$opt=get_selected_option(4,$user["user_right"]).'>Epi Register
			    <option value="5" '.$opt=get_selected_option(5,$user["user_right"]).'>Reporter
			    <option value="6" '.$opt=get_selected_option(6,$user["user_right"]).'>Private Guest
			    <option value="7" '.$opt=get_selected_option(7,$user["user_right"]).'>EPTv Member
			    </SELECT>
			    </TD></TR>
		    </TABLE>
		    </TD>
		    </TR>

		    <TR><TD>Signature: </TD>
		    <TD> <TEXTAREA rows="3" cols="38" name="user_get_signature" ONFOCUS="">'.$user["user_signature"].'</textarea> </TD>
		    </TR>
    
		    <TR><TD>Happy Comment: </TD>
		    <TD>
		    <TEXTAREA rows="3" cols="38" name="user_get_comment" ONFOCUS="">'.$user["user_comment"].'</textarea>
		    </TD>
		    </TR>


	    </TD>
	    </TR>

	    <TR>
	    <TD> </TD>
	    <TD> <INPUT class="button" TYPE="submit" NAME="action" VALUE="  UPDATE  "> </TD>
	    </TR>
	    <TR>
	    <TD> </TD>
	    <TD> <INPUT class="button" TYPE="reset" NAME="action" VALUE=" RESET "> </TD>
	    </TR>
 
    	</TABLE>
	</FORM>
	</TR>
   </TABLE>
   </TD>
   </TR>
</TABLE>
 
';

return $str;
}

function	dispAdminDelUser() {

  $element_id =$_GET['element_id'];

  $result = getOneUserById($element_id);

$str = '		
<table width="80%" border="0" cellspacing="0" cellpadding="0">
	<tr>
	<td bgcolor="#000000">
	<table width="100%" border="0" cellspacing="1" cellpadding="2">
		<tr>
		<td>
			<b>
			<font color="#ffffff">
			&nbsp d e l e t e &nbsp u s e r
			</font>
			</b> 
		</td>
		</tr>					
	<tr>
Seblu's avatar
Seblu committed
	<td bgcolor="#303030">
Seblu's avatar
Seblu committed
	<table cellpadding="0" cellspacing="0" width="100%">
		<tr>	
	';

	  if (mysql_num_rows($result)){
	    $user = mysql_fetch_array($result);    
	  }

	  $str .= '
	    <form name="saisie" method="post" action="index.php?section=AdminHome&section_admin=DelUser&element_id='.$element_id.'">
	    <TABLE CELLSPACING="0" CELLPADDING="10" BORDER="0">
   
		    <TR><TD> Login: </TD>
		    <TD>'.$user["user_login"].'</TD>
		    </TR>
    
		    <TR><TD> Pseudo: </TD>
		    <TD>
		     ' .$user["user_pseudo"].'
		    </TD>
		    </TR>

		    <TR><TD> Pass: </TD>
		    <TD>
		     ' .$user["user_pass"].'
		    </TD>
		    </TR>

		    <TR><TD> Mail: </TD>
		    <TD>
		     ' .$user["user_mail"].'
		    </TD>
		    </TR>

		    <TR><TD> Tel: </TD>
		    <TD>
		     ' .$user["user_tel"].'
		    </TD>
		    </TR>

		    <TR><TD> Date: </TD>
		    <TD>
		     ' .$user["user_date"].'
		    </TD>
		    </TR>

		    <TR><TD> Statut: </TD>
		    <TD>
		     ' .$user["user_statut"].'
		    </TD>
		    </TR>

		    <TR><TD> Right: </TD>
		    <TD>
		     ' .$user["user_right"].'
		    </TD>
		    </TR>

		    <TR><TD> Signature: </TD>
		    <TD>
		     ' .$user["user_signature"].'
		    </TD>
		    </TR>

		    <TR><TD> Comment: </TD>
		    <TD>
		     ' .$user["user_comment"].'
		    </TD>
		    </TR>

		    <TR>
		    <TD> </TD>
		    <TD> <INPUT class="button" TYPE="submit" NAME="action" VALUE="  SUPPRIMER  "> </TD>
		    </TR>  
    	</TABLE>
	</FORM>
	</TR>
   </TABLE>
   </TD>
   </TR>
</TABLE>

';

return $str;
}





?>