<?php
session_start();
include('config/aristodefcondb.inc');
// On se connecte à la base de données.
@mysql_connect(ADBASE,LOG,MDP)or die("<br> CONNEXION MYSQL IMPOSSIBLE.<BR>Les paramètres de connexion sont incorrects.<BR>
<a href='plugins/paramspip/fichiers/dir".$_SESSION['idarticle']."/relance.php' >Relancez l'installation</a>");
@mysql_select_db(BASE) or die("<br> CONNEXION MYSQL IMPOSSIBLE.<BR>Les paramètres de connexion sont incorrects.<BR>
<a href='plugins/paramspip/fichiers/dir".$_SESSION['idarticle']."/relance.php' >Relancez l'installation</a>");
// Fonction qui vérifie que la table contient tous les champs.
function CheckTable() {
$query1="SELECT id FROM aristojchatx";
$result1=mysql_query($query1) ;
$query2="SELECT pseudo FROM aristojchatx";
$result2=mysql_query($query2) ;
$query3="SELECT message FROM aristojchatx";
$result3=mysql_query($query3) ;
$query4="SELECT heure FROM aristojchatx";
$result4=mysql_query($query4) ;
$query5="SELECT ip FROM aristojchatx";
$result5=mysql_query($query5) ;
$query6="SELECT nomlogo FROM aristojchatx";
$result6=mysql_query($query6) ;
$query7="SELECT nbsecondes FROM aristojchatx";
$result7=mysql_query($query7) ;
$result= (($result1) and ($result2) and ($result3) and ($result4)and($result5)and($result6)and($result7));
if ($result==true) return true;
else return false;
}
// Fonction qui crée la table après avoir éventuellement écrasé l'ancienne.
function CreateTable() {
mysql_query("DROP table aristojchatx");
$query="CREATE TABLE aristojchatx (
id int PRIMARY KEY auto_increment,
pseudo varchar(15) NOT NULL,
message text NOT NULL,
heure varchar(25) NOT NULL,
nbsecondes int NOT NULL,
ip varchar(15) NOT NULL,
nomlogo varchar(100) NOT NULL)";
$result=mysql_query($query) or die();
}
// Si la table n'existe pas ou n'est pas conforme, on la crée.
if ( CheckTable()==false) CreateTable();
?>