<?
/**
* MiniClick
* Gestionnaire de tableau collaboratif
* Copyright (C) 2006 Guillaume Monet <gm@ibreizh.net>
*
* This program 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
* any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 
*
* @package miniclick
* @version 5.0.0
*/
include("../connection/connection.php");
mysql_connect ($host,$user,$pass);
$base = mysql_select_db($db);
if(!$base){
        die("Impossible de se connecter  la base");
}
$action = strip_tags($_GET['action']);
$table = strip_tags($_GET['table']);
$object_id = strip_tags($_GET['id']);
$colonne_id = strip_tags($_GET['colonne']);
$value = strip_tags($_GET['val']);
if($action == "SEND"){
	//On cree le trigger
	mysql_query("INSERT INTO TRIGGER VALUES('','$table','$object_id','$colonne_id','$value')");
	sleep(20);
//on supprimer le trigger
	mysql_query("DELETE FROM TRIGGER WHERE Table_Id = '$table' AND Object_Id = '$object_id' AND Colonne_Id = '$colonne_id' AND NewValue = '$value'");
	echo "INSERT INTO TRIGGER VALUES('','$table','$object_id','$colonne_id','$value')";
}else{
	$table = strip_tags($_GET['table']);
	//tant qu'un trigger n'est pas creer on ne fait rien ;-)
	$trigger_arrays = mysql_query("SELECT NewValue,Object_Id,Colonne_Id,Table_Id FROM TRIGGER WHERE Table_Id = '$table'");
	$trigger_value = mysql_fetch_object($trigger_arrays);
	echo "$table;$trigger_value->Object_Id;$trigger_value->Colonne_Id;$trigger_value->NewValue;";
}

?>