File: fonction.inc.php

package info (click to toggle)
ocsinventory-server 2.5%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 7,088 kB
  • sloc: php: 27,462; perl: 8,241; sh: 1,680; sql: 1,355; xml: 1,041; makefile: 34
file content (68 lines) | stat: -rw-r--r-- 3,901 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
/*
 * Copyright 2005-2016 OCSInventory-NG/OCSInventory-ocsreports contributors.
 * See the Contributors file for more details about them.
 *
 * This file is part of OCSInventory-NG/OCSInventory-ocsreports.
 *
 * OCSInventory-NG/OCSInventory-ocsreports is free software: you can redistribute
 * it and/or modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, either version 2 of the License,
 * or (at your option) any later version.
 *
 * OCSInventory-NG/OCSInventory-ocsreports is distributed in the hope that it
 * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with OCSInventory-NG/OCSInventory-ocsreports. if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 */

function remplirListe($input_name, $label = '') {
    global $protectedPost;
    //requete SQL avec filtre sur les logiciels des pc linux et Correctifs, mise a jour windows
    $sql = "SELECT DISTINCT softwares.NAME FROM softwares_name_cache softwares  WHERE  softwares.NAME NOT LIKE '%Correctif%' AND softwares.NAME NOT LIKE '%Mise a jour%' ORDER BY softwares.NAME";

    $query = mysqli_query($_SESSION['OCS']["readServer"], $sql) or die("erreur" . mysqli_error($_SESSION['OCS']["readServer"]));
    //remplit la liste deroulante
    $name[""] = "";
    while ($row = mysqli_fetch_array($query)) {
        $name[$row['NAME']] = $row['NAME'];
    }
    formGroup('select', $input_name, $label, '', '', $protectedPost[$input_name], '', $name, $name);
    //echo show_modif($name, $input_name, 2, '', '');
}

function creerTableau($var) {  //$var est le $_post de mon script.php
    echo "<br /><b><i>Vous avez choisi :<br />" . $var . "</i></b>";
    $sql_version = "SELECT hardware.NAME AS 'hnom',hardware.IPADDR AS 'ip',hardware.WORKGROUP AS 'domaine', softwares.NAME AS 'snom', softwares.VERSION AS 'sversion',softwares.FOLDER as 'sfold' FROM hardware INNER JOIN softwares ON softwares.HARDWARE_ID =hardware.ID WHERE softwares.NAME='$var' ORDER BY softwares.VERSION";
    $query_version = mysqli_query($_SESSION['OCS']["readServer"], $sql_version);
    $html_data .= "<table>\n";
    $html_data .= "<tr><th>Nom du PC   </th><th>Nom du logiciel   </th><th>Version du logiciel </th><th>Repertoire</th><th>Adresse IP</th><th>Domaine</th></tr> ";
    while ($row = mysqli_fetch_array($query_version, MYSQLI_ASSOC)) {
        if ($row['sfold'] == "") {
            $row['sfold'] = "&nbsp";
        }
        if ($row['sversion'] == "") {
            $row['sversion'] = "&nbsp";
        }
        $html_data .= "\n<tr><td style='color: blue'>" . $row['hnom'] . " </td><td style='color : green'>" . $row['snom'] . " </td><td style='color : red'> " . $row['sversion'] . "<td style='color : black'>" . $row['sfold'] . "</td><td style='color : blue'>" . $row['ip'] . "</td><td style='color: blue'>" . $row['domaine'] . "</td></tr>";
    }
    $html_data .= "</table>";
    echo $html_data;
}

function csv($var) {
    $sql_version = "SELECT hardware.NAME AS 'hnom',softwares.NAME AS 'snom',softwares.VERSION AS 'sversion', softwares.FOLDER as 'sfold', hardware.IPADDR AS 'ip',hardware.WORKGROUP AS 'domaine' FROM hardware INNER JOIN softwares ON softwares.HARDWARE_ID =hardware.ID WHERE softwares.NAME='$var' ORDER BY softwares.VERSION";
    $query_version = mysqli_query($_SESSION['OCS']["readServer"], $sql_version);
    print "nom du PC;" . "Nom du logiciel;" . "Version du logiciel;" . "Repertoire;" . "Adresse IP;" . "Domaine;" . "\n\n\n";
    while ($row = mysqli_fetch_row($query_version)) {
        print '"' . stripslashes(implode('";"', $row)) . "\"\n";
    }
    exit;
}

?>