<?php
#########################################################################################
# Requête pour crée la table élève de Pnyx #
# Auteur : B. Leblanc #
# Création : 2008-06-14 #
# Modification : 2008-07-01 #
# #
# Pnyx - une application Web (PHP/MySQL) d'élections virtuelles conçue pour des élèves #
# du primaire et du secondaire, dans lequel ils sont amenés à faire des propositions #
# en ligne et voter pour leur favorite, sous la supervision d'un enseignant. #
# #
# Copyright (C) <2008 - 2009> #
# <Service national du RÉCIT de l'univers social de la Commission scolaire de la #
# Pointe-de-l'Île> #
# #
# 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. #
# 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 as the file LICENSE.txt; if not, please see #
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. #
# #
# Service national du RÉCIT de l'univers social #
# http://www.recitus.qc.ca #
# Contact e-mail : steve-hide@address.com #
#########################################################################################
@session_start();
if(@$HTTP_SESSION_VARS['ERREUR'] == ""){
$UTILISATEUR = $_POST['utilisateur'];
$MOT_DE_PASSE = $_POST['motPasse'];
$HOST = $_POST['host'];
$BD = $_POST['bd'];
header('Content-Type: text/html; charset=ISO-8859-1');
$connection = mysql_connect($HOST,$UTILISATEUR,$MOT_DE_PASSE) or die("Impossible de se connecter : " . mysql_error());
// Sélectionne une base de données MySQL, si cela n'est pas possible alors fin de l'exécution du code
if (!mysql_select_db($BD)){
die("Impossible d'accéder à la base de données : " . mysql_error());
}
### Table eleve ###
if(mysql_query("CREATE TABLE `eleve` (
`eleve_id` int(6) unsigned NOT NULL auto_increment,
`nom` varchar(100) NOT NULL,
`prenom` varchar(100) NOT NULL,
`sexe` char(1) NOT NULL,
`groupe_id` int(6) NOT NULL default '0',
`usager_id` int(6) NOT NULL default '0',
`fiche_id` int(6) NOT NULL default '0',
`valide` int(1) NOT NULL default '0',
`date_valide` date NOT NULL default '0000-00-00',
`candidat` int(1) NOT NULL default '0',
`vote` int(1) NOT NULL default '0',
`fiche_vote` int(6) NOT NULL default '0',
`justification` text NOT NULL,
`projet_id` int(6) NOT NULL default '0',
PRIMARY KEY (`eleve_id`),
KEY `groupe_id` (`groupe_id`),
KEY `usager_id` (`usager_id`),
KEY `fiche_id` (`fiche_id`),
KEY `projet_id` (`projet_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;")){
$html = "Table eleve créée<br />";
}
else{
$html = "Erreur : Une erreur est survenue. Elle peut-être liée à de mauvaises informations fournies à l'étape précédente.";
$html .= "<form id=\"frmEtape\" action=\"install.php\" method=\"post\">";
$html .= "<input type=\"hidden\" id=\"etape\" name=\"etape\" value='" . 2 . "' />";
$html .= "<input type=\"submit\" value=\"Retour à l'étape 2\" />";
$html .= "</form>";
$HTTP_SESSION_VARS['ERREUR'] = "true";
}
mysql_close($connection);
echo $html;
}
?>