PDA

View Full Version : How to Create a Cron Job


JorgeX
03-10-2007, 11:46 PM
Hi, can somebody tell me how to create a Cron Job and if possible, an example.......

i want to create a hack because nobody can do it, https://vborg.vbsupport.ru/showthread.php?t=141150

First, i wan't to learn how to close the auction automacally in $expiredays (for example, setted by the user.

Thanks

raywjohnson
05-10-2007, 08:49 PM
a very basic cron:


<?php
/*================================================= ==*\
|| ################################################# ||
|| # CRON_NAME Created By AUTHOR ||
|| ################################################# ||
\*================================================ ===*/

// Look through the ./includes PHP files for functions

// ---------------------------------------------------
// Start Set PHP Environment
// ---------------------------------------------------

error_reporting(E_ALL & ~E_NOTICE);
if (!is_object($vbulletin->db)) { exit; }

// ---------------------------------------------------
// Start Cronjob
// ---------------------------------------------------

$results = $vbulletin->db->query_read(YOUR_QUERY);

while ($rec = $vbulletin->db->fetch_array($results))
{
//do somegthing with the record
}


//log something (errors, success, etc)
log_cron_action('LOG_MESSAGE', $nextitem);

// ---------------------------------------------------
// End Cronjob
// ---------------------------------------------------
?>


If you do not know any PHP/MySQL then creating your own cron out of the question.

--RayJ

TCooper
12-23-2007, 03:44 AM
what does the $nextitem do?

MoT3rror
12-23-2007, 05:07 AM
$nextitem is an array containing the information for this cronjob