|
-
September 4th, 2006, 07:22 PM
#1
[RESOLVED] PHP on its own
Is PHP capable of doing some things on its own?
For example, when user buy "ticket" it is valid for 10 days.
Now if he bought it at 2006-09-05, it is valid until 2006-09-15(this date included).
Now we are coming to "PHP on its own"...
At that exact moment of shifting from 2006-09-15 to 2006-09-16 date "something"(on its own) should check tables and search for all userids that have expire date set to 2006-09-15 and UPDATE status of those users form upgraded to free.
I first time came to this kind of problem and don't know how to solve it.
-
September 5th, 2006, 05:26 AM
#2
Re: PHP on its own
yes, please if anybody knows do tell i'm hitting a simular issue
-
September 5th, 2006, 07:48 AM
#3
Re: PHP on its own
No. PHP does not do anything "on its own," as you say. It must be called to the interpreter. You can write code to do that changing, but it must be run by a CRON job, or by the loading of the PHP page.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
September 5th, 2006, 08:38 AM
#4
Re: PHP on its own
Then how you would solve this issue?
Befor posting this issue, in my head, only logical solution was to log in to admin area every midnight (which might get little frustrating over a time) and hit a button, which would iniciate and start "moving" querys that would to that.
I can make it happen when I only log in like admin, too, without hiting a button, but I passed on that one because it must be a server midnight time.
What is a CRON job?
Searching the internet...
Cron is the name of program that enables unix users to execute commands or
scripts (groups of commands) automatically at a specified time/date. It is
normally used for sys admin commands, like......
Is there alternative...?
-
September 5th, 2006, 09:04 AM
#5
Re: PHP on its own
The only way to do it is to have someone/thing load the PHP page which will alter the times.
Now, if you want to have a scheduled application do it, then fine. What OS is your server?
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
September 5th, 2006, 11:02 AM
#6
Re: PHP on its own
Well my developing enviroment is WinXP with PHP 5.1.5 and Apache 2.2.2.
also here is photoshop 9(CS2) and Dreamweaver 8....
Those aps can't be run on FreeBSD 6.1, which is OS of my choice for server.
Second reason is that I still don't know FreeBSD 6.1, I only passed installation sucessfully...
I have a book for learning FreeBSD and I finished about 20% of it...
But I will take my full time and learn FreeBSD (oh well, here goes JavaScript being delayed again) when I end my script which is close to an end.
Ok, now I will make that script "PHP on its own" part and then name it reload.php
After that I will set up CRON with date/time and point it to the reload.php
... and that is about it..., is it?
PS: Those that learned FreeBSD...
Compared in time consumption to PHP - MySQL to be learned, how much time does it take for FreeBSD?
-
September 5th, 2006, 11:34 AM
#7
Re: PHP on its own
Well, concerning FreeDSB, if you want to make it easy, use DesktopBSD.
If you are going to use Windows XP, just use a scheduled task and run it at the time that you want.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
September 5th, 2006, 01:21 PM
#8
Re: PHP on its own
Well looking at http://www.desktopbsd.net/ I can say it looks good.
It would be great if server is mine. But it isn't.
I have an eye on http://www.sharktech.net/?ID=managed
Plan 2.
I will tell them to install FreeBSD 6.1 for me.
That means no workaround for me but to learn it.
Regarding "PHP on its own" I've came to an idea. But it would work only if your site is under constant high volume traffic.
If script is consisted of 15 files like: bla1.php, bla2.php, bla3.php, bla4.php, ....
then in each I would have to insert same code from reload.php that would normaly be activated by cron.
Script would check is it midnight or midnight +5min toleration and has it already been parsed for that day(this is checked by conecting to db).
If not, it would do it's yob.
No matter what are users doing, login in, loging out, sending mails , going from one page to another with each of theirs interaction with script they would allways "touch it" and it would allways chech for those 2 rules.
If both true, it kicks in.
-
September 5th, 2006, 01:29 PM
#9
Re: PHP on its own
Basically, your best option is to code a JavaScript clock. When that clock hits midnight, tell it to load the PHP file.
I say "best option" because it sound more to the easy way you want.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
September 5th, 2006, 01:40 PM
#10
Re: PHP on its own
Nah....
I'll go with unix & cron yob...
That is the only right way.
Thanks anyway.
-
September 5th, 2006, 02:29 PM
#11
Re: PHP on its own
Oh okay. I thought you weren't going to use the CRON job. Good. choice. It is much smarter, efficietnt, and stable.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
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
|