|
Server IP : 10.128.40.6 / Your IP : 216.73.216.233 Web Server : Apache System : Linux webd006.cluster128.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : logmcpe ( 111175) PHP Version : 7.3.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/logmcpe/www/TMCPRO/pages/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<!DOCTYPE html>
<?php
// echo "bbb <br/>" ;
// exit() ;
include 'includes/config_tmcpro.php' ;
include 'includes/stable_functions_tmcpro.php' ;
// list($inter)= dbi_fetch_row(dbi_query("SELECT * FROM intervenant WHERE inter_id = 123 ")) ;
// ini_set('display_errors','on');
// error_reporting(E_ALL);
if($_GET['sup']== 1)
{
dbi_query("DELETE FROM `users`
WHERE user_id =".$_GET['user_id']) ;
header('Location:users.php?msg= utilisateur bien supprimer &color=success');
// echo "<pre>" ;
// print_r($_GET) ;
// echo "</pre>" ;
// echo "bbb <br/>" ;
// exit() ;
}
if(!empty($_POST) and isset($_POST['Enregistrer']))
{
// echo "<pre>" ;
// print_r($_POST) ;
// echo "</pre>" ;
// echo "bbb <br/>" ;
// echo "<pre>" ;
// print_r($_FILES);
// echo "</pre>" ;
// exit() ;
// $salarie_absence_date_debuta= dateMCPROint($_POST['salarie_absence_date_debut']) ;
// $salarie_absence_date_fina= dateMCPROint($_POST['salarie_absence_date_fin']) ;
$target_dir = "photo_user/";
// $nouveaunom = uniqid(basename($_FILES['name']));
list($user_id) = dbi_fetch_row(dbi_query("SELECT max(`user_id`) FROM `users` WHERE 1"));
$user_id = $user_id + 1 ;
$target_file = $target_dir . basename($user_id).".PNG";
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
move_uploaded_file($_FILES["file"]["tmp_name"], $target_file) ;
$user_nom=$_POST['user_nom'] ;
$user_prenom=$_POST['user_prenom'] ;
$user_email=$_POST['user_email'] ;
$user_password=$_POST['user_password'] ;
$user_statut=$_POST['user_statut'] ;
dbi_query(" INSERT INTO users (
user_nom,
user_prenom,
user_email,
user_password,
user_statut,
user_photo)
VALUES (
'$user_nom',
'$user_prenom',
'$user_email',
'$user_password',
$user_statut,
'$target_file'
)") ;
header('Location:users.php?msg= utilisateur bien ajouter &color=success');
}
if(!empty($_GET['user_id']) and isset($_POST['Modifier']))
{
$user_id = $_GET['user_id'] ;
$target_dir = "photo_user/";
// $nouveaunom = uniqid(basename($_FILES['name']));
// list($user_id) = dbi_fetch_row(dbi_query("SELECT max(`user_id`) FROM `users` WHERE 1"));
// $user_id = $user_id + 1 ;
$target_file = $target_dir . basename($user_id).".PNG";
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
move_uploaded_file($_FILES["file"]["tmp_name"], $target_file) ;
$user_nom=$_POST['user_nom'] ;
$user_prenom=$_POST['user_prenom'] ;
$user_email=$_POST['user_email'] ;
$user_password=$_POST['user_password'] ;
$user_statut=$_POST['user_statut'] ;
$etat=$_POST['etat'] ;
// UPDATE table
// SET colonne_1 = 'valeur 1', colonne_2 = 'valeur 2', colonne_3 = 'valeur 3'
// WHERE condition
dbi_query(" UPDATE users SET
user_prenom = '$user_prenom',
user_email = '$user_email',
user_password = '$user_password',
user_statut = '$user_statut',
user_nom = '$user_nom' ,
user_photo = '$target_file',
etat = '$etat'
where user_id = $user_id
") ;
header('Location:users.php?msg= Utilisateur bien modifier &color=success');
}
// echo "==> $inter " ;
?>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Enregistrer le titre de la page --><title> LogMCPRO | Etablissements</title>
<!-- Tell the browser to be responsive to screen width -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Font Awesome -->
<link rel="stylesheet" href="../plugins/fontawesome-free/css/all.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<!-- overlayScrollbars -->
<link rel="stylesheet" href="../dist/css/adminlte.min.css">
<!-- Google Font: Source Sans Pro -->
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
</head>
<body class="hold-transition sidebar-mini">
<!-- Site wrapper -->
<div class="wrapper">
<!-- TOP MENU -->
<nav class="main-header navbar navbar-expand navbar-white navbar-light">
<!-- Menu extensible -->
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" data-widget="pushmenu" href="#"><i class="fas fa-bars"></i></a>
</li>
<!-- liens TOP MENU GAUCHE-->
</ul>
<!-- liens TOP MENU DROITE -->
<ul class="navbar-nav ml-auto">
<!-- Placer ici l'élément à positionner à droite du TOP MENU -->
</ul>
</nav> <!-- fin du TOP MENU -->
<!-- BARRE DE NAVIGATION -->
<?php include('menu.php'); ?>
<!-- Ne pas toucher au dessus / fin de la BARRE DE NAVIGATION-->
<!-- DEMARRAGE DE LA PAGE PRINCIPALE -->
<div class="content-wrapper">
<!-- TITRE DE LA PAGE PRINCIPALE A PLACE ENTRE LES BALISES H1 & ARBORESCENCE SUR LA DROITE-->
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1></h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
</ol>
</div>
</div>
</div><!-- /.container-fluid -->
</section>
<!-- FIN DU TITRE DE LA PAGE PRINCIPALE A PLACE ENTRE LES BALISES H1 & ARBORESCENCE SUR LA DROITE-->
<?php
$q= dbi_query("SELECT * FROM users") ;
$red = NULL ;
if(!empty($_GET['user_id']))
{
$red= dbi_fetch_row(dbi_query("SELECT * FROM users where user_id = ".$_GET['user_id'])) ;
$document_emplacement = $red['user_photo'];
}
?>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<?php
if(isset($_GET["msg"])){
?>
<div class="alert alert-<?php echo $_GET["color"]; ?> alert-dismissible col-12" role="alert">
<strong><?php echo $_GET["color"].': '; ?></strong><?php echo $_GET["msg"]; ?>.
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<?php
}
?>
<div class="row">
<div class="col-sm-11"><h3 class="card-title"> <i class="nav-icon fas fa-user"></i> LISTE DES UTILISATEURS</h3> </div>
</div>
</div>
<!-- /.card-header -->
<div class="card-body">
<!-- Début du Formulaire -->
<form method="POST" enctype="multipart/form-data" action="" >
<?php
if(!empty($_GET['user_id']))
{
?>
<div class="form-row"> <!-- champs Société -->
<div class="form-group col-md-3">
<label for="user_nom">Nom</label>
<input type="text" class="form-control" id="user_nom" name="user_nom" <?php if(!empty($red['user_nom']) ) echo "value=".$red['user_nom'] ;?> placeholder="Nom" >
</div>
<div class="form-group col-md-3">
<label for="user_prenom">Prénom</label>
<input type="text" class="form-control" id="user_prenom" name="user_prenom" <?php if(!empty($red['user_prenom']) ) echo "value=".$red['user_prenom'] ;?> placeholder="Prénom">
</div>
<div class="form-group col-md-3"><!-- Fax -->
<div class="form-group">
<label for="user_email">E-mail</label>
<input type="email" class="form-control" id="user_email" name="user_email" <?php if(!empty($red['user_email']) ) echo "value=".$red['user_email'] ;?> placeholder="E-mail">
</div>
</div>
<div class="form-group col-md-3"><!-- Liste déroulante statut -->
<label>Statut</label>
<select class="form-control" name="user_statut">
<option value="1" <?php if($red['user_statut'] == 1 ) echo 'selected' ; ?> >Administrateur</option>
<option value="2" <?php if($red['user_statut'] == 2 ) echo 'selected' ; ?> > Utilisateur</option>
<option value="3" <?php if($red['user_statut'] == 2 ) echo 'selected' ; ?> > Chef d'Equipe</option>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<label for="exampleInputFile">Photo<a target="_blank" href="<?php echo $document_emplacement; ?>">(voir ancienne fichier)</a><br> </label>
<div class="input-group">
<div class="custom-file">
<input type="file" class="custom-file-input" name="file">
<label class="custom-file-label" for="exampleInputFile">Choisir....</label>
</div>
<div class="input-group-append">
<span class="input-group-text" id="">Upload</span>
</div>
</div>
</div>
<div class="form-group col-md-3">
<label for="user_password">Mot de passe</label>
<input type="password" class="form-control" name="user_password" id="user_password" <?php if(!empty($red['user_password']) ) echo "value=".$red['user_password'] ;?> placeholder="Mot de passe">
</div>
<div class="form-group col-md-3"><!-- Liste déroulante statut -->
<label>Etat</label>
<select class="form-control" name="etat">
<option value="1" <?php if($red['etat'] == 1 ) echo 'selected' ; ?> >Actif</option>
<option value="2" <?php if($red['etat'] == 2 ) echo 'selected' ; ?> > Inactif</option>
</select>
</div>
</div>
<?php
}
else
{
?>
<div class="form-row"> <!-- champs Société -->
<div class="form-group col-md-3">
<label for="user_nom">Nom</label>
<input type="text" class="form-control" id="user_nom" name="user_nom" <?php if(!empty($red['user_nom']) ) echo "value=".$red['user_nom'] ;?> placeholder="Nom" >
</div>
<div class="form-group col-md-3">
<label for="user_prenom">Prénom</label>
<input type="text" class="form-control" id="user_prenom" name="user_prenom" <?php if(!empty($red['user_prenom']) ) echo "value=".$red['user_prenom'] ;?> placeholder="Prénom">
</div>
<div class="form-group col-md-3"><!-- Fax -->
<div class="form-group">
<label for="user_email">E-mail</label>
<input type="email" class="form-control" id="user_email" name="user_email" <?php if(!empty($red['user_email']) ) echo "value=".$red['user_email'] ;?> placeholder="E-mail">
</div>
</div>
<div class="form-group col-md-3"><!-- Liste déroulante statut -->
<label>Statut</label>
<select class="form-control" name="user_statut">
<option value="1" <?php if($red['user_statut'] == 1 ) echo 'selected' ; ?> >Administrateur</option>
<option value="2" <?php if($red['user_statut'] == 2 ) echo 'selected' ; ?> > Utilisateur</option>
<option value="3" <?php if($red['user_statut'] == 2 ) echo 'selected' ; ?> > Chef d'Equipe</option>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<label for="exampleInputFile">Photo</label>
<div class="input-group">
<div class="custom-file">
<input type="file" class="custom-file-input" name="file">
<label class="custom-file-label" for="exampleInputFile">Choisir....</label>
</div>
<div class="input-group-append">
<span class="input-group-text" id="">Upload</span>
</div>
</div>
</div>
<div class="form-group col-md-3">
<label for="user_password">Mot de passe</label>
<input type="password" class="form-control" name="user_password" id="user_password" <?php if(!empty($red['user_password']) ) echo "value=".$red['user_password'] ;?> placeholder="Mot de passe">
</div>
<div class="form-group col-md-3"><!-- Liste déroulante statut -->
<label>Etat</label>
<select class="form-control" name="etat">
<option value="1" <?php if($red['etat'] == 1 ) echo 'selected' ; ?> >Actif</option>
<option value="2" <?php if($red['etat'] == 2 ) echo 'selected' ; ?> > Inactif</option>
</select>
</div>
</div>
<?php
}
if(!empty($red['user_id']))
{
?>
<input type="hidden" name="user_id" value="<?php echo $red['user_id'] ; ?>">
<button type="submit" name="Modifier" class="btn btn-primary">Modifier</button>
<?php
}
else
{
?>
<button type="submit" name="Enregistrer" class="btn btn-primary">Enregistrer</button>
<?php
}
?>
</form>
<br/>
<!-- Fin du Formulaire -->
<!-- Fin du Contenu de la Card Principale Ne pas toucher au Div en dessous-->
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th>Nom</th> <!-- /.Table Client - Champs client_nom -->
<th>Prénom</th> <!-- /.Table Client - Champs client_adr1 -->
<th>E-mail</th> <!-- /.Table Client - Champs client_cp -->
<th>Mot de passe</th>
<th>Statut</th>
<th>Etat</th>
<th>Editer</th>
<!-- /.Table Client - Champs client_ville -->
</tr>
</thead>
<tbody>
<?php
while($cl=dbi_fetch_row($q))
{
?>
<tr>
<td><?php echo $cl['user_nom'] ; ?></td>
<td><?php echo $cl['user_prenom'] ; ?></td>
<td><?php echo $cl['user_email'] ; ?></td>
<td><?php echo $cl['user_password'] ; ?></td>
<td><?php if($cl['user_statut'] == 1 ) {echo "Administrateur" ;}
if($cl['user_statut'] == 2 ) {echo "Utilisateur" ;}
if($cl['user_statut'] == 3 ) {echo "Chef d'Equipe" ;}
?></td>
<td><?php if($cl['etat'] == 1 ) {echo "Actif" ;} else { echo "Inactif" ;} ?></td>
<td align="center">
<a class="btn btn-primary btn-sm" target="_blank" href="<?php echo $cl['user_photo'];?>"><i class="fas fa-file">
</i>
</a>
<a class="btn btn-info btn-sm" href="users.php?user_id=<?=$cl['user_id']?>&">
<i class="fas fa-pencil-alt"></i>
</a>
<a class="btn btn-danger btn-sm" href="users.php?user_id=<?=$cl['user_id']?>&sup=1" onclick="return confirm('Voulez-vous vraiment supprimer ce utilisateur ?');">
<i class="fas fa-trash">
</i>
</a>
</td>
</tr>
<?php
}
?>
</tbody>
<tfoot>
<tr>
<th>Nom</th> <!-- /.Table Client - Champs client_nom -->
<th>Prénom</th> <!-- /.Table Client - Champs client_adr1 -->
<th>E-mail</th> <!-- /.Table Client - Champs client_cp -->
<th>Mot de passe</th>
<th>Statut</th>
<th>Editer</th>
</tr>
</tfoot>
</table>
</div>
<!-- /.card-body -->
</div>
<!-- /.card -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</section>
<!-- /.content -->
</div>
<!-- NE PAS TOUCHER AU DESSUS DESSOUS -->
<!-- DEBUT DU PIED DE PAGE -->
<footer class="main-footer">
<div class="float-right d-none d-sm-block">
<b>Version</b> 3.0.1
</div>
<strong>Copyright © 2019 MCPRO</strong>
</footer>
<!-- FIN DU PIED DE PAGE -->
<!-- NE PAS TOUCHER CI-DESSOUS -->
<!-- Control Sidebar -->
<aside class="control-sidebar control-sidebar-dark">
<!-- Control sidebar content goes here -->
</aside>
<!-- /.control-sidebar -->
</div>
<!-- ./wrapper -->
<!-- jQuery -->
<script src="../plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="../plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE App -->
<script src="../dist/js/adminlte.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="../dist/js/demo.js"></script>
<script src="../../plugins/bs-custom-file-input/bs-custom-file-input.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
bsCustomFileInput.init();
});
</script>
</body>
</html>
