Ajout d'un champ group à la bdd, pour pouvoir distinguer plus tard les utilisateurs ayant le droit d'accéder à showgame etc.

This commit is contained in:
Georges Dupéron 2011-03-08 23:04:40 +01:00
parent 273040611b
commit e45e35a020
2 changed files with 5 additions and 4 deletions

View File

@ -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

View File

@ -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;