summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorarun <arun@nubati.net>2007-04-25 08:17:43 +0000
committerarun <arun>2007-04-25 08:17:43 +0000
commitf76fa7b25a6b09c2443680e1ae915cd949704d4e (patch)
tree3972825ddf85258ddf6a01f6b91e9e838477ae1b
parent3f0e64bb007762df358925569e980a7718ff033d (diff)
downloade-DoKo-f76fa7b25a6b09c2443680e1ae915cd949704d4e.tar.gz
e-DoKo-f76fa7b25a6b09c2443680e1ae915cd949704d4e.tar.bz2
e-DoKo-f76fa7b25a6b09c2443680e1ae915cd949704d4e.zip
fix: hash collision after a game has been cancled and the gameid is being reused.
-rw-r--r--index.php9
1 files changed, 5 insertions, 4 deletions
diff --git a/index.php b/index.php
index 989a547..83c8cb7 100644
--- a/index.php
+++ b/index.php
@@ -109,10 +109,11 @@ if(myisset("new"))
$game_id = mysql_insert_id();
/* create hash */
- $hashA = md5("AGameOfDoko".$game_id.$PlayerA.$EmailA);
- $hashB = md5("AGameOfDoko".$game_id.$PlayerB.$EmailB);
- $hashC = md5("AGameOfDoko".$game_id.$PlayerC.$EmailC);
- $hashD = md5("AGameOfDoko".$game_id.$PlayerD.$EmailD);
+ $TIME = (string) time(); /* to avoid collisions */
+ $hashA = md5("AGameOfDoko".$game_id.$PlayerA.$EmailA.$TIME);
+ $hashB = md5("AGameOfDoko".$game_id.$PlayerB.$EmailB.$TIME);
+ $hashC = md5("AGameOfDoko".$game_id.$PlayerC.$EmailC.$TIME);
+ $hashD = md5("AGameOfDoko".$game_id.$PlayerD.$EmailD.$TIME);
/* create hands */
mysql_query("INSERT INTO Hand VALUES (NULL,".DB_quote_smart($game_id).",".DB_quote_smart($useridA).