fixed bug in gen_ids.php

$ids was never updated, so hash collisions would never be detected.

Also changed from global keyword to $GLOBALS superglobal (faster)