|
-
Aug 7th, 2008, 06:25 AM
#1
Thread Starter
Hyperactive Member
Something like "cron/scheduled task" to run php question
Dear all,
I have to write a website which can register member, keep pets and save their money in the bank. The website will be placed in win XP wamp server.
First, I have a situation. When a member registered an account in my website, he will receive an e-mail with a link, he must click the link to activate his account, otherwise after 24 hours later, the account will be automatically deleted by the system. So every member has his own count-down 24 hours respectively. I think cron/scheduled task can help me to do this task, but it seems that I need to run the php every second, minute or hours to access the database. That is a hard loading if my database has many members and waste the resources to handle this task.
-
Aug 7th, 2008, 02:17 PM
#2
Re: Something like "cron/scheduled task" to run php question
This should be the process:
1. Member Registers
2. Time Set To 24 hours past current time
3. Saved in Database
4. Email sent with a link that has a special confirmation number/hash
5. When they load the page to confirm, it check the database if 24 hours has past
6. If it is 24+, you can delete the account and tell them their time is past; or if it is 24- confirm account.
My usual boring signature: Something
-
Aug 8th, 2008, 06:45 AM
#3
Thread Starter
Hyperactive Member
Re: Something like "cron/scheduled task" to run php question
Ya, that's pretty nice job, but my aim is to save the memory of my database. If he never click the link, the row will keep in my database forever.
-
Aug 8th, 2008, 03:45 PM
#4
Re: Something like "cron/scheduled task" to run php question
thats where you run a cron job every month or so to delete the rows that are 24+
My usual boring signature: Something
-
Aug 9th, 2008, 12:15 AM
#5
Thread Starter
Hyperactive Member
Re: Something like "cron/scheduled task" to run php question
Thanks to your tips!I think I have an idea to handle the problem.
My second situation, I have a dummy online bank. The accrual is 0.05 per month. The accrual must be changed in every 3 months, so in one year, there is 4 times changing. How do the both of cron job and user trigger to cooperate with the banking system?
-
Aug 9th, 2008, 03:35 AM
#6
Re: Something like "cron/scheduled task" to run php question
Use a script triggered by a cron task to add the interest to all accounts at the end of every month (or week, or whenever you wish) and calculate the interest rate at that time.
-
Aug 9th, 2008, 09:36 AM
#7
Thread Starter
Hyperactive Member
Re: Something like "cron/scheduled task" to run php question
If the php has been run at the end of month, but some of the users doesn't reach "one month". As a result, should the program be run everyday to calculate how much of interest adding to accounts?
-
Aug 9th, 2008, 02:38 PM
#8
Re: Something like "cron/scheduled task" to run php question
that is a waste of memory. Because if you run that script every day, and it does through all of the records, that wastes memory.
I would do it on the 30th of every month and if the member has not been there a full month, then they wont get it until next month.
My usual boring signature: Something
-
Aug 10th, 2008, 01:43 AM
#9
Re: Something like "cron/scheduled task" to run php question
What exactly do you mean by "doesn't reach one month"? You could have a system where any accrued unpaid interest is paid out when an account is closed.
-
Aug 10th, 2008, 01:52 AM
#10
Re: Something like "cron/scheduled task" to run php question
he means like, they get x amount of interest per month, well what if they start in the middle of the month... they havn't been signed up for a fill month
My usual boring signature: Something
-
Aug 10th, 2008, 02:10 AM
#11
Re: Something like "cron/scheduled task" to run php question
Run the script at the end of month and calculate interest on a per-day basis. You do not need to run it every day to do this.
-
Aug 10th, 2008, 04:36 AM
#12
Thread Starter
Hyperactive Member
Re: Something like "cron/scheduled task" to run php question
ya, just like dclamp means.
I have $4000 and save it into bank at 15/8, and the program is run at the end of month, the interest is 0.05. Now I change the interest to 0.15 at 1/9, when at the end of september, my amount will be counted at 0.15 but not 0.05. This is the problem I worry about.
-
Aug 28th, 2008, 03:31 AM
#13
Re: Something like "cron/scheduled task" to run php question
 Originally Posted by dclamp
that is a waste of memory. Because if you run that script every day, and it does through all of the records, that wastes memory.
I would do it on the 30th of every month and if the member has not been there a full month, then they wont get it until next month.
February doesn't have 30 days...
-
Aug 28th, 2008, 04:45 AM
#14
Re: Something like "cron/scheduled task" to run php question
Thirty days has September, April, June, February and November,
All the rest has thirty one, except February alone,
Which has thirty days clear,
And twenty nine in each leap year.
Nahh, it doesn't sound right.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|