Re: Re: Create unique non-autoincrement key for700,000records?
| From: | Ashley Sheridan | Date: | Tue, 16 Dec 2008 20:17:07 +0000 |
| Subject: | Re: Re: Create unique non-autoincrement key for700,000records? | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-284679@lists.php.net to get a copy of this message | ||
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.
> --
>
>
> S pozdravem
> Ondej Kulat
> ---------------------
> Winternet s.r.o.
> odd. vvoje aplikac
> tel. 585 209 132
> www.winternet.cz
>
> "Robert Cummings" <robert@interjinn.com> pe v diskusnm pspvku
> news:1229416450.9173.46.camel@localhost...
> > On Tue, 2008-12-16 at 09:21 +0100, Ondrej Kulaty wrote:
> >> I think he knows how to use it, he didn't show us a certain example where
> >> and how he wants to use it, i just posted the way how i do generate an
> >> unique identifier, if he use the first mentioned way -
> >> AutoIncID+unix_timestamp - there can be a collision, when two users will
> >> attempt to perform this task on the same id at the same time. yes, it's
> >> not
> >> very probable but if you have system with many users it can happen
> >
> > No it's impossible. Auto increment guarantees a unique auto incremented
> > ID. Adding the value returned by unix_timestamp() to this unique ID can
> > only create unique sums since both the auto increment ID and the time
> > are increasing. There cannot be a collision.
> >
> > Cheers,
> > Rob.
> > --
> > http://www.interjinn.com
> > Application and Templating Framework for PHP
> >
>
>
>
Surely better than creating some complex method by which to reference
the row, is to use methods of sanitising input that would prevent a
hacker from manipulating your queries?
Ash
www.ashleysheridan.co.uk