-
Notifications
You must be signed in to change notification settings - Fork 3
/
choisir_client.php
executable file
·46 lines (46 loc) · 1.75 KB
/
choisir_client.php
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
<?php
/*
* Factux le facturier libre
* Copyright (C) 2003-2005 Guy Hendrickx, 2017 Thomas Ingles
*
* Licensed under the terms of the GNU General Public License:
* http://opensource.org/licenses/GPL-3.0
*
* For further information visit:
* http://factux.free.fr
*
* File Name: choisir_client.php
* choix des client pour utilisateurs restreinds
*
* * * Version: 5.0.0
* * * * Modified: 07/10/2016
*
* File Authors:
* Guy Hendrickx
*.
*/
require_once("include/verif.php");
include_once("include/config/common.php");
include_once("include/config/var.php");
include_once("include/language/$lang.php");
$login=isset($_POST['login'])?$_POST['login']:"";
//on recupere le num user
$sql = "SELECT num FROM " . $tblpref ."user WHERE login = '".$login."'";
$result = mysql_query($sql) or die("<p>Erreur Mysql<br/>$sql<br/>".mysql_error()."</p>");
$num_user = mysql_result($result, 0);
$num_user_vir = "$num_user," ;
//on extrait les variables du select multiple
$nbr_li = isset($_POST['client'])?count($_POST['client']):0;#si vide = notice
$message=($nbr_li)?"<h2>$lang_suite_edit_utilisateur_succes</h2>":"<h1>$lang_au_cli_choi</h1>";
for($i=0;$i<=($nbr_li - 1);$i++){
//on trouve le contenu actuel de permi
$num_client = $_POST['client'][$i];
$sql3 = "SELECT permi FROM " . $tblpref ."client WHERE num_client = '".$num_client."'";
$result = mysql_query($sql3) or die("<p>Erreur Mysql<br/>$sql3<br/>".mysql_error()."</p>");
$permi_av = mysql_result($result, 0);
$permi = "$permi_av$num_user_vir";
//on introduit les variables dans la base
$sql2 = "UPDATE " . $tblpref ."client SET permi='$permi' WHERE num_client = '".$num_client."'";
mysql_query($sql2) OR die("<p>Erreur Mysql<br/>$sql2<br/>".mysql_error()."</p>");
}
include_once("edit_utilisateur.php");