commit e45e35a0206f5a34c123d3e68bcfb6cfd1667958
parent 273040611b1557f065179de8043fed661ae48d41
Author: Georges Dupéron <jahvascriptmaniac+github@free.fr>
Date: Tue, 8 Mar 2011 23:04:40 +0100
Ajout d'un champ group à la bdd, pour pouvoir distinguer plus tard les utilisateurs ayant le droit d'accéder à showgame etc.
Diffstat:
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/code/serveur/dump2sqlite.sh b/code/serveur/dump2sqlite.sh
@@ -18,6 +18,7 @@ echo >&2
# Played_game(type) : 0 => partie de référence, 1 => joueur
# Note : l'index i_played_game_all sert à la vérification lors du set_partie.
# Note : le echo | dd | md5 permet de ne pas avoir le \n, y compris sur les versions de sh sous mac boguées qui ne supportent pas «echo -n»
+# Valeurs pour le champ group dans user : 1 = player, 2 = admin
cat <<EOF
begin transaction;
@@ -25,7 +26,7 @@ create table node(eid integer primary key autoincrement, name, type, weight);
create table relation(rid integer primary key autoincrement, start, end, type, weight);
create table type_node(name, num);
create table type_relation(name, num, extended_name, info);
-create table user(login primary key, mail, hash_passwd, score);
+create table user(login primary key, mail, hash_passwd, score, group);
create table game(gid integer primary key autoincrement, eid_central_word, relation_1, relation_2, difficulty);
create table game_cloud(gid, num, difficulty, eid_word, totalWeight, probaR1, probaR2, probaR0, probaTrash);
create table played_game(pgid integer primary key autoincrement, gid, login, timestamp);
@@ -33,7 +34,7 @@ create table played_game_cloud(pgid, gid, type, num, relation, weight, score);
create table random_cloud_node(eid,nbneighbors);
create table random_center_node(eid);
-insert into user(login, mail, hash_passwd, score) values('$(echo "$user" | sed -e "s/'/''/g")', 'foo@isp.com', '$(echo "$passwd" | dd bs=1 count="${#passwd}" | (if which md5sum >/dev/null 2>&1; then md5sum; else md5; fi) | cut -d ' ' -f 1)', 0);
+insert into user(login, mail, hash_passwd, score, group) values('$(echo "$user" | sed -e "s/'/''/g")', 'foo@isp.com', '$(echo "$passwd" | dd bs=1 count="${#passwd}" | (if which md5sum >/dev/null 2>&1; then md5sum; else md5; fi) | cut -d ' ' -f 1)', 0, 1);
EOF
# tr : pour virer le CRLF qui traîne
diff --git a/code/serveur/php/signup.php b/code/serveur/php/signup.php
@@ -79,10 +79,10 @@ if(isset($_POST['signuppswd2'])){
if(count($msg) == 0 && $newpage == false)
{
- $ok = ($db->query("INSERT INTO user(mail, login, hash_passwd, score) VALUES ('" . SQLite3::escapeString($signupemail)
+ $ok = ($db->query("INSERT INTO user(mail, login, hash_passwd, score, group) VALUES ('" . SQLite3::escapeString($signupemail)
. "', '" . SQLite3::escapeString($signupid)
. "', '" . SQLite3::escapeString(md5($signuppswd1))
- . "', 0);"));
+ . "', 0, 1);"));
if($ok == true) {
$_SESSION['userId'] = $signupid;