On 28 Sep 2004, at 17:13, Morgan wrote:

I need to write a bit of code that changes the password of a single user once a week. Essentially, I need something that will count down the mins or hours etc. OR run once a night say at like 3:am and check the date of this users PW info and if its over 7 days to generate a new one. Where should I start? What 4D thing should I be looking at? Any help would be greatly appreciated. Thanks.

You can do this type of thing entirely within 4D itself (no need for A4D on this occasion), just by running a stored method which triggers at a certain day and time each week and changes a record somewhere.


So, assuming that you are using a server and clients, add a line to you 'On Server Startup' method in Database Methods, something like:

$new:=New process("NightlyUpdate";64000;"Nightly Update Process")

The NightlyUpdate method will look something like this...

======

$delay:=60*60*30  ` 30-minute delay
$tUpdateTime:=†05:00:00†
$yUpdatedToday:=False

While (Not(Process aborted))  ` this will keep looping until you Quit
Case of
: ((Current time<$tUpdateTime) & ($yUpdatedToday=True))
$yUpdatedToday:=False
: (Current time>=$tUpdateTime) & ($yUpdatedToday=False)
  `it's time to do the daily update ...

DO SOMETHING OR OTHER HERE

End case   ` time to update
DELAY PROCESS(Current process;$delay)
End while   ` (Not (Process aborted))

======

Hope this helps.

David Wright

_______________________________________________
Active4D-dev mailing list
[EMAIL PROTECTED]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Reply via email to