if (!file_exists("php/config_bd.php"))
{
echo "Le fichier 'php/config_bd.php' n'existe pas, création en cours...\n";
- if (!is_writable("."))
+ if (!is_writable("php/"))
{
echo "Le dossier 'php' n'est pas accessible en écriture, veuillez changer les droits et recommencer.";
exit();
}
$f = fopen("php/config_bd.php", "w");
fwrite($f, '<?php # encoding:utf-8
- # Parametres de connexion MySQL
+ # Parametres de connexion à la BD
$SQL_HOTE = "localhost";
$SQL_LOGIN = "";
$SQL_PASS = "";
- $NOM_BASE = "corcelles_lan7";?>'
+ $NOM_BASE = "corcelles_lan_7";?>'
);
fclose($f);
echo "Le fichier a été créé, veuillez le compléter et recommencer.";
include_once("config_bd.php");
- $lien_mysql = mysql_connect($SQL_HOTE, $SQL_LOGIN, $SQL_PASS);
- if (!$lien_mysql || !mysql_select_db($NOM_BASE))
+ $conn_bd = pg_connect(sprintf("host=%s dbname=%s user=%s password=%s", $SQL_HOTE, $NOM_BASE, $SQL_LOGIN, $SQL_PASS));
+ if (!$conn_bd)
{
echo "Connexion à la base de données impossible. Voir le fichier 'php/config_bd.php'";
exit();
}
- mysql_set_charset("UTF8");
- mysql_query('SET AUTOCOMMIT=0');
-
if (isset($_POST['effacer_cookie'])) # le membre se délogue
{
setcookie("COOKIE_INFO_PARTICIPANT", "", time() - 100); # 'efface' le cookie membre
unset($_COOKIE["COOKIE_INFO_PARTICIPANT"]);
}
-
+
if (isset($_POST['log'])) # le membre se logue
{
$this->participant = new Participant($_POST['pseudo'], $_POST['password']);
- if ($this->participant->valide)
+ if ($this->participant->existe())
{
setcookie("COOKIE_INFO_PARTICIPANT", $this->participant->info->id, time() + 31104000);
$this->message_utilisateur = "Loggation ok";