![]() |
|
#1
|
|||
|
|||
How do I automaticly update MySQL?I would like to make a system that will automaticly update some varables in my database at midnight.
|
|
#2
|
||||
|
||||
|
You can write a (PHP) script to do that and then just add a cron job to run it everyday at midnight.
__________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#3
|
|||
|
|||
|
When the 'cron job' tells my website to update I want to make sure that it's the cron job doing it and not anyone else so I plan on making the scrip say this.. $authentication = Get var along with cronjob if ( ! $authentication="password" ) { echo "You are not allowed here" } else { rest of scrip } |
|
#4
|
||||
|
||||
|
The last time I set up a cron job was probably over a year ago, so I am a bit rusty with the information and I had to look up a few things on PHP CLI before my reply.
Using your example PHP script above, I would re-write it a bit: PHP Code:
Now, for your cron job, you could simply put: /usr/local/bin/php -f /home/snapple/public_html/mycron.php authentication=your_secret_pass Try it and let me know how you get along... __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#5
|
|||
|
|||
Re: How do I automaticly update MySQL?hey. it's been like a year... and i'm still working on this cron job, haha. I can't figure out my path for the command line
|
|
#6
|
||||
|
||||
Re: How do I automaticly update MySQL?What exactly do you mean?
__________________
Common Sense v2.0-Striving to make the world a little bit smarter. |
|
#7
|
|||
|
|||
Re: How do I automaticly update MySQL?Actually it's fixed now. I had the path right but not something else. Now I need to see if I can get that autherisation code to work.
EDIT: it doens't work. the script if ( isset($_REQUEST['authentication']) and $_REQUEST['authentication']=='your_secret_pass' ) ... doesn't get anything from the cron job command ... authentication=your_secret_pass |
|
#8
|
|||
|
|||
Re: How do I automaticly update MySQL?does anyone have any idea?
|
|
#9
|
||||
|
||||
Re: How do I automaticly update MySQL?Does it work when you don't ask for authorization?
__________________
Common Sense v2.0-Striving to make the world a little bit smarter. |
|
#10
|
||||
|
||||
Re: How do I automaticly update MySQL?crystalattice asked a very good question.
Do you absolutely NEED to have this authorisation? What do I mean by this? You can also move this script up and away from your web root, so it is not possible for anyone to get to it. If that is all that you want, i.e. no one accessing / processing the page, than I recommend this instead. For example, all the PHP scripts on my network of sites that produce the Google Sitemaps are above the web root. Code:
With the proper permissions set for this file, no one will be able to "run" this script except yourself via the cronjob. __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
Recent GIDBlog
A Week in Kuwait by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| php and mysql | vladimy | MySQL / PHP Forum | 2 | 28-May-2005 05:17 |
| update view from a for loop | Rabbit_May | MS Visual C++ / MFC Forum | 0 | 25-Mar-2005 09:43 |
| Google Update and DeepCrawl Alert | JdS | Search Engine Optimization Forum | 24 | 16-Aug-2003 05:35 |
| Windows: From only £20p/y,Linux: from $10p/m. ASP, ASP.NET, PHP, Free MySQL, +More | EyotaHosts | Web Hosting Advertisements & Offers | 0 | 28-Jun-2003 13:54 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The