projects
/
cl7.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
MOD #138 : Stockage des passwords hashés
[cl7.git]
/
php
/
update_db.php
diff --git
a/php/update_db.php
b/php/update_db.php
index
66a3216
..
a2d9ffe
100644
(file)
--- a/
php/update_db.php
+++ b/
php/update_db.php
@@
-34,13
+34,14
@@
function creer_db()
UNIQUE (nom)
);
");
UNIQUE (nom)
);
");
+ // participants.password est un hash calculé à l'aide de sha1().
pg_query("
CREATE TABLE participants (
pg_query("
CREATE TABLE participants (
- id
serial
NOT NULL,
+ id
int
NOT NULL,
pseudo varchar(50) DEFAULT NULL,
clan_nom varchar(30) DEFAULT NULL,
clan_tag varchar(10) DEFAULT NULL,
pseudo varchar(50) DEFAULT NULL,
clan_nom varchar(30) DEFAULT NULL,
clan_tag varchar(10) DEFAULT NULL,
- password
varchar(1
0) DEFAULT NULL,
+ password
char(4
0) DEFAULT NULL,
nom varchar(30) DEFAULT NULL,
prenom varchar(30) DEFAULT NULL,
age varchar(30) DEFAULT NULL,
nom varchar(30) DEFAULT NULL,
prenom varchar(30) DEFAULT NULL,
age varchar(30) DEFAULT NULL,
@@
-105,12
+106,12
@@
function update_db()
# si la table 'config' n'existe pas alors on suppose qu'aucune table n'existe
$version = 0;
$res = @pg_fetch_object(pg_query("SELECT valeur FROM config WHERE nom = 'version'"));
# si la table 'config' n'existe pas alors on suppose qu'aucune table n'existe
$version = 0;
$res = @pg_fetch_object(pg_query("SELECT valeur FROM config WHERE nom = 'version'"));
- if (pg_result_status($res) != PGSQL_
COMMAND
_OK)
+ if (pg_result_status($res) != PGSQL_
TUPLES
_OK)
$version = $res->valeur;
if($version == 0)
{
$version = $res->valeur;
if($version == 0)
{
- echo "Création de la base de donnée, version = 1";
+ echo "Création de la base de donnée, version = 1
\n
";
pg_query("BEGIN");
creer_db();
initialiser_db();
pg_query("BEGIN");
creer_db();
initialiser_db();