I know a hash-function named rolling hash. It works fine when you consider
multiple user for multiple session.

On Wed, Jul 1, 2009 at 11:02 AM, brian <[email protected]> wrote:

>
> I wouldn't bother trying to include (and parse out) the date in the
> hash. Create a table to store the hashes and include a "created
> DATETIME DEFAULT NULL" column. This way, you can later use your DB's
> date/time functions to check if it's within the 48 hours. When the
> hash is used, remove it from the DB.
>
> On Tue, Jun 30, 2009 at 7:51 PM,
> DigitalDude<[email protected]> wrote:
> >
> > Hey,
> >
> > I need a way to generate a hash code, which is valid 48 hrs. after it
> > has been generated. I need this to register my users and to activate
> > them.
> >
> > I have the problem that this code below does generate a hash for 2
> > days, but this will cause problems when a user registers at 23:56, so
> > the hash will only be valid for the next day because it does not hash
> > correctly. I need a generation in hours, but I can't figure out how to
> > do that.
> >
> > Here's what I got so far...:
> >
> > return substr(Security::hash(Configure::read('Security.salt') . $this-
> >>field('created') . date('Y-m-d', strtotime("+2 days"))), 0, 20);
> >
> > The hash is generated by hashing the security salt, the date the user
> > is created and the actual date + 2 days. It should contain 20 digits.
> > When I try to put +48 hrs into the code instead of +2 days the hash
> > will not be accepted anymore.
> >
> > Would be nice if someone could help me on this one...
> > >
> >
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to