| Server IP : 167.99.254.82 / Your IP : 216.73.216.231 Web Server : Apache System : Linux host.techisquad.com 5.15.0-187-generic #197-Ubuntu SMP Fri Jul 17 19:17:01 UTC 2026 x86_64 User : pawluxera ( 1011) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/factures/public_html/ |
Upload File : |
<?php
session_start();
if (!isset($_SESSION['compte_user']))
{
header('Location: erreur_surfing.html');
exit();
}
if (!isset($_SESSION['r_facture']))
{
header('Location: Factures.php');
exit();
}
$link = mysqli_connect("localhost", "advery", "EoM6IJlnirGIfcu","factures") or die("Impossible de se connecter : " . mysqli_error());
$retour =mysqli_query($link,'SELECT MAX(id_contrat) AS nbMax FROM contrat');
$valeur = mysqli_fetch_assoc($retour);
$a = $valeur['nbMax'];
$a ++ ;
$year = date("y");
$x ='C0'.$year.'/'.$a.' [ Facture : '.$_SESSION['r_facture'].' ]';
$_SESSION['r_contrat'] = $x;
$b = date('H:i');
$c = date('d-m-Y');
$dt = $c . ' [ '. $b . ' ]';
// Facture -> Client
$repd = "select * from factures where ref_facture = '$_SESSION[r_facture]';";
$execd = mysqli_query($link,$repd);
$numd = mysqli_fetch_assoc($execd);
$clt = $numd['ref_client'];
$fullyear = date("Y");
//Ajout Contrat
$reponse = "INSERT INTO contrat VALUES(id_contrat ,'$x' , $clt ,'$_POST[date_fac]' , 'Valide','$_SESSION[r_facture]',$fullyear);";
mysqli_query($link,$reponse);
//Notification
$reponse = "select * from comptes_user where id_clt = $_SESSION[compte_user] ;";
$exec =mysqli_query($link,$reponse);
$row = mysqli_fetch_assoc($exec);
$a = $row['nom'].' vient de creer un nouveau Contrat : '.$x.'. Source = Facture'.' Clt = '.$clt.' Date = '.$_POST['date_fac'];
$reponse = "INSERT INTO notification VALUES(id_notif ,'dripicons-user-group','$a' ,'$dt', 'ADMIN');";
mysqli_query($link,$reponse);
unset($_SESSION['r_devis']);
header('Location: Select_contrat.php?aux='.$x);
exit();
mysql_close($link);
?>