Jump to content


Photo

PHP time


  • Please log in to reply
8 replies to this topic

#1 deltajam_v

deltajam_v
  • Members
  • Pip
  • Newbie
  • 8 posts

Posted 25 September 2006 - 06:54 AM

Hi, I have a randomly created password that I would like to somehow automate to change everyday.  However, I would like that password to stay the same for 24hrs and then change.  Is there a way to automate this without creating a cron job?

#2 deltajam_v

deltajam_v
  • Members
  • Pip
  • Newbie
  • 8 posts

Posted 26 September 2006 - 03:06 PM

I jsut want the password to stay the same for 24hrs and then be randomly generated to cover another 24hr period.

#3 steveclondon

steveclondon
  • Members
  • PipPipPip
  • Advanced Member
  • 161 posts

Posted 26 September 2006 - 03:13 PM

if you want the script to run its self and generate the new code you need crontab

#4 deltajam_v

deltajam_v
  • Members
  • Pip
  • Newbie
  • 8 posts

Posted 26 September 2006 - 04:04 PM

what about something like this ...

1. Randomly generated password is created and written to a temp database field.
2. User attempts to login and the script checks the password used to enter with the password stored in the DB.
3. It also checks the date/time of the random pass, and verifies if its been a 24hrs or not
4. If it has been more than 24hrs since the last pass was generated, it generates a new password and stores it in the DB

might this work instead of using crontab?

Ps ... absolute newbie to crontab ... have no idea where I would start with that ...

Thanks



#5 Fehnris

Fehnris
  • Members
  • PipPipPip
  • Advanced Member
  • 48 posts

Posted 27 September 2006 - 06:30 AM

That would work although it wouldn't be that accurate in terms of having the password active for exactly 24hrs.  You would have to make sure that, to keep the 24hrs time frame, someone would login after the 24hr period has elapsed.  Would be fine for a high traffic website but could prove a problem for one with low traffic.

To be honest, crontab is the way to go.  It isnt to hard to set up once you know what your dealing with.

#6 deltajam_v

deltajam_v
  • Members
  • Pip
  • Newbie
  • 8 posts

Posted 28 September 2006 - 07:03 PM

I have zero experience with crontab.  My site is hosted with iPower ... so php & mySql.  I always thought cron was a linux thing ... excuse my ignorance please ..

#7 deltajam_v

deltajam_v
  • Members
  • Pip
  • Newbie
  • 8 posts

Posted 28 September 2006 - 10:10 PM

???

#8 roopurt18

roopurt18
  • Staff Alumni
  • Advanced Member
  • 3,749 posts
  • LocationCalifornia, southern

Posted 28 September 2006 - 10:49 PM

PHP and MySQL are what drive your website.  They're installed on webhost computer which can be running any server OS.  As long as the OS provides automated task scheduling, you can schedule your site to do anything.

Try going to http://www.google.com and searching for:
crontab
cron jobs

Look for the pages pointing back at wikipedia as a starting reference.
PHP Forms : Part I | Part II

JavaScript: Singleton

http://www.rbredlau.com

#9 Fehnris

Fehnris
  • Members
  • PipPipPip
  • Advanced Member
  • 48 posts

Posted 29 September 2006 - 07:14 AM

Sorry for the slow response, cron jobs are usually something provided as part of your web host control panel.  My webhost has cPanel which has an icon for Cron Jobs.  Check with iPower to see whether and how they offer Cron Jobs.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users