Welcome Guest, Not a member yet? Register   Sign In
Temp Users
#1

[eluser]Think Floyd[/eluser]
Hi all,

I'm looking to create a "Temporary User" system, for the purpose of demo'ing a website I'm working on. I'm just after a little advice on how to approach this scenario.

My thoughts are that I would create a table in the DB with the following fields:

- id
- username
- password
- expiry date

So the issue is; how do I clear the rows where the expiry date has been exceeded in an automated fashion? Would this call for CRON jobs, or is there a more graceful solution?

Ta, and any help appreciated.
#2

[eluser]n0xie[/eluser]
This is what CRON jobs are made for.
#3

[eluser]Dam1an[/eluser]
Quote:Would this call for CRON jobs, or is there a more graceful solution?
What do you find to be ungraceful about cron jobs?

A non cron based solution (although messier and extra effort in the code) is to compare timestamps on a login attempt, and delete user if they're expired
#4

[eluser]Cro_Crx[/eluser]
I agree, cron job sounds the go on this one

If you don't have access to do this though you could set the sessions to expire when the users time is up, so they would be logged out, and on your login controller you could have it check the current timestamp against the users expiration date and throw an error if they have gone over time.
#5

[eluser]Think Floyd[/eluser]
Cheers chaps, useful info.. I will don the cron hat.




Theme © iAndrew 2016 - Forum software by © MyBB