On Tue, 2008-12-16 at 09:56 +0100, Ondrej Kulaty wrote:
> Sorry you are right. He said he wants each row to have an unique ID so 
> AutoIncId+timestamp will satisfy it, But still i think that adding 
> microseconds timestamp is better because it will be harder for potential 
> hacker to guess.

I agree, but then each entry would need ot be updated individually.
Unfortunately MySQL doesn't appear to offer a time function to obtain
microseconds. However, using the same argument for non collision and
knowing that auto increment ID + unix_timestamp() must result in an
integer, one could use the following to produce a less guessable
outcome:

    update
        mytable
    set
        hash_field = md5( concat( AutoIdField + unix_timestamp(),
rand() ) )

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to