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 (0705) :  /home/logmcpe/www/TEST/../MCPRO/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/logmcpe/www/TEST/../MCPRO/aaa2.php
<?php
include_once 'code/init.php';
print_header ();
?>
<script language="javascript" type="text/javascript">

function check()
  {
  var id = document.client_form.client_id.value; 
  // alert(document.client_form.meme[0].value);
  window.location = "aaa2.php?adr=ok&client_id="+id;
	  // if(document.client_form.meme.value == oui)
	  // {
		// alert('ok');
	  // }
  }
  

</script>
<?php
function get_bureau_drop_down($name = '', $param = '', $value ='', $choose = 'auto')
{
	global $agence ;
	if(!is_array($value))
	$value = array($value) ;
	$ret = "<select onchange='GetIdBureau()'; name=\"$name\" $param>".((in_array('', $value) || in_array('0', $value)) && count($value) == 1 && $choose == 'auto' || $choose === true ? '<option value="" selected  style="font-weight:bold"></option>' : '') ;
	$q = dbi_query("SELECT * FROM bureau WHERE agence_id=".$agence." ORDER BY nom_agence") ;
	while($res = dbi_fetch_row($q)) {
		$ret .= sprintf('<option value="%s"%s>%s </option>', $res['id_bureau'], in_array($res['id_bureau'], $value) ? ' selected' : '', $res['nom_agence']) ;
	}
	return $ret."</select>" ;
}
// echo '<pre>';
// print_r($_POST);
// echo '</pre>';

if(!empty($_GET['client_id']))
$client_id=$_GET['client_id'];

if ( isset( $_GET['action']) && $_GET['action'] == 'sup' )
{
if (isset( $_GET['id']) && !empty( $_GET['id']))
	dbi_query("DELETE FROM contacts_2 WHERE contact_id = '".$_GET['id']."'") ;
}
	if(!empty($_POST['aad']))
	{
	$nom = strtoupper(getPostValue('nom'));
	$prenom = strtoupper(getPostValue('prenom'));
	$fonction = strtoupper(getPostValue('fonction'));
	$tel1 = getPostValue('tel1');
	$tel2 = getPostValue('tel2');
	$mail = getPostValue('mail');
dbi_query ( "INSERT INTO contacts_2 ( contact_id ,	client_id ,	agence_id ,	nom ,	prenom ,	fonction ,	tel1 ,	tel2 ,	mail ) 
	VALUES ('', '$client_id', '$agence', '$nom', '$prenom', '$fonction', '$tel1', '$tel2', '$mail')");
	
	}

if( isset($_POST['client_id'])  && !empty($_POST['client_id']) )
{
	$client_agence = getPostValue('client_agence');
	$Client_ID=$_POST['client_id'];
	$client_nom=getPostValue('client_nom');
	$client_adr1 = ucwords(strtolower(getPostValue('client_adr1')));
	$client_adr2 = ucwords(strtolower(getPostValue('client_adr2')));
	$client_adr3 = ucwords(strtolower(getPostValue('client_adr3')));
	$client_cp = getPostValue('client_cp');
	$client_ville = strtoupper(getPostValue('client_ville'));
	$client_telport1 = getPostValue('client_telport1');
	$client_teldom = getPostValue('client_teldom');
	$client_bureau=getPostValue('id_bureau');
	
	switch ($_POST['statut']) {
    case 'ca':
    $client_actif = 0;
	$client_prospect = 0;
        break;
    case 'ci':
    $client_actif = 1;
	$client_prospect = 0;
        break;
    case 'pa':
    $client_actif = 0;
	$client_prospect = 1;
        break;
    case 'pi':
    $client_actif = 1;
	$client_prospect = 1;
        break;	
}

	$Nom_chantier = strtoupper(getPostValue('nom_chantier'));
	$Adresse1_Chantier = ucwords(strtolower(getPostValue('adr1_chantier')));
	$Adresse2_Chantier = ucwords(strtolower(getPostValue('adr2_chantier')));
	$Adresse3_Chantier = ucwords(strtolower(getPostValue('adr3_chantier')));
	$CodePostal_Chantier = getPostValue('cp_chantier');
	$Ville_Chantier = strtoupper(getPostValue('ville_chantier'));
	$Tel_Chantier = getPostValue('tel_chantier');
	$Fax_Chantier = getPostValue('fax_chantier');
	$chantier_meme_adr = getPostValue('meme');

	dbi_query ("UPDATE ".TABLE_CLIENT." SET client_nom="."'$client_nom'".", client_pnom="."'$client_pnom'".", client_contact="."'$client_contact'"." , 
	client_adr1="."'$client_adr1'"." , client_adr2="."'$client_adr2'"." , client_adr3="."'$client_adr3'"." , client_cp="."'$client_cp'"." , 
	client_ville="."'$client_ville'"." ,client_telport1="."'$client_telport1'"." , client_teldom="."'$client_teldom'"." ,client_agence="."'$client_bureau'".",client_bureau="."'$client_bureau'".", client_actif='".$client_actif."', client_prospect='".$client_prospect."' WHERE  client_id = $Client_ID" 	  );
	
		if(!empty($_POST['chantier_id']))
	{
	$Chantier_ID=$_POST['chantier_id'];
	dbi_query ("UPDATE ".chantier." SET Nom_chantier="."'$Nom_chantier'"." , Adresse1_Chantier="."'$Adresse1_Chantier'"." , Adresse2_Chantier="."'$Adresse2_Chantier'"." , Adresse3_Chantier="."'$Adresse3_Chantier'"." , CodePostal_Chantier="."'$CodePostal_Chantier'"." ,Ville_Chantier="."'$Ville_Chantier'"." , Tel_Chantier="."'$Tel_Chantier'"." ,Fax_Chantier="."'$Fax_Chantier'"." , chantier_meme_adr ="."'$chantier_meme_adr'"."   , agence_id="."'$agence'"." where Chantier_ID="."'$Chantier_ID'"." and Client_ID=$client_id");
	}
	else{
	dbi_query ( "INSERT INTO ".chantier." ( `Client_ID` , `Nom_chantier` , `Adresse1_Chantier` , `Adresse2_Chantier` , `Adresse3_Chantier` , `CodePostal_Chantier` , `Ville_Chantier` , `Tel_Chantier` ,`Fax_Chantier` , `agence_id`) 
	VALUES (	'$client_id', '$Nom_chantier', '$Adresse1_Chantier', '$Adresse2_Chantier', '$Adresse3_Chantier', '$CodePostal_Chantier', '$Ville_Chantier', '$Tel_Chantier', '$Fax_Chantier',  '$agence')");
	}

	
}



$client = $client_id ? dbi_fetch_row(dbi_query("SELECT * FROM ".TABLE_CLIENT.",agence a WHERE client_id = $client_id")) : array() ;
if(isset($_GET['adr'])) 
{
$Client_ID=$_GET['client_id'];
$Nom_chantier=$client['client_nom'];
if(!empty($client['client_pnom'])) 
$Nom_chantier.=' '.$client['client_pnom'];

$Adresse1_Chantier = $client['client_adr1'] ;
$Adresse2_Chantier = $client['client_adr2'] ;
$Adresse3_Chantier = $client['client_adr3'] ;
$CodePostal_Chantier = $client['client_cp'] ;
$Ville_Chantier = $client['client_ville'];
$Tel_Chantier = $client['client_telport1'] ;
$Fax_Chantier = $client['client_teldom'] ;
$chantier_meme_adr = 1 ;


dbi_query ("UPDATE ".chantier." SET Nom_chantier="."'$Nom_chantier'"." , Adresse1_Chantier="."\"$Adresse1_Chantier\""." , Adresse2_Chantier="."\"$Adresse2_Chantier\""." , Adresse3_Chantier="."\"$Adresse3_Chantier\""." , CodePostal_Chantier="."'$CodePostal_Chantier'"." ,Ville_Chantier="."'$Ville_Chantier'"." , Tel_Chantier="."'$Tel_Chantier'"." ,Fax_Chantier="."'$Fax_Chantier'"." , chantier_meme_adr ="."'$chantier_meme_adr'"." where Client_ID=$Client_ID");


}
$client = $client_id ? dbi_fetch_row(dbi_query("SELECT * FROM ".TABLE_CLIENT.",agence a WHERE client_id = $client_id")) : array() ;
$chantier = $client_id ? dbi_fetch_row(dbi_query("SELECT * FROM ".chantier." WHERE client_id = $client_id")) : array() ;

$client_bureau=$client['client_bureau'];
$client_actif = $client['client_actif'];
$client_prospect = $client['client_prospect'];
if($client_prospect==0 && $client_actif==0)
$satut='ca';
elseif($client_prospect==0 && $client_actif==1)
$satut='ci';
elseif($client_prospect==1 && $client_actif==0)
$satut='pa';
elseif($client_prospect==1 && $client_actif==1)
$satut='pi';

?>


<table width=95% style="margin:0 auto;"    height="500px">
<tr>
<td style="padding: 2px 26px 2px 0px; " valign="top"  width="50%">
 <div id="sb" valign="top"  style=" cursor: move; position: relative; top: 0px;  height: 100%;" >
<form  method="post" action="" name="client_form"> 
<input type="hidden" name="client_id" value="<?=$client_id?>">
<input type="hidden" name="chantier_id" value="<?=$chantier['Chantier_ID']?>">
   <h3>FACTURATION</h3>
   <table width=100% >
	   <tr>
	   <td class="tdl"><label for="login_username" >Bureau</label></td>
			<td class="tdl">	<?=get_bureau_drop_down('id_bureau', 'id="id_bureau"', $client_bureau)?></td>
			<td class="tdl"><label for="login_username" >Statut</label></td>
			<td class="tdl">	 <SELECT name="statut">
		<OPTION <?php if($satut=='ca') echo 'SELECTED'; ?> VALUE="ca">Client Actif </OPTION>
		<OPTION <?php if($satut=='pa') echo 'SELECTED'; ?> VALUE="pa">Prospect Actif </OPTION>
		<OPTION <?php if($satut=='ci') echo 'SELECTED'; ?> VALUE="ci">Client Inactif </OPTION>
		<OPTION <?php if($satut=='pi') echo 'SELECTED'; ?> VALUE="pi">Prospect Inactif </OPTION>

	</SELECT></td>			
	   </tr>
	   
   <tr>
<td class="tdl"><label for="login_username" >Soci�t� : </label></td>
<td colspan="3" class="tdl"><input type="text" name="client_nom" id="client_nom" value="<?=$client['client_nom'];if(!empty($client['client_pnom'])) echo ' '.$client['client_pnom']?>" class="field required"   /></td>
   </tr>
   <tr>
<td class="tdl"><label for="login_username" >Adresse facturation 1 :</label></td>
<td colspan="3" class="tdl" ><input type="text" name="client_adr1" id="client_adr1" class="field required" value="<?=$client['client_adr1']?>" size="100" maxlength="250"  /></td>
   </tr>
   <tr>
<td class="tdl"><label for="login_username" >Adresse facturation 2 :</label></td>
<td colspan="3" class="tdl"><input type="text" name="client_adr2" id="client_adr2" class="field required" value="<?=$client['client_adr2']?>" size="100" maxlength="250" /></td>
   </tr>
   <tr>
<td class="tdl"><label for="login_username" >Adresse facturation 3 :</label></td>
<td colspan="3" class="tdl"><input type="text" name="client_adr3" id="client_adr3" class="field required" value="<?=$client['client_adr3']?>" size="100" maxlength="250" /></td>
   </tr>
   <tr>
<td class="tdl"><label for="login_username" >CP :</label></td>
<td class="tdl"><input type="text" name="client_cp" id="client_cp" value="<?=$client['client_cp']?>" class="field required" /></td>
<td class="tdl"><label for="login_username" >Ville :</label></td>
<td class="tdl"><input type="text" name="client_ville" id="client_ville" value="<?=$client['client_ville']?>" class="field required"  /></td>
   </tr> 
   <tr>
<td class="tdl"><label for="login_username" >Tel :</label></td>
<td class="tdl"><input type="text" name="client_telport1" id="client_telport1" value="<?=$client['client_telport1']?>" class="field required"  /></td>
<td class="tdl"><label for="login_username" >Fax :</label></td>
<td class="tdl"><input type="text" name="client_teldom" id="client_teldom" value="<?=$client['client_teldom']?>" class="field required"  /></td>
   </tr>    
   </table>

</div>
</td>
<td style="padding: 2px 16px 2px 10px; " width="50%" valign="top" >
 <div id="sb" valign="top"  style=" cursor: move; position: relative; top: 0px;  height: 100%;" >

   <h3>PRESTATION</h3>
   <table width=100% >
	   <tr>
<td class="tdl"><SELECT name="hide" style="visibility: hidden">	</SELECT></td>
<td colspan="3" class="tdl" style="text-align:center">
<input type="radio" name="meme" onclick="check()" value="1" <?php if($chantier['chantier_meme_adr'] == '1') echo "CHECKED";?>> M�me adresse
<input type="radio" name="meme" value="0" <?php if($chantier['chantier_meme_adr'] != '1') echo "CHECKED";?>> Adresse diff�rente </td>
	   </tr>
	   
   <tr>
<td class="tdl"><label for="login_username" >Soci�t� : </label></td>
<td colspan="3" class="tdl"><input type="text" name="nom_chantier" id="nom_chantier" value="<?=$chantier['Nom_chantier'];?>" class="field required"   /></td>
   </tr>
   <tr>
<td class="tdl"><label for="login_username" >Adresse prestation 1 :</label></td>
<td colspan="3" class="tdl"><input type="text" name="adr1_chantier" id="adr1_chantier" value="<?=$chantier['Adresse1_Chantier'];?>" class="field required" size="100" maxlength="250"  /></td>
   </tr>
   <tr>
<td class="tdl"><label for="login_username" >Adresse prestation 2 :</label></td>
<td colspan="3" class="tdl"><input type="text" name="adr2_chantier" id="adr2_chantier" value="<?=$chantier['Adresse2_Chantier'];?>" class="field required" size="100" maxlength="250" /></td>
   </tr>
   <tr>
<td class="tdl"><label for="login_username" >Adresse prestation 3 :</label></td>
<td colspan="3" class="tdl"><input type="text" name="adr3_chantier" id="adr3_chantier" value="<?=$chantier['Adresse3_Chantier'];?>" class="field required" size="100" maxlength="250" /></td>
   </tr>
   <tr>
<td class="tdl"><label for="login_username" >CP :</label></td>
<td class="tdl"><input type="text" name="cp_chantier" id="cp_chantier" value="<?=$chantier['CodePostal_Chantier'];?>" class="field required" /></td>
<td class="tdl"><label for="login_username" >Ville :</label></td>
<td class="tdl"><input type="text" name="ville_chantier" id="ville_chantier" value="<?=$chantier['Ville_Chantier'];?>" class="field required"  /></td>
   </tr> 
   <tr>
<td class="tdl"><label for="login_username" >Tel :</label></td>
<td class="tdl"><input type="text" name="tel_chantier" id="tel_chantier" value="<?=$chantier['Tel_Chantier'];?>" class="field required"  /></td>
<td class="tdl"><label for="login_username" >Fax :</label></td>
<td class="tdl"><input type="text" name="fax_chantier" id="fax_chantier" value="<?=$chantier['Fax_Chantier'];?>" class="field required"  /></td>
   </tr>    
   </table>

</div>


</td>

</tr>
<tr><td width="50%"></td><td width="50%"><input name="valider" type="submit" value="Modifier" style="float:right;margin-right:0px;margin-top:40px;" class="blubutton"  /></td></tr>
</table>
<br/><br/><br/>
 
</form>
<div id="tab"  >
	<table \>
	<caption style="font-weight:bold"> Contacts <caption> 
		<tr>
			<th style="text-align:center;">Nom</th>
			<th style="text-align:center;">Prenom</th>
		    <th style="text-align:center;">Fonction</th>		
			<th style="text-align:center;">Tel1</th>
			<th style="text-align:center;">Tel2</th>
			<th style="text-align:center;">Mail</th>
			<th style="text-align:center;">Action</th>			
			
		</tr>
<?php 
$c = dbi_query("SELECT * FROM contacts_2 WHERE agence_id=$agence AND client_id = $client_id") ;
while($cc=dbi_fetch_row($c)){ 
?>		
		<tr>
			<td><b><?=$cc['nom']?></b></td>
			<td><b><?=$cc['prenom']?></b></td>
			<td><b><?=$cc['fonction']?></b></td>
			<td><b><?=$cc['tel1']?></b></td>
			<td><b><?=$cc['tel2']?></b></td>
			<td><b><?=$cc['mail']?></b></td>
			<td align="center"><a rel="{handler:'iframe',size:{x:700,y:480}}" class="modal" href="cont.php?action=edit&id=<?=$cc['contact_id'];?>"><img src="images/edit.png" alt="edit" /></a>
			

			
			<a href="aaa2.php?action=sup&id=<?=$cc['contact_id'];?>&client_id=<?=$client_id;?>" ><img src="images/sup.png" alt="sup" /></a>
			</td>			
			
		</tr>
<?php } ?>		
	</table>
	</div>
	    <a rel="{handler:'iframe',size:{x:700,y:480}}" class="modal" href="cont.php?action=new&client_id=<?=$client_id;?>">
<input name="Ajouter un contact" type="button" value="Ajouter un contact" style="float:left;margin-left:100px;margin-top:40px;" class="blubutton"  />
		</a>




</body>
</html>

AnonSec - 2021