# Copyright (c) 2007 Erwan Briand # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation # # 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # ***** END LICENSE BLOCK ***** include("include/config.inc.php"); $ida = $_GET['ida']; //fichier désiré $idb = $_GET['idb']; //url projet $result = mysql_query("SELECT * FROM ct2_os_nb WHERE fichier = '$ida' "); if (mysql_num_rows($result) == 0) { $ma = mysql_query("SELECT * FROM ct2_os WHERE adresse = '$idb' "); $mb = mysql_fetch_array($ma); $projetnew = $mb['id']; mysql_query("INSERT INTO ct2_os_nb (projet,fichier,nb) VALUES ('$projetnew','$ida','1') ") or die (mysql_error()); } else { $ma2 = mysql_query("SELECT * FROM ct2_os_nb WHERE fichier = '$ida' "); $mb2 = mysql_fetch_array($ma2); $projetnew = $mb2['projet']; $nb = $mb2['nb']; $nbnew = $nb+1; mysql_query("UPDATE ct2_os_nb SET projet='$projetnew', fichier='$ida', nb='$nbnew' WHERE fichier='$ida' ") or die (mysql_error()); } if (file_exists($racine."/".$ida)) { Header("Location: ".$racine."/".$ida); } else { Header("Location: ".$ida); } ?>