From: arun Date: Wed, 25 Apr 2007 08:17:43 +0000 (+0000) Subject: fix: hash collision after a game has been cancled and the gameid is being reused. X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f76fa7b25a6b09c2443680e1ae915cd949704d4e;p=e-DoKo.git fix: hash collision after a game has been cancled and the gameid is being reused. --- 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).