Author Topic: Cron Job Help  (Read 411 times)

Offline Slashmore

  • Level 17
  • *
  • Posts: 156
  • Reputation: +1/-0
    • View Profile
Cron Job Help
« on: August 15, 2009, 06:54:12 PM »
I've never used a cron job and now I think the time has come.

Every 24 hours x amount of bullets get added to each store in each location, To do this I think I cron job would be best but I wouldn't know where to start if I'm going to use a cron job. Do I make a new php page and every time the cron hits it the page adds those x bullets?

- Slash

Offline toxin

  • Level 21
  • *
  • Posts: 231
  • Reputation: +4/-2
    • View Profile
    • Encore Montreal
Re: Cron Job Help
« Reply #1 on: August 15, 2009, 07:12:07 PM »
Yes you would just create a page just for the cron job. Nothing big just database connection and a query is all that would be needed. You would than go into your host control panel and set it up there. Each host have different set ups so I am not much help there.
Also try not to name it something easy. You could have a GET validation in it also.

daycorn.php
Code: [Select]
<?php
if($_GET['val]')!="val")
{
die(
"Error or redirect");
}
include 
"DBcon.php";
$num=rand(1,25);
mysql_query("UPDATE shop set ammo=$num"):
mysql_query("UPDATE user dayold=dayold+1");
?>


Offline Slashmore

  • Level 17
  • *
  • Posts: 156
  • Reputation: +1/-0
    • View Profile
Re: Cron Job Help
« Reply #2 on: August 15, 2009, 08:21:05 PM »
I've been reading on Google about the host part. Thanks!


 


SimplePortal 2.3.3 © 2008-2010, SimplePortal