isset($_POST['dependance']) && $_POST['dependance'] != '' ? $dependance = trim($_POST['dependance']) : ($dependance = '');
        //SQL
        $sql = "UPDATE `groupelocalite` SET `ID_GRPLOC`='" . addslashes($codegrplocalite) . "' ,`GRPLOC_LIBELLE`='" . addslashes($grplocalite) . "' ,`GRPLOC_LIEN`='" . addslashes($dependance) . "'  WHERE ID_GRPLOC LIKE '" . addslashes($oldcodegrplocalite) . "'";
        try {
            $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
            //Connexion to database
        } catch (PDOException $error) {
            //Treat error
            //("Erreur de connexion : " . $error->getMessage() );
            header('location:errorPage.php');
        }
        $query = $cnx->prepare($sql);
        //Prepare the SQL
        $query->execute();
        //Execute prepared SQL => $query
        updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Ajout d\'un type de localité (' . $codegrplocalite . ', ' . $grplocalite . ')');
        //updateLog($username, $idcust, $action='' )
        header('location:grplocalite.php?selectedTab=par&rst=1');
        break;
    default:
        ///Nothing
        //header('location:../index.php');
}
isset($_POST['myaction']) && $_POST['myaction'] != '' ? $myaction = $_POST['myaction'] : ($myaction = '');
switch ($myaction) {
    case 'edit':
        isset($_POST['rowSelection']) ? $id = $_POST['rowSelection'][0] : ($id = '');
        $split = preg_split('/ /', $id);
        try {
            $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
            //Connexion to database
     try {
         $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
         //Connexion to database
     } catch (PDOException $error) {
         //Treat error
         //("Erreur de connexion : " . $error->getMessage() );
         header('location:errorPage.php');
     }
     //TRANSFERT
     $sql = "UPDATE `transfert` SET  TRS_VALIDE=2 WHERE `ID_TRANSFERT` = '" . addslashes($xid) . "';\r\n\t\tUPDATE mouvement SET MVT_VALID=2 WHERE (MVT_NATURE LIKE 'TRANSFERT SORTANT' OR MVT_NATURE LIKE 'TRANSFERT ENTRANT')\r\n\t\tAND ID_SOURCE='" . addslashes($xid) . "';";
     $query = $cnx->prepare($sql);
     //Prepare the SQL
     $query->execute();
     //Execute prepared SQL => $query
     $row = $query->fetch(PDO::FETCH_ASSOC);
     updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Annulation d\'un transfert (' . $xid . ', ' . $reftransfert . ')');
     //updateLog($username, $idcust, $action='' )
     //echo $sql;
     header('location:transfert.php?selectedTab=bds&rst=1');
     break;
 case 'validate':
     isset($_POST['rowSelection']) ? $id = $_POST['rowSelection'][0] : ($id = '');
     $split = preg_split('/@/', $id);
     try {
         $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
         //Connexion to database
     } catch (PDOException $error) {
         //Treat error
         //("Erreur de connexion : " . $error->getMessage() );
         header('location:errorPage.php');
     }
            //Treat error
            //("Erreur de connexion : " . $error->getMessage() );
            header('location:errorPage.php');
        }
        $query = $cnx->prepare($sql);
        //Prepare the SQL
        $query->execute();
        //Execute prepared SQL => $query
        updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Ajout d\'une nature (' . $codenature . ', ' . $nature . ')');
        //updateLog($username, $idcust, $action='' )
        header('location:naturemvt.php?selectedTab=par&rs=1');
        break;
        //Log out user
    //Log out user
    case 'logout':
        updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Déconnexion du système échouée');
        //updateLog($username, $idcust, $action='' )
        header('location:../index.php');
        break;
    default:
        ///Nothing
        header('location:../index.php');
}
/*
switch($myaction){

	case 'ETAPE2':
		$table1 = "stocks_compte";
		$table2 = "stocks_groupe";
		$table3 = "stocks_personnel";
		$table4 = "stocks_exercice";
                $sql = "INSERT INTO `infogenerale` (CODE_INFGLE, CODE_MAGASIN, ID, `INF_CLIENT`, `INF_DATEACQ`, `INF_LICENCE`, `INF_MINISTERE`, `INF_SECRETARIAT`, `INF_DIRECTION`, `INF_SERVICE`,`INF_CSPS`, `INF_PAYS`, `INF_DEVISE`, `INF_VILLE`, `LOGO`,\r\n\t\t\t`INF_SIGNATEUR1`, `INF_NOMSIGNATEUR1`, `INF_SIGNATEUR2`, `INF_NOMSIGNATEUR2`, `INF_SIGNATEUR3`, `INF_NOMSIGNATEUR3`,`INF_SIGNATEUR4`, `INF_NOMSIGNATEUR4`, `INF_VALIDAUTO`, `INF_MAGASIN`)\r\n\t\t\tVALUES ('" . addslashes("{$id}/{$magasin}") . "', '" . addslashes($magasin) . "',  '" . addslashes($id) . "', '" . addslashes($client) . "', '" . addslashes($dateacq) . "', '" . addslashes($licence) . "' , '" . addslashes($ministere) . "' ,'" . addslashes($secretariat) . "' ,\r\n\t\t\t'" . addslashes($direction) . "','" . addslashes($service) . "','" . addslashes($csps) . "','" . addslashes($pays) . "','" . addslashes($devise) . "', '" . addslashes($ville) . "',\r\n\t\t\t'" . addslashes($logo) . "', '" . addslashes($signateur1) . "', '" . addslashes($nomsignateur1) . "', '" . addslashes($signateur2) . "', '" . addslashes($nomsignateur2) . "',\r\n\t\t\t'" . addslashes($signateur3) . "','" . addslashes($nomsignateur3) . "','" . addslashes($signateur4) . "','" . addslashes($nomsignateur4) . "','" . addslashes($validauto) . "','" . addslashes($magasin) . "');";
            }
            try {
                $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
                //Connexion to database
            } catch (PDOException $error) {
                //Treat error
                //("Erreur de connexion : " . $error->getMessage() );
                header('location:errorPage.php');
            }
            $query = $cnx->prepare($sql);
            //Prepare the SQL
            $query->execute();
            //Execute prepared SQL => $query
            //echo  $sql;
            updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Ajout ou modification des paramètres généraux');
            //updateLog($username, $idcust, $action='' )
            header('location:generale.php?selectedTab=par');
            break;
        default:
            ///Nothing
    }
} elseif ($myaction != '') {
    //myaction
    switch ($myaction) {
        default:
            ///Nothing
            //header('location:../index.php');
    }
} elseif ($myaction == '' && ($do = '')) {
    header('location:../index.php');
Example #5
0
     try {
         $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
         //Connexion to database
     } catch (PDOException $error) {
         //Treat error
         //("Erreur de connexion : " . $error->getMessage() );
         header('location:errorPage.php');
     }
     //LIVRAISON
     $sql = "UPDATE `livraison` SET  LVR_VALIDE=2 WHERE `ID_LIVRAISON` = '" . addslashes($xid) . "';\r\n\t\tUPDATE mouvement SET MVT_VALID=2 WHERE (MVT_NATURE LIKE 'LIVRAISON')\r\n\t\tAND ID_SOURCE='" . addslashes($xid) . "';";
     $query = $cnx->prepare($sql);
     //Prepare the SQL
     $query->execute();
     //Execute prepared SQL => $query
     $row = $query->fetch(PDO::FETCH_ASSOC);
     updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Annulation d\'une livraison (' . $xid . ', ' . $oldcode . ')');
     //updateLog($username, $idcust, $action='' )
     header('location:livraison.php?selectedTab=bde&rst=1');
     break;
 case 'validate':
     isset($_POST['rowSelection']) ? $id = $_POST['rowSelection'][0] : ($id = '');
     $split = preg_split('/@/', $id);
     try {
         $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
         //Connexion to database
     } catch (PDOException $error) {
         //Treat error
         //("Erreur de connexion : " . $error->getMessage() );
         header('location:errorPage.php');
     }
     //COMMANDE
Example #6
0
     $query->execute();
     //Execute prepared SQL => $query
     updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Modification d\'une région (' . $region . ')');
     //updateLog($username, $idcust, $action='' )
     unset($GLOBALS['DATA_REG']);
     header('location:region.php?selectedTab=par&rs=2');
     break;
     //SEARCH CATEGORIE
 //SEARCH CATEGORIE
 case 'search':
     $where = "";
     isset($_POST['region']) && $_POST['region'] != '' ? $region = trim($_POST['region']) : ($region = '');
     if ($where != '') {
         $where = substr($where, 0, strlen($where) - 4);
     }
     updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Ajout d\'une région (' . $codecategorie . ', ' . $categorie . ')');
     //updateLog($username, $idcust, $action='' )
     header('location:region.php?selectedTab=par&rst=1');
     break;
 case 'check':
     $msg = "";
     isset($_POST['codecategorie']) && $_POST['codecategorie'] != '' ? $codecategorie = trim($_POST['codecategorie']) : ($codecategorie = '');
     if ($codecategorie != '') {
         $sql = "SELECT COUNT(CODE_CATEGORIE) AS NBRE FROM  `categorie` WHERE `CODE_CATEGORIE` LIKE '" . addslashes($codecategorie) . "'";
         try {
             $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
             //Connexion to database
         } catch (PDOException $error) {
             //Treat error
             //("Erreur de connexion : " . $error->getMessage() );
             header('location:errorPage.php');
     isset($_POST['souscategorie']) && $_POST['souscategorie'] != '' ? $souscategorie = trim($_POST['souscategorie']) : ($souscategorie = '');
     //SQL
     $sql = "UPDATE `souscategorie` SET `CODE_SOUSCATEGORIE`='" . addslashes($codesouscategorie) . "' ,\r\n\t\t `CODE_CATEGORIE`='" . addslashes($categorie) . "' ,`SOUSCAT_LIBELLE`= '" . addslashes($souscategorie) . "'\r\n\t\t WHERE CODE_SOUSCATEGORIE LIKE '" . addslashes($oldsouscodecategorie) . "'";
     try {
         $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
         //Connexion to database
     } catch (PDOException $error) {
         //Treat error
         //("Erreur de connexion : " . $error->getMessage() );
         header('location:errorPage.php');
     }
     $query = $cnx->prepare($sql);
     //Prepare the SQL
     $query->execute();
     //Execute prepared SQL => $query
     updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Modification d\'une sous-catégorie (' . $oldsouscodecategorie . ', ' . $categorie . ' - ' . $souscategorie . ')');
     //updateLog($username, $idcust, $action='' )
     unset($GLOBALS['DATA_CAT']);
     header('location:souscategorie.php?selectedTab=par&rs=2');
     break;
 case 'check':
     $msg = "";
     isset($_POST['codesouscategorie']) && $_POST['codesouscategorie'] != '' ? $codecategorie = trim($_POST['codesouscategorie']) : ($codecategorie = '');
     if ($codecategorie != '') {
         $sql = "SELECT COUNT(CODE_CATEGORIE) AS NBRE FROM  `souscategorie` WHERE `CODE_SOUSCATEGORIE` LIKE '" . addslashes($codecategorie) . "'";
         try {
             $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
             //Connexion to database
         } catch (PDOException $error) {
             //Treat error
             //("Erreur de connexion : " . $error->getMessage() );
     $dateintegration = mysqlFormat($dateintegration);
     //SQL
     $sql = "UPDATE `beneficiaire` SET `CODE_TYPEBENEF`='" . addslashes($typebeneficiaire) . "' ,`CODE_BENEF`='" . addslashes($codebeneficiaire) . "' ,`BENEF_NOM`='" . addslashes($beneficiaire) . "' ,\r\n\t\t`BENEF_EBREVIATION`='" . addslashes($abbrege) . "' ,`BENEF_TEL`='" . addslashes($tel) . "' ,`BENEF_VILLE`='" . addslashes($ville) . "' ,\r\n\t\t`BENEF_EMAIL`='" . addslashes($email) . "',`IDPROVINCE`='" . addslashes($province) . "'  WHERE CODE_BENEF LIKE '" . addslashes($oldcodebeneficiaire) . "' ";
     try {
         $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
         //Connexion to database
     } catch (PDOException $error) {
         //Treat error
         //("Erreur de connexion : " . $error->getMessage() );
         header('location:errorPage.php');
     }
     $query = $cnx->prepare($sql);
     //Prepare the SQL
     $query->execute();
     //Execute prepared SQL => $query
     updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Modification d\'un bénéficiaire (' . $codebeneficiaire . ', ' . $beneficiaire . ')');
     //updateLog($username, $idcust, $action='' )
     header('location:beneficiaire.php?selectedTab=par&rs=2');
     break;
 case 'check':
     $msg = "";
     isset($_POST['code']) && $_POST['code'] != '' ? $code = trim($_POST['code']) : ($code = '');
     if ($code != '') {
         $sql = "SELECT COUNT(CODE_BENEF) AS NBRE FROM  `beneficiaire` WHERE `CODE_BENEF` = '" . addslashes($code) . "'";
         try {
             $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
             //Connexion to database
         } catch (PDOException $error) {
             //Treat error
             //("Erreur de connexion : " . $error->getMessage() );
             header('location:errorPage.php');
     isset($_POST['email']) && $_POST['email'] != '' ? $email = trim($_POST['email']) : ($email = '');
     //SQL
     $sql = "UPDATE  `magasin` SET `CODE_MAGASIN`='" . addslashes($codeservice) . "' ,`IDPROVINCE`='" . addslashes($province) . "' ,\r\n\t  \t`SER_NOM`= '" . addslashes($service) . "',`SER_EMAIL`='" . addslashes($email) . "' ,`SER_TEL`='" . addslashes($telephone) . "' ,\r\n\t  \t`SER_VILLE`='" . addslashes($ville) . "'  WHERE CODE_MAGASIN LIKE '" . addslashes($oldcodeservice) . "'";
     try {
         $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
         //Connexion to database
     } catch (PDOException $error) {
         //Treat error
         //("Erreur de connexion : " . $error->getMessage() );
         header('location:errorPage.php');
     }
     $query = $cnx->prepare($sql);
     //Prepare the SQL
     $query->execute();
     //Execute prepared SQL => $query
     updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Ajout d\'un service (' . $codeservice . ', ' . $service . ')');
     //updateLog($username, $idcust, $action='' )
     header('location:service.php?selectedTab=par&rs=2');
     break;
 case 'check':
     $msg = "";
     isset($_POST['code']) && $_POST['code'] != '' ? $code = trim($_POST['code']) : ($code = '');
     if ($code != '') {
         $sql = "SELECT COUNT(CODE_MAGASIN) AS NBRE FROM  `magasin` WHERE `CODE_MAGASIN` LIKE '" . addslashes($code) . "'";
         try {
             $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
             //Connexion to database
         } catch (PDOException $error) {
             //Treat error
             //("Erreur de connexion : " . $error->getMessage() );
             header('location:errorPage.php');
     isset($_POST['natdeclassement']) && $_POST['natdeclassement'] != '' ? $natdeclassement = trim($_POST['natdeclassement']) : ($natdeclassement = '');
     //SQL
     $sql = "UPDATE `natdeclass` SET `CODENATDECLASS`='" . addslashes($codenatdeclassement) . "' ,`LIBNATDECLASS`= '" . addslashes($natdeclassement) . "' WHERE CODENATDECLASS LIKE '" . addslashes($oldcodenatdeclassement) . "'";
     try {
         $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
         //Connexion to database
     } catch (PDOException $error) {
         //Treat error
         //("Erreur de connexion : " . $error->getMessage() );
         header('location:errorPage.php');
     }
     $query = $cnx->prepare($sql);
     //Prepare the SQL
     $query->execute();
     //Execute prepared SQL => $query
     updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Modification d\'une nature declassement (' . $oldcodenatdeclassement . ', ' . $codenatdeclassement . ', ' . $natdeclassement . ')');
     //updateLog($username, $idcust, $action='' )
     unset($GLOBALS['DATA_CAT']);
     header('location:natdeclassement.php?selectedTab=par&rs=2');
     break;
     //SEARCH CATEGORIE
 //SEARCH CATEGORIE
 case 'check':
     $msg = "";
     isset($_POST['code']) && $_POST['code'] != '' ? $code = trim($_POST['code']) : ($code = '');
     if ($code != '') {
         $sql = "SELECT COUNT(CODENATDECLASS) AS NBRE FROM  `natdeclass` WHERE `CODENATDECLASS` LIKE '" . addslashes($code) . "'";
         try {
             $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
             //Connexion to database
         } catch (PDOException $error) {
Example #11
0
     isset($_POST['id']) && $_POST['id'] != '' ? $id = trim($_POST['id']) : ($id = '');
     //SQL
     $sql = "UPDATE `benefmag` SET `ID_BENEF`='" . addslashes($beneficiaire) . "' ,`CODE_MAGASIN`='" . addslashes($magasin) . "' ,`BM_DATEDEBUT`='" . addslashes($datedebut) . "' ,`BM_DATEFIN`='" . addslashes($datefin) . "'  WHERE ID_BENMAG={$id}";
     try {
         $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
         //Connexion to database
     } catch (PDOException $error) {
         //Treat error
         //("Erreur de connexion : " . $error->getMessage() );
         header('location:errorPage.php');
     }
     $query = $cnx->prepare($sql);
     //Prepare the SQL
     $query->execute();
     //Execute prepared SQL => $query
     updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Modification d\'une affectation (' . $beneficiaire . ', ' . $magasin . ')');
     //updateLog($username, $idcust, $action='' )
     header('location:affectation.php?selectedTab=par&rs=2');
     break;
 case 'detail':
     isset($_GET['xid']) ? $id = $_GET['xid'] : ($id = '');
     $_SESSION['DATA_DON'] = DataDonneesAnnuelles("ID_EXERCICE={$id}", $_SESSION['GL_USER']['MAGASIN']);
     //		$sql = "SELECT * FROM  `donnee_annuelle` INNER JOIN beneficiaire ON (beneficiaire.ID_BENEF=donnee_annuelle.ID_BENEF)
     //			WHERE CODE_MAGASIN LIKE '".$_SESSION['GL_USER']['MAGASIN']."' AND ID_EXERCICE=".$_SESSION['GL_USER']['EXERCICE']."
     //			ORDER BY BENEF_NOM ASC;";
     //
     //		try {
     //			$cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8")); //Connexion to database
     //		}
     //		catch (PDOException $error) { //Treat error
     //			//("Erreur de connexion : " . $error->getMessage() );
Example #12
0
define("SEND_DAILY_EMAIL", true);
// Send daily notification summary to Email
define("SEND_DAILY_SLACK", true);
// Send daily notification summary to Slack
define("STATUS_SOURCE", "status.log");
// Status Log File
/* End Config */
$data = csvToArray();
$result = prepareRunGoogle($data);
if (SEND_TO_EMAIL) {
    resultsToEmail($result);
}
if (SEND_TO_SLACK) {
    resultsToSlack($result);
}
updateLog($data, $result);
function csvToArray()
{
    if (!file_exists(CSV_SOURCE) || !is_readable(CSV_SOURCE)) {
        // Check source and email error if issue occurs
        mail(TO_EMAIL, 'CSV Unreadable', 'Warning - URL Status Checker CSV "' . CSV_SOURCE . '" is unreadable/not found.');
    }
    // Save data to array $data
    $header = NULL;
    $data = array();
    if (($handle = fopen(CSV_SOURCE, 'r')) !== FALSE) {
        while (($row = fgetcsv($handle, 1000, CSV_DELIMITER)) !== FALSE) {
            if (!$header) {
                $header = $row;
            } else {
                $data[] = array_combine($header, $row);
     try {
         $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
         //Connexion to database
     } catch (PDOException $error) {
         //Treat error
         //("Erreur de connexion : " . $error->getMessage() );
         header('location:errorPage.php');
     }
     //TRANSFERT
     $sql = "UPDATE `commande` SET  CDE_STATUT=2 WHERE `CODE_COMMANDE` LIKE '" . addslashes($xid) . "';";
     $query = $cnx->prepare($sql);
     //Prepare the SQL
     $query->execute();
     //Execute prepared SQL => $query
     $row = $query->fetch(PDO::FETCH_ASSOC);
     updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Annulation d\'une commande (' . $xid . ', ' . $oldrefcommande . ')');
     //updateLog($username, $idcust, $action='' )
     header('location:commande.php?selectedTab=bde&rst=1');
     break;
 case 'validate':
     isset($_POST['rowSelection']) ? $id = $_POST['rowSelection'][0] : ($id = '');
     $split = preg_split('/@/', $id);
     try {
         $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
         //Connexion to database
     } catch (PDOException $error) {
         //Treat error
         //("Erreur de connexion : " . $error->getMessage() );
         header('location:errorPage.php');
     }
     //COMMANDE
Example #14
0
function parseData($counterPosition)
{
	global $cookie1, $cookie2, $cookie3, $cookie4, $cookie5;
	
	# Store a timestamp of our start point
	$startTime = mktime();

	# Variable used for post backs
	$dropdowndsAndSearchText = '&ctl00%24ContentPlaceHolder1%24ddlRegion=0&ctl00%24ContentPlaceHolder1%24ddlAlphabet=0&ctl00%24ContentPlaceHolder1%24txtKeywords=';
	
	# Get our first set of data
	$info = '';
	$result = '';
	getBaseData($info, $result);
	
	# We need this for our next two post backs
	$url = $info['url']; // write here the url of your form

	# Our base HTML from the healthunit site
	$html = str_get_html($result);

	# Require for our Next PostBack(s)
	$viewstate = $html->find('#__VIEWSTATE');
	$viewstate = $viewstate[0]->attr['value'];
	$validation = $html->find('#__EVENTVALIDATION');
	$validation = $validation[0]->attr['value'];

	# Our looping variable & break variable
	$break = false;
	$i = 0;
	
	foreach($html->find('#ctl00_ContentPlaceHolder1_tblSearchResults') as $el)
	{
		# Our primary loop
		foreach($el->find('tr') as $row)
		{
			# Counter Position Check
			if ($i < $counterPosition)
			{
				$i++;
				continue;
			}
			
			# TimeCheck
			# If were over 25minutes - then we break out and restart
			if ($startTime + 60 * 25 < mktime())
			{
				$break = true;
				break;
			}
			
			echo 'in our process';
			
			# Increment our counter
			$i++;
			
			# Start processing our records
			$location = strip_tags($row->childNodes(0)->innertext); //estID is parameter of a tag
			$location_link = $row->childNodes(0)->find('a');
			$location_id = $location_link[0]->attr['estid'];
			$location_linkid = $location_link[0]->attr['id'];
			$address = $row->childNodes(1)->innertext;
			$city = $row->childNodes(2)->innertext;
			$date = $row->childNodes(4)->innertext; //njs - 10-27-10 - column changes
			$critical = $row->childNodes(5)->innertext; //njs - 10-27-10 - column changes
			$noncritical = $row->childNodes(6)->innertext; //njs - 10-27-10 - column changes
				
			echo 'location ' . $location . '<br>';
			echo 'location link id'.$location_linkid.'<br />';
			echo 'location link ' . $location_link . '<br />';
			echo 'location id ' . $location_id . '<br>';
			echo 'address ' . $address . '<br>';
			echo 'city ' . $city . '<br>';
			echo 'date ' . $date . '<br>';
			echo 'critical ' . $critical . '<br>';
			echo 'noncritical ' . $noncritical . '<br>';
				
			if ($date != '')
			{
				$inspected = date('Y-m-d', strtotime($date));

				//njs - 10-28-10
				//reset closures if reinspections have occurred
				boolReInspection($location_id, $inspected);
			} else {
				$inspected = '0000-00-00';
			}
			
			$location_id = updateLocation($location, $address, $city, $inspected, $critical, $noncritical);
			//njs - 10-28-10
			//update inspection was returning false positives on infractions
			//changed to only check inspection date
			//$update_inspect = boolUpdateInspection($location_id, $inspected, $critical, $noncritical);
			$update_inspect = boolUpdateInspection($location_id, $inspected);
			
			if ($update_inspect)
			{
				try {
					# Get any of the inspection information
					$ch = curl_init(); //  Initiating the Curl Handler
					curl_setopt($ch, CURLOPT_URL,$url); // Url a donde se va a postear.
					curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11'); //I set the user Agent. In this case is Firefox 2 browser
					curl_setopt($ch, CURLOPT_FAILONERROR, 1); //finish in case of error
					curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirections
					curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // Return the result page in a variable
					curl_setopt($ch, CURLOPT_TIMEOUT, 30); //timeout.
					curl_setopt($ch, CURLOPT_POST, 1); // I set the POST Method
					curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie3);
					curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie4);
					$post = '__EVENTTARGET='.str_replace('_','%24',$location_linkid);
					$post.= '&__EVENTARGUMENT=&__VIEWSTATE='.urlencode($viewstate);
					$post.= '&__EVENTVALIDATION='.urlencode($validation);
					$post.= $dropdowndsAndSearchText;
					curl_setopt($ch, CURLOPT_POSTFIELDS, $post); //change it with your own field name and value
					$result2 = curl_exec($ch); // Execute and send the data.
					$info = curl_getinfo($ch);
					curl_close($ch);
	
					# Parse the results & loop through each inspection date
					$html2 = str_get_html($result2);
					$viewstate2 = $html2->find('#__VIEWSTATE');
					$viewstate2 = $viewstate2[0]->attr['value'];
					$validation2 = $html2->find('#__EVENTVALIDATION');
					$validation2 = $validation2[0]->attr['value'];
					$divLocation2 = strpos($result2, '<div id="ctl00_ContentPlaceHolder1_pnlViolations"');
					$pos2 = substr($result2, $divLocation2, strpos($result2, '</div>', $divLocation2) - $divLocation2);
					$html2->clear();
					unset($html2);
					$htmldata2 = str_get_html('<html><body>'.$pos2.'</body></html>');
					$skip2 = false;
				} catch (Exception $e) {
					error_log('Error processing document ' . $e->getMessage());
					die('Error processing document ' . $e->getMessage());
				}
				
				echo '<br/>process rows '.date('h:i:s');
				
				foreach($htmldata2->find('tr') as $row2)
				{				
					# Skip the header row
					if (!$skip2)
					{
						$skip2 = true;
						continue;
					}
					
					# Grab our data
					$inspectionLink = $row2->childNodes(0)->find('a');
					if ($inspectionLink[0]->innertext != '')
					{
						$inspectionDate = date('Y-m-d', strtotime($inspectionLink[0]->innertext));
					}
					else
					{
						$inspectionDate = '0000-00-00';
					}
					$estid = $inspectionLink[0]->attr['estid'];
					$inspectionId = $inspectionLink[0]->attr['inspectionid'];
					$inspectionLinkId = $inspectionLink[0]->attr['id'];
					$inspectionType = $row2->childNodes(2)->innertext; // rtraction djm - Nov.2 2010 - blank row added
					$critical = $row2->childNodes(3)->innertext; // rtraction djm - Nov.2 2010 - blank row added
					$nonCritical = $row2->childNodes(4)->innertext; // rtraction djm - Nov.2 2010 - blank row added
					
					# Testing
					echo 'Inspecd:'.$inspectionDate.'<br />';
					echo 'ESTID:'.$estid.'<br />';
					echo 'InspecId:'.$inspectionId.'<br />';
					echo 'InspecT:'.$inspectionType.'<br />';
					echo 'Critical:'.$critical.'<br />';
					echo 'NonCritical:'.$nonCritical.'<br />';
					echo '<br />';
	
					# Grab the text
					$ch = curl_init(); //  Initiating the Curl Handler
					curl_setopt($ch, CURLOPT_URL,$url); // Url a donde se va a postear.
					curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11'); //I set the user Agent. In this case is Firefox 2 browser
					curl_setopt($ch, CURLOPT_FAILONERROR, 1); //finish in case of error
					curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirections
					curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // Return the result page in a variable
					curl_setopt($ch, CURLOPT_TIMEOUT, 30); //timeout.
					curl_setopt($ch, CURLOPT_POST, 1); // I set the POST Method
					curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie4);
					curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie5);
					$post = '__EVENTTARGET='.str_replace('_','%24',$inspectionLinkId);
					$post.= '&__EVENTARGUMENT=&__VIEWSTATE='.urlencode($viewstate2);
					$post.= '&__EVENTVALIDATION='.urlencode($validation2);
					$post.= $dropdowndsAndSearchText;
					curl_setopt($ch, CURLOPT_POSTFIELDS, $post); //change it with your own field name and value
					$result3 = curl_exec($ch); // Execute and send the data.
					$info = curl_getinfo($ch);
					curl_close($ch);
	
					# Parse the results & loop through each item
					$divLocation3 = strpos($result3, '<div id="ctl00_ContentPlaceHolder1_pnlViolationDetails"');
					$pos3 = substr($result3, $divLocation3, strpos($result3, '</div>', $divLocation3) - $divLocation3);
					$htmldata3 = str_get_html('<html><body>'.$pos3.'</body></html>');
					$skip3 = false;
					foreach($htmldata3->find('tr') as $row3)
					{				
						# Skip any header rows	
						if ($row3->class == "inspectionTableHeader")
						{
							continue;
						}	
						
						# Grab our data for all normal rows
						if (isset($row3->childNodes(2)->innertext))
						{						
							//severity can be critical, noncritical, satisfactory
							$severity = strip_tags($row3->childNodes(0)->innertext);
							$desc = $row3->childNodes(1)->innertext;
							$resultText = $row3->childNodes(2)->innertext;
								
							# Testing
							echo 'Severity:'.$severity.'<br />';
							echo 'Desc:'.$desc.'<br />';
							echo 'Res:'.$resultText.'<br />';
							echo '<br />';
	
							$details = '';
							$category = '';
							
							if ($desc != '')
							{
								$desc = strip_tags($desc);
								$failPos = stripos($desc, 'Fail');
								$category = substr($desc, 0, $failPos);
								$details = substr($desc, $failPos, strlen($desc));
							}
														
							# Update details in db
							updateInspection($location_id, $inspectionDate, $severity, $resultText, $details, $category, $inspected);
						}
						else
						{						
							// Do we have an order 13?
							$text = $row3->childNodes(0)->innertext;
							if (strpos(strtolower($text), 'section 13 order served') !== FALSE)
							{
								echo 'Order 13 Served!<br />';
								
								// We found an Order 13 - so lets capture that information
								updateInspection($location_id, $inspectionDate, 'Closed', 'No', strip_tags($text), 'Order 13 Served', $inspected);
							}
							else if (strpos(strtolower($text), 'section 13 order revoked') !== FALSE)
							{
								echo 'Order 13 Revoked!<br />';
																
								// We found an Order 13 - so lets capture that information
								updateInspection($location_id, $inspectionDate, 'Closed', 'No', strip_tags($text), 'Order 13 Revoked', $inspected);
							}
							else
							{
								echo 'No infractions - record note!<br />';
								
								// We record a simple note as there was no infractions
								updateInspection($location_id, $inspectionDate, 'Note', 'No', ' ', strip_tags($text), $inspected);
							}
						}
					}
					$htmldata3->clear();
					unset($htmldata3);
	
					# Only process one inspection
					///break; Process all inspections - Aug. 5, 2010 - rtraction djm
				}
				
				$htmldata2->clear();
				unset($htmldata2);			
			}
		}
		
		# We've hit our timelimit above so we want to break out
		if ($break) { break; }
	}
	$html->clear();
	unset($html);

	// updated log table
	if (!$break)
	{
		updateLog();
	}
	else
	{
		# We hit a time block above and broke out of our loops
		# We're starting the process again but jumping ahead
		
		parseData($i);
	}
}
Example #15
0
function processCheckIn($rfid)
{
    $errors = 0;
    $processCheckInMessage = "";
    $rfid = testInput($rfid);
    $date = date('Y-m-d H:i:s');
    if (getMemberInfoByRFID($rfid, 'k.serial')["serial"] != null) {
        if (getMemberInfoByRFID($rfid, "c.active")["active"] == 0) {
            // check if user is active
            if (!createLog(getMemberInfoByRFID($rfid, "c.cid")["cid"], $date)) {
                // create a log with the current date
                $errors = 1;
                $processCheckInMessage .= 'Could not create a new log in the database!';
                die;
            } else {
                if (!updateContactCheckinStatus($date, getMemberInfoByRFID($rfid, "c.cid")["cid"], 1)) {
                    // update user table, set active to 1 and insert last checkin time
                    $errors = 1;
                    $processCheckInMessage .= 'Could not update member status when checking in!';
                    die;
                } else {
                    $processCheckInMessage .= "Checkin successful!";
                }
            }
        } else {
            if (!updateContactCheckinStatus($date, getMemberInfoByRFID($rfid, "c.cid")["cid"], 0)) {
                // update user table, set active to 0 and insert last checkout time
                $errors = 1;
                $processCheckInMessage .= 'Could not update member status when checking out!';
                die;
            } else {
                if (!updateLog(getMemberInfoByRFID($rfid, "c.cid")["cid"], $date, getMemberInfoByRFID($rfid, "c.last_checkin_time")["last_checkin_time"])) {
                    // close log, insert checkout time (current date time)
                    $errors = 1;
                    $processCheckInMessage .= 'Could not close the log for user check out!';
                    die;
                } else {
                    $processCheckInMessage .= "Checkout successful!";
                }
            }
        }
    } else {
        $errors = 1;
        $processCheckInMessage .= "RFID key not found in the database!";
    }
    if ($errors == 1) {
        $processCheckInMessage = 'ERROR: ' . $processCheckInMessage;
        // in case there are errors, add 'ERROR: ' at the beginning of a status message.
        $response['hasErrors'] = $errors;
        $response['message'] = $processCheckInMessage;
    } else {
        $response['hasErrors'] = $errors;
        $response['message'] = $processCheckInMessage;
        $response['firstName'] = getMemberInfoByRFID($rfid, 'c.firstName')["firstName"];
        $response['lastName'] = getMemberInfoByRFID($rfid, 'c.lastName')["lastName"];
        $response['lastCheckInTime'] = getMemberInfoByRFID($rfid, 'c.last_checkin_time')["last_checkin_time"];
        $response['lastCheckOutTime'] = getMemberInfoByRFID($rfid, 'c.last_checkout_time')["last_checkout_time"];
    }
    return $response;
}
     isset($_POST['id']) && $_POST['id'] != '' ? $id = trim($_POST['id']) : ($id = '');
     //SQL
     $sql = "UPDATE `respmagasin` SET `NUM_MLLE`='" . addslashes($personnel) . "' ,`CODE_MAGASIN`='" . addslashes($magasin) . "' ,`RES_DATEDEBUT`='" . addslashes($datedebut) . "' ,\r\n\t\t`RES_DATEFIN`='" . addslashes($datefin) . "'  WHERE ID_RESPO={$id}";
     try {
         $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
         //Connexion to database
     } catch (PDOException $error) {
         //Treat error
         //("Erreur de connexion : " . $error->getMessage() );
         header('location:errorPage.php');
     }
     $query = $cnx->prepare($sql);
     //Prepare the SQL
     $query->execute();
     //Execute prepared SQL => $query
     updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Modification d\'un responsable (' . $personnel . ', ' . $magasin . ')');
     //updateLog($username, $idcust, $action='' )
     header('location:responsable.php?selectedTab=par&rs=2');
     break;
 case 'check':
     $msg = "";
     isset($_POST['id']) && $_POST['id'] != '' ? $id = trim($_POST['id']) : ($codemagasin = '');
     if ($codemagasin != '') {
         $sql = "SELECT COUNT(CODE_MAGASIN) AS NBRE FROM  `service` WHERE `CODE_MAGASIN` LIKE '" . addslashes($id) . "'";
         try {
             $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
             //Connexion to database
         } catch (PDOException $error) {
             //Treat error
             //("Erreur de connexion : " . $error->getMessage() );
             header('location:errorPage.php');
Example #17
0
         //SQL
         $sql .= "UPDATE `produit` SET  `PRD_PRIXACHAT`={$prixachat},`PRD_PRIXREVIENT`={$prixrevient}, `PRD_PRIXVENTE`={$prixvente},\r\n\t\t\t`PRD_PRIXACHATN2`={$prixachatn2},`PRD_PRIXREVIENTN2`={$prixrevientn2}, `PRD_PRIXVENTEN2`={$prixventen2}\r\n\t\t\tWHERE CODE_PRODUIT LIKE '" . addslashes($val) . "';";
     }
     try {
         $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
         //Connexion to database
     } catch (PDOException $error) {
         //Treat error
         //("Erreur de connexion : " . $error->getMessage() );
         header('location:errorPage.php');
     }
     $query = $cnx->prepare($sql);
     //Prepare the SQL
     $query->execute();
     //Execute prepared SQL => $query
     updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Mise à jour des prix ');
     //updateLog($username, $idcust, $action='' )
     header('location:produit.php?selectedTab=par&rs=2');
     break;
 case 'check':
     $msg = "";
     isset($_POST['codeproduit']) && $_POST['codeproduit'] != '' ? $codeproduit = trim($_POST['codeproduit']) : ($codeproduit = '');
     if ($codeproduit != '') {
         $sql = "SELECT COUNT(CODE_PRODUIT) AS NBRE FROM  `produit` WHERE `CODE_PRODUIT` LIKE '" . addslashes($codeproduit) . "'";
         try {
             $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
             //Connexion to database
         } catch (PDOException $error) {
             //Treat error
             //("Erreur de connexion : " . $error->getMessage() );
             header('location:errorPage.php');
        isset($_POST['dependance']) && $_POST['dependance'] != '' ? $dependance = trim($_POST['dependance']) : ($dependance = '');
        //SQL
        $sql = "UPDATE `localite` SET `ID_GRPLOC`='" . addslashes($grplocalite) . "' ,`LOC_NOM`='" . addslashes($localite) . "' ,`LOC_LIEN`='" . addslashes($dependance) . "' WHERE ID_LOCALITE ='" . addslashes($id) . "'";
        try {
            $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
            //Connexion to database
        } catch (PDOException $error) {
            //Treat error
            //("Erreur de connexion : " . $error->getMessage() );
            header('location:errorPage.php');
        }
        $query = $cnx->prepare($sql);
        //Prepare the SQL
        $query->execute();
        //Execute prepared SQL => $query
        updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Ajout d\'une localité (, ' . $localite . ')');
        //updateLog($username, $idcust, $action='' )
        header('location:localite.php?selectedTab=par&rs=2');
        break;
    default:
        ///Nothing
        //header('location:../index.php');
}
isset($_POST['myaction']) && $_POST['myaction'] != '' ? $myaction = $_POST['myaction'] : ($myaction = '');
switch ($myaction) {
    case 'edit':
        isset($_POST['rowSelection']) ? $id = $_POST['rowSelection'][0] : ($id = '');
        $split = preg_split('/ /', $id);
        try {
            $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
            //Connexion to database
Example #19
0
     isset($_POST['unite']) && $_POST['unite'] != '' ? $unite = trim($_POST['unite']) : ($unite = '');
     //SQL
     $sql = "UPDATE `unite` SET `ID_UNITE`='" . addslashes($codeunite) . "' ,`UT_LIBELLE`='" . addslashes($unite) . "' WHERE ID_UNITE='" . addslashes($oldcodeunite) . "'";
     try {
         $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
         //Connexion to database
     } catch (PDOException $error) {
         //Treat error
         //("Erreur de connexion : " . $error->getMessage() );
         header('location:errorPage.php');
     }
     $query = $cnx->prepare($sql);
     //Prepare the SQL
     $query->execute();
     //Execute prepared SQL => $query
     updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Modification d\'une unite (' . $oldcodeunite . ', ' . $codeunite . ', ' . $article . ')');
     //updateLog($username, $idcust, $action='' )
     header('location:unite.php?selectedTab=par&rs=2');
     break;
 case 'check':
     $msg = "";
     isset($_POST['codeunite']) && $_POST['codeunite'] != '' ? $codeunite = trim($_POST['codeunite']) : ($codeunite = '');
     if ($codeunite != '') {
         $sql = "SELECT COUNT(ID_UNITE) AS NBRE FROM  `unite` WHERE `ID_UNITE` LIKE '" . addslashes($codeunite) . "'";
         try {
             $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
             //Connexion to database
         } catch (PDOException $error) {
             //Treat error
             //("Erreur de connexion : " . $error->getMessage() );
             header('location:errorPage.php');
Example #20
0
         updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Ajout des lignes de report entrant (' . $codeRep2 . ', Exercice ' . $exercice . ')');
         //updateLog($username, $idcust, $action='' )
         $query = $cnx->prepare($sql2);
         //Prepare the SQL
         $query->execute();
         //Execute prepared SQL => $query
         updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Ajout des mouvements de report entrant (' . $codeRep2 . ', Exercice ' . $exercice . ')');
         //updateLog($username, $idcust, $action='' )
     }
     //Clorurer l'exercice en cours
     $sql2 = "UPDATE `exercice` SET EX_CLOTURE=1 ,EX_DATECLOTURE='" . date('Y-m-d') . "' WHERE ID_EXERCICE={$exercice};";
     $query = $cnx->prepare($sql2);
     //Prepare the SQL
     $query->execute();
     //Execute prepared SQL => $query
     updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], "Clôture de l'exercice (" . $exercice . ')');
     //updateLog($username, $idcust, $action='' )
     unset($_SESSION['DATA_REP']);
     header('location:dbuser.php?do=logout');
     break;
 case 'detail':
     isset($_GET['xid']) ? $id = $_GET['xid'] : ($id = '');
     //$split = preg_split('/@/',$id);
     try {
         $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
         //Connexion to database
     } catch (PDOException $error) {
         //Treat error
         //("Erreur de connexion : " . $error->getMessage() );
         header('location:errorPage.php');
     }
     try {
         $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
         //Connexion to database
     } catch (PDOException $error) {
         //Treat error
         //("Erreur de connexion : " . $error->getMessage() );
         header('location:errorPage.php');
     }
     //TRANSFERT
     $sql = "UPDATE `declass` SET  DCL_VALIDE=2, DCL_DATEVALID='" . addslashes(date('Y-m-d H:i:s')) . "' WHERE `CODE_DECLASS` LIKE '" . addslashes($xid) . "';\r\n\t\tUPDATE mouvement SET MVT_VALID=2, MVT_DATEVALID='" . addslashes(date('Y-m-d H:i:s')) . "'  WHERE (MVT_NATURE LIKE 'PERTE') AND ID_SOURCE LIKE '" . addslashes($xid) . "';";
     $query = $cnx->prepare($sql);
     //Prepare the SQL
     $query->execute();
     //Execute prepared SQL => $query
     $row = $query->fetch(PDO::FETCH_ASSOC);
     updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Annulation d\'un declassement (' . $xid . ', ' . $oldcode . ')');
     //updateLog($username, $idcust, $action='' )
     //echo $sql;
     header('location:declassement.php?selectedTab=bds&rst=1');
     break;
 case 'delete':
     isset($_POST['rowSelection']) ? $id = $_POST['rowSelection'] : ($id = array());
     try {
         $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
         //Connexion to database
     } catch (PDOException $error) {
         //Treat error
         //("Erreur de connexion : " . $error->getMessage() );
         header('location:errorPage.php');
     }
     foreach ($id as $key => $val) {
            break;
        case 'annul':
            isset($_POST['xid']) ? $xid = $_POST['xid'] : ($xid = '');
            isset($_POST['oldrefinventaire']) ? $oldrefinventaire = $_POST['oldrefinventaire'] : ($oldrefinventaire = '');
            try {
                $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
                //Connexion to database
            } catch (PDOException $error) {
                //Treat error
                //("Erreur de connexion : " . $error->getMessage() );
                header('location:errorPage.php');
            }
            //TRANSFERT
            $sql = "UPDATE `inventaire` SET  INV_VALID=2 WHERE `CODE_INVENTAIRE` LIKE '" . addslashes($xid) . "';\r\n\t\tUPDATE mouvement SET MVT_VALID=2 WHERE (MVT_NATURE LIKE 'INVENTAIRE%')\r\n\t\tAND ID_SOURCE LIKE '" . addslashes($xid) . "';";
            $query = $cnx->prepare($sql);
            //Prepare the SQL
            $query->execute();
            //Execute prepared SQL => $query
            $row = $query->fetch(PDO::FETCH_ASSOC);
            updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], "Annulation d\\'un inventaire ({$xid}, {$oldrefinventaire})");
            //updateLog($username, $idcust, $action='' )
            //echo $sql;
            header('location:inventaire.php?selectedTab=int&rst=1');
            break;
        default:
            ///Nothing
            //header('location:../index.php');
    }
} elseif ($myaction == '' && ($do = '')) {
    header('location:../index.php');
}
Example #23
0
        break;
        //DELET PROFIL
    //DELET PROFIL
    case 'delete':
        isset($_POST['rowSelection']) ? $id = $_POST['rowSelection'] : ($id = array());
        try {
            $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
            //Connexion to database
        } catch (PDOException $error) {
            //Treat error
            //("Erreur de connexion : " . $error->getMessage() );
            header('location:errorPage.php');
        }
        foreach ($id as $key => $val) {
            $split = preg_split('/@/', $val);
            $sql = "DELETE FROM  `profil_menu` WHERE `IDPROFIL` LIKE '" . addslashes($split[0]) . "';\r\n\t\t\t\t\tDELETE FROM  `profil` WHERE `IDPROFIL` LIKE '" . addslashes($split[0]) . "'";
            $query = $cnx->prepare($sql);
            //Prepare the SQL
            $query->execute();
            //Execute prepared SQL => $query
        }
        updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Suppression d\'un profil utilisateur (' . $split[0] . ',  ' . getField('IDPROFIL', $split[0], 'LIBPROFIL', 'profil') . ')');
        //updateLog($username, $idcust, $action='' )
        //header('location:profil.php?selectedTab=par&rst=1');
        break;
    default:
        ///Nothing
}
if ($myaction == '' && $do == '') {
    header('location:../index.php');
}
Example #24
0
         $query->execute();
         //Execute prepared SQL => $query
         $row = $query->fetch(PDO::FETCH_ASSOC);
         $_SESSION['GL_USER']['EXERCICE'] = $exercice;
         $_SESSION['GL_USER']['EX_LIBELLE'] = $row['EX_LIBELLE'];
         $_SESSION['GL_USER']['STATUT_EXERCICE'] = $row['EX_CLOTURE'];
         $_SESSION['GL_USER']['DEBUT_EXERCICE'] = frFormat2($row['EX_DATEDEBUT']);
         $_SESSION['GL_USER']['FIN_EXERCICE'] = frFormat2($row['EX_DATEFIN']);
         $olcantine = $_SESSION['GL_USER']['MAGASIN'];
         $_SESSION['GL_USER']['PROVINCE'] = $province;
         $_SESSION['GL_USER']['MAGASIN'] = $cantine;
         updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Changement de l\'exercice budgétaire (' . $olexercice . ', ' . $exercice . ' / ' . $olcantine . ', ' . $cantine . ')');
         //updateLog($username, $idcust, $action='' )
         header('location:home.php?selectedTab=home');
     } else {
         updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Changement de l\'exercice budgétaire a entrainé une déconnexion');
         //updateLog($username, $idcust, $action='' )
         header('location:dbuser.php?do=logout');
     }
     break;
 case 'fillService':
     $list = '<option value="0"></option>';
     if (isset($_POST["province"]) && $_POST["province"] != '0') {
         $_SESSION['GL_USER']['PROVINCE'] = $_POST["province"];
         //SQL
         $sql = "SELECT * FROM magasin WHERE IDPROVINCE LIKE '" . stripslashes($_POST["province"]) . "' ORDER BY magasin.SER_NOM ASC;";
         try {
             $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
             //Connexion to database
         } catch (PDOException $error) {
             //Treat error
Example #25
0
//30分钟
$now = date("Y-m-d H:i:s");
$date = date("Y-m-d");
$_SESSION['cus_id'] = $cus_id;
$_SESSION['sessid'] = session_id();
$sessid = session_id();
$log = findLog($cus_id, $ip, $sessid, $db);
//var_dump($_SESSION);
//查找日志是否存在
if (empty($log)) {
    //如果不存在添加
    $dataLog = array('cus_id' => $cus_id, 'ip' => $ip, 'expires' => $expires, 'sessid' => $sessid, 'platform' => $platform);
    $insertLog = insertLog($dataLog, $db);
} else {
    $dataLog = array('expires' => $expires, 'ip' => $ip, 'sessid' => $sessid);
    $updateLog = updateLog($cus_id, $dataLog, $db);
}
//查看是否存在统计记录
$counter = findCount($cus_id, $db);
if (empty($counter)) {
    //不存在,添加
    $dataCount = array('cus_id' => $cus_id, 'record_date' => $date);
    $insertCount = insertCount($dataCount, $db);
}
if (isset($insertLog)) {
    $updateCount = updateCount($cus_id, $platform, $counter, $db);
    echo 'update statis succeed';
} else {
    echo 'not need update statis';
}
/**
     try {
         $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
         //Connexion to database
     } catch (PDOException $error) {
         //Treat error
         //("Erreur de connexion : " . $error->getMessage() );
         header('location:errorPage.php');
     }
     //TRANSFERT
     $sql = "UPDATE `bonsortie` SET  SOR_VALIDE=2, SOR_DATEVALID='" . addslashes(date('Y-m-d H:i:s')) . "' WHERE `CODE_BONSORTIE` = '" . addslashes($xid) . "';\r\n\t\tUPDATE mouvement SET MVT_VALID=2, MVT_DATEVALID='" . addslashes(date('Y-m-d H:i:s')) . "'  WHERE (MVT_NATURE LIKE 'BON DE SORTIE') AND ID_SOURCE LIKE '" . addslashes($xid) . "';";
     $query = $cnx->prepare($sql);
     //Prepare the SQL
     $query->execute();
     //Execute prepared SQL => $query
     $row = $query->fetch(PDO::FETCH_ASSOC);
     updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], "Annulation d\\'un bon de sortie ({$xid}, {$oldcode})");
     //updateLog($username, $idcust, $action='' )
     //echo $sql;
     header('location:bonsortie.php?selectedTab=bds&rst=1');
     break;
 case 'validate':
     isset($_POST['rowSelection']) ? $id = $_POST['rowSelection'][0] : ($id = '');
     $split = preg_split('/@/', $id);
     try {
         $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
         //Connexion to database
     } catch (PDOException $error) {
         //Treat error
         //("Erreur de connexion : " . $error->getMessage() );
         header('location:errorPage.php');
     }
         $sql .= "DELETE FROM fournisseur;";
     }
     try {
         $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
         //Connexion to database
     } catch (PDOException $error) {
         //Treat error
         //("Erreur de connexion : " . $error->getMessage() );
         header('location:errorPage.php');
     }
     $query = $cnx->prepare($sql);
     //Prepare the SQL
     $query->execute();
     //Execute prepared SQL => $query
     //echo  $sql;
     updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Vidage de la base de données ' . $_SESSION['GL_USER']['LOGIN'] . '(' . $_SESSION['GL_USER']['MLLE'] . ')');
     //updateLog($username, $idcust, $action='' )
     header('location:vider.php?selectedTab=data&rs=1');
     break;
 case 'import':
     $_SESSION['DATA_BAK']['nbre'] = 0;
     $f = '../upload/Backupload_' . $_SESSION['GL_USER']['EXERCICE'] . '_' . date('ymdHis') . '.sql';
     if (move_uploaded_file($_FILES['fichiersql']['tmp_name'], $f)) {
         $ptFichier = fopen($f, 'r');
         isset($_POST['serveur']) && $_POST['serveur'] ? $serveur = trim($_POST['serveur']) : ($serveur = '');
         isset($_POST['basedonnees']) && $_POST['basedonnees'] ? $basedonnees = trim($_POST['basedonnees']) : ($basedonnees = '');
         isset($_POST['user']) && $_POST['user'] ? $user = trim($_POST['user']) : ($user = '');
         isset($_POST['pwd']) && $_POST['pwd'] ? $pwd = trim($_POST['pwd']) : ($pwd = '');
         $dblink = "mysql:host={$serveur};dbname={$basedonnees}";
         try {
             //$cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8")); //Connexion to database
     isset($_POST['emailresponsable']) && $_POST['emailresponsable'] != '' ? $emailresponsable = trim($_POST['emailresponsable']) : ($emailresponsable = '');
     //SQL
     $sql = "UPDATE `fournisseur` SET `CODE_FOUR`='" . addslashes($codefournisseur) . "',\r\n\t\tCODE_TYPEFOUR='" . addslashes($typefournisseur) . "', `FOUR_NOM`='" . addslashes($fournisseur) . "', `FOUR_TEL`='" . addslashes($tel) . "',\r\n\t\t`FOUR_ADRESSE`='" . addslashes($adresse) . "', `FOUR_EMAIL`='" . addslashes($email) . "', `FOUR_RESPONSABLE`='" . addslashes($responsable) . "',\r\n\t\t`FOUR_RESPTEL`='" . addslashes($telresponsable) . "', `FOUR_RESPEMAIL`='" . addslashes($emailresponsable) . "' WHERE CODE_FOUR LIKE '" . addslashes($oldcodefournisseur) . "'";
     try {
         $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
         //Connexion to database
     } catch (PDOException $error) {
         //Treat error
         //("Erreur de connexion : " . $error->getMessage() );
         header('location:errorPage.php');
     }
     $query = $cnx->prepare($sql);
     //Prepare the SQL
     $query->execute();
     //Execute prepared SQL => $query
     updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Modification d\'un fournisseur (' . $id . ', ' . $fournisseur . ')');
     //updateLog($username, $idcust, $action='' )
     header('location:fournisseur.php?selectedTab=par&rs=2');
     break;
 case 'check':
     $msg = "";
     isset($_POST['codefournisseur']) && $_POST['codefournisseur'] != '' ? $codefournisseur = trim($_POST['codefournisseur']) : ($codefournisseur = '');
     if ($codefournisseur != '') {
         $sql = "SELECT COUNT(CODE_FOUR) AS NBRE FROM  `fournisseur` WHERE `CODE_FOUR` LIKE '" . addslashes($codefournisseur) . "'";
         try {
             $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
             //Connexion to database
         } catch (PDOException $error) {
             //Treat error
             //("Erreur de connexion : " . $error->getMessage() );
             header('location:errorPage.php');
     isset($_POST['typefournisseur']) && $_POST['typefournisseur'] != '' ? $typefournisseur = trim($_POST['typefournisseur']) : ($typefournisseur = '');
     //SQL
     echo $sql = "UPDATE `typefournisseur` SET `CODE_TYPEFOUR`='" . addslashes($codetypefournisseur) . "' ,`TYPEFOUR_NOM`='" . addslashes($typefournisseur) . "' WHERE CODE_TYPEFOUR LIKE '" . addslashes($oldcodetypefournisseur) . "'";
     try {
         $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
         //Connexion to database
     } catch (PDOException $error) {
         //Treat error
         //("Erreur de connexion : " . $error->getMessage() );
         header('location:errorPage.php');
     }
     $query = $cnx->prepare($sql);
     //Prepare the SQL
     $query->execute();
     //Execute prepared SQL => $query
     updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Ajout d\'un type de bénéficiaire (' . $typefournisseur . ', ' . $typefournisseur . ')');
     //updateLog($username, $idcust, $action='' )
     header('location:typefournisseur.php?selectedTab=par&rs=2');
     break;
 case 'check':
     $msg = "";
     isset($_POST['codetypefournisseur']) && $_POST['codetypefournisseur'] != '' ? $codetypefournisseur = trim($_POST['codetypefournisseur']) : ($codetypedotation = '');
     if ($codetypefournisseur != '') {
         $sql = "SELECT COUNT(CODE_TYPEFOUR) AS NBRE FROM  `typefournisseur` WHERE `CODE_TYPEFOUR` LIKE '" . addslashes($codetypefournisseur) . "'";
         try {
             $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
             //Connexion to database
         } catch (PDOException $error) {
             //Treat error
             //("Erreur de connexion : " . $error->getMessage() );
             header('location:errorPage.php');
     try {
         $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
         //Connexion to database
     } catch (PDOException $error) {
         //Treat error
         //("Erreur de connexion : " . $error->getMessage() );
         header('location:errorPage.php');
     }
     //TRANSFERT
     $sql = "UPDATE `recondit` SET  REC_VALIDE=2, REC_DATEVALID='" . addslashes(date('Y-m-d')) . "' WHERE `ID_DECLASS` = '" . addslashes($xid) . "';\r\n\t\tUPDATE mouvement SET MVT_VALID=2, MVT_DATEVALID='" . addslashes(date('Y-m-d')) . "'  WHERE (MVT_NATURE LIKE 'RECONDITIONNEMENT%') AND ID_SOURCE='" . addslashes($xid) . "';";
     $query = $cnx->prepare($sql);
     //Prepare the SQL
     $query->execute();
     //Execute prepared SQL => $query
     $row = $query->fetch(PDO::FETCH_ASSOC);
     updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Annulation d\'un bon de sortie (' . $xid . ', ' . $oldcode . ')');
     //updateLog($username, $idcust, $action='' )
     //echo $sql;
     header('location:reconditionnement.php?selectedTab=bds&rst=1');
     break;
 case 'delete':
     isset($_POST['rowSelection']) ? $id = $_POST['rowSelection'] : ($id = array());
     try {
         $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
         //Connexion to database
     } catch (PDOException $error) {
         //Treat error
         //("Erreur de connexion : " . $error->getMessage() );
         header('location:errorPage.php');
     }
     foreach ($id as $key => $val) {