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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
| <?
if (!isset($_SESSION)) {
session_start();
}
?>
<?php require_once('../../Connections/chatgr.php'); ?>
<?php
GLOBAL $database_chatgr;
GLOBAL $chatgr;
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?>
<?php // SELECTION DU CLIENT
$colname_CLIENT = "-1";
if (isset($_GET['id_client'])) {
$colname_CLIENT = (get_magic_quotes_gpc()) ? $_GET['id_client'] : addslashes($_GET['id_client']);
}
mysql_select_db($database_chatgr, $chatgr);
$query_CLIENT = sprintf("SELECT * FROM sdd_client WHERE id_client = %s", GetSQLValueString($colname_CLIENT, "int"));
$CLIENT = mysql_query($query_CLIENT, $chatgr) or die(mysql_error());
$row_CLIENT = mysql_fetch_assoc($CLIENT);
$totalRows_CLIENT = mysql_num_rows($CLIENT);
?>
<?
//*********************************************************************************************************//
//***************************************INSERTION DANS LA TABLE ACTIVITE A CHAQUE MODIF*******************//
function trace_modif($text1, $text2) {
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL2 = sprintf("INSERT INTO sdd_suivi ( identite, suivi, type, `date`) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_SESSION['MM_Username'], "text"),
GetSQLValueString($text1, "text"),
GetSQLValueString($text2, "text"),
GetSQLValueString(date('Y-m-d'), "date"));
mysql_select_db($database_chatgr, $chatgr);
$Result1 = mysql_query($updateSQL2, $chatgr) or die(mysql_error());
}
}
//**************************************************FIN****************************************************//
?>
<? // SUIVI DES MODIFICATIONS TABLE
trace_modif("Modification","TEST"); // L'appel de la fonction fait planter
?>
<? // UPDADTE DES MODIFICATIONS
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE sdd_client SET societe=%s, civilite=%s, nom=%s, prenom=%s WHERE id_client=%s",
GetSQLValueString($_POST['societe'], "text"),
GetSQLValueString($_POST['civilite'], "text"),
GetSQLValueString($_POST['nom'], "text"),
GetSQLValueString($_POST['prenom'], "text"),
GetSQLValueString($_POST['id_client'], "int"));
mysql_select_db($database_chatgr, $chatgr);
$Result1 = mysql_query($updateSQL, $chatgr) or die(mysql_error());
$updateGoTo = "/db/client/edit.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
?> |
Partager