示例#1
0
function search_in_log($link, $check_str, $date_from, $date_to, $part_number, $label_id)
{
    if ($check_str == '000') {
        $err_msg = 'Wrong search criterias';
        require_once "/views/error.php";
    }
    $log_sel = log_all($link);
    $i = 0;
    $result = false;
    $b = array();
    // Date selection
    if ($check_str[0] != 0) {
        foreach ($log_sel as $a) {
            if ($a['timestamp'] > $date_from and $a['timestamp'] < $date_to) {
                $b[$i] = $a;
                $i++;
                $result = true;
            }
        }
        if ($i > 0) {
            $log_sel = $b;
        }
        $i = 0;
        $b = array();
    }
    // Part selection
    if ($check_str[1] != 0) {
        foreach ($log_sel as $a) {
            if ($a['part_number'] == $part_number) {
                $b[$i] = $a;
                $i++;
                $result = true;
            }
        }
        if ($i > 0) {
            $log_sel = $b;
        }
        $i = 0;
        $b = array();
    }
    // Label selection
    if ($check_str[2] != 0) {
        foreach ($log_sel as $a) {
            if ($a['label_id'] == $label_id) {
                $b[$i] = $a;
                $i++;
                $result = true;
            }
        }
        if ($i > 0) {
            $log_sel = $b;
        }
        $i = 0;
        $b = array();
    }
    if (!$result) {
        return 0;
    }
    return $log_sel;
}
<?php

include_once 'config.php';
include_once 'includes/libs_mail.inc.php';
include_once 'includes/libs_code.inc.php';
include_once 'includes/libs_logs.inc.php';
$link_mysql = mysql_connect($mysql_host, $mysql_user, $mysql_pass) or die("Impossible de se connecter : " . mysql_error());
mysql_set_charset('utf8', $link_mysql);
//$link_mysql = mysql_connect("localhost","root","Kma65Gtu") or die("Impossible de se connecter : " . mysql_error($link_mysql));
mysql_select_db($mysql_database, $link_mysql);
log_all($link_mysql);
$messsage_erreur = '';
$messsage_erreur_code = '';
$affichage_recup = 'none';
$affichage = 'normal';
if (isset($_GET['c']) and $_GET['c'] != '') {
    //récupération du cadeau
    //Vérification du mot de passe
    $QrySelect = 'SELECT id, nom, email, used FROM ProfilsNoel where pass =\'' . mysql_real_escape_string(addslashes(strtoupper($_GET['c'])), $link_mysql) . '\'';
    $QrySelectRes = mysql_query($QrySelect, $link_mysql);
    if (mysql_num_rows($QrySelectRes) == 1) {
        $RowSelect = mysql_fetch_assoc($QrySelectRes);
        $id = stripslashes($RowSelect['id']);
        $nom = stripslashes($RowSelect['nom']);
        $email = stripslashes($RowSelect['email']);
        if ($RowSelect['used'] == '1') {
            //Le code a déjà été utilisé, on en regénère un nouveau qu'on envoi par mail et on en informe la personne
            $pass = generate_code($link_mysql);
            //On marque le code comme utilisé
            $QryUsed = 'UPDATE ProfilsNoel SET pass = \'' . $pass . '\', used = 0 WHERE id = \'' . $RowSelect['id'] . '\'';
            mysql_query($QryUsed, $link_mysql);
示例#3
0
     }
     break;
 case 'view_csv':
     //      _______VIEW CSV_______
     view_wh_csv($link);
     header("Location: ./views/menu.php");
     break;
 case 'log':
     //      _______LOG_______
     if (!empty($_POST)) {
         $log = log_all($link);
         $nr = $_POST['nr'];
         // not finished yet
         require_once "./views/log_last.php";
     } else {
         $log = log_all($link);
         //$nr = count($log);
         $nr = 500;
         $log_header = 'Log (last ' . $nr . ' entries)';
         require_once "./views/log_all.php";
     }
     break;
 case 'sign_off':
     //      _______SIGN OFF_______
     if (!empty($_POST)) {
         $label_id = get_lbl_fr_barcode($_POST['label_id']);
         $to_addr = 'SIGNED OFF';
         if ($label_id != 'ERROR') {
             $n = lbl_move($link, $action, $label_id, $to_addr);
             if ($_GET['scanner'] == 'true') {
                 header("Location: ./views/menu_scan.php");