/* les paramètres passés au script :
order= liste indéxé
nav= index de navigation
recherche=texte recherché
*/
error_reporting(0);
$order=$_GET['order'];
$nav=$_GET['nav'];
$recherche=$_GET['recherche'];
include("class.FastTemplate.php3");
$config["host"] = "mysql-alixan.inforoutes.fr";
$config["user"] = "admspipeldin";
$config["password"] = "6VVwHP9njsyqakut";
$config["usertable"] = "zoom505";
$config["cattable"] = "zoomcat";
$config["db"] = "spipeldin";
$NB=50;
$modif_patch=0;
$pagetitle = "Patches ZOOM 505, V 1.4";
// Les appels a la base de données
Class Zoom505DB
{
var $CONFIG = array();
var $DB;
var $DB_RESULT;
var $DB_USER_RESULT;
var $LOOP_COUNT;
var $LOOP_END;
function error($text = "Erreur MySQL !") {
$no = mysql_errno();
$msg = mysql_error();
echo "$text - Erreur n°: $no Message Mysql : $msg \n";
exit;
}
// Constructor
function Zoom505DB($cfg) {
$this->CONFIG = $cfg;
}
function init () {
$user = $this->CONFIG["user"];
$server = $this->CONFIG["host"];
$pass = $this->CONFIG["password"];
$dbase = $this->CONFIG["db"];
$conn = mysql_pconnect($server, $user, $pass);
if(!$conn) {
$this->error("Impossible de se connecter !");
}
if(!mysql_select_db($dbase,$conn)) {
$this->error("Echec de connexion à la Base");
}
$this->CONN = $conn;
return true;
}
function get_newsrow_init ($st,$nb,$r,$o) {
$queryr=" and (nom like '%$r%' or effet like '%$r%' ) ";
$table = $this->CONFIG["usertable"];
$tablec = $this->CONFIG["cattable"];
// $query = "SELECT * FROM $table ORDER BY nom LIMIT $st,$nb";
// $query = "SELECT *,$table.nom as NOM FROM $table order by $table.nom LIMIT $st,$nb";
$query = "SELECT * FROM $table,$tablec where $tablec.id=$table.type";
if ($r) $query.=$queryr;
if ($o) { $query.=" order by $table.$o,$table.nom LIMIT $st,$nb"; }
else{$query.=" order by $table.nom LIMIT $st,$nb"; }
$result = mysql_query($query) or $this->error("DB Error!");
$this->DB_RESULT = $result;
return true;
}
function get_patche ($nb,$r) {
$queryr=" and (nom like '%$r%' or effet like '%$r%') ";
$table = $this->CONFIG["usertable"];
$query = "SELECT * FROM $table where id=$nb";
if ($r) $query.=$queryr;
$result = mysql_query($query) or $this->error("DB Error!");
$this->DB_RESULT = $result;
return true;
}
function get_newsrow () {
$result = $this->DB_RESULT;
$row = mysql_fetch_array ($result);
return $row;
}
function insert_patche ($n,$e,$c,$d,$g,$z,$eq,$m,$dl,$l) {
$table = $this->CONFIG["usertable"];
$query = "insert into $table values (
'$n','$e','$c','$d','$g','$z','$eq','$m','$dl','$l',0,'')";
$result = mysql_query($query) or $this->error("DB Error!");
return $result;
}
function update_patche ($i,$n,$e,$c,$d,$g,$z,$eq,$m,$dl,$l) {
$table = $this->CONFIG["usertable"];
$query = "update $table set nom='$n',effet='$e',comp='$c',dist='$d',gain='$g',znr_amp='$z',eq='$eq',mod='$m',dly_rev='$dl',level='$l' where id=$i";
$result = mysql_query($query) or $this->error("DB Error!");
return $result;
}
function get_nrow ($r) {
$queryr=" where nom like '%$r%' or effet like '%$r%' ";
$table = $this->CONFIG["usertable"];
$query = "SELECT count(*) FROM $table ";
if ($r) $query.=$queryr;
$result = mysql_query($query) or $this->error("DB Error!");
$row = mysql_fetch_array ($result);
return $row[0];
}
}
function var_module($v1,$v2,$v3,$v4,$v5,$v6,$v7 ) {
// $v1 la valeur de la BdD
// $v2 la valeur a tester
// $v4 le libelé de la variable
// $v5 la variable array
// $v6 le nom de l'objet
// $v7 le nom du block
global $tpl;
if (strtoupper($v1) != strtoupper($v2) ) {
$tpl->assign(array( $v5 => "