Location: PHPKode > projects > Crown of Evanion > final/cron.php
<?php
/*
*   This file is part of 'Crown of Evanion'.
*
*    'Crown of Evanion' is free software; you can redistribute it and/or modify
*    it under the terms of the GNU General Public License as published by
*    the Free Software Foundation; either version 2 of the License, or
*    (at your option) any later version.
*
*    'Crown of Evanion' is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*    GNU General Public License for more details.
*
*    You should have received a copy of the GNU General Public License
*    along with 'Crown of Evanion'; if not, write to the Free Software
*    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

$password = $_REQUEST['password'];

# This script needs to be run by a crontab at 12:01 AM every day.

if($password == "trogdorwuzamanwaitnohewuzadragonmanwaitnomaybehewuzjustadragonbuthewuzstilltrogdor") {
	include("include.php");
	
	# Need to add today's entry to the date table
	$day = (date("l"));
	$month = (date("F"));
	$dat = (date("d"));
	$year = (date("Y"));
	mysql_query("INSERT INTO date (day,month,date,yaer) VALUES ('$day','$month','$dat','$year')");
	
	# This will set all dragon's hunger down by two each day.
	mysql_query("UPDATE dragons SET hunger = hunger-2");
	mysql_query("UPDATE dragons SET fun = fun-3");
	$select = mysql_query("SELECT * FROM dragons WHERE hunger = '0'");
	while ($hunger = mysql_fetch_array($select)) {
		mysql_query("UPDATE dragons SET hunger = '1' WHERE id = '$hunger[id]'");
	}
	$select = mysql_query("SELECT * FROM dragons WHERE fun = '0'");
	while ($fun = mysql_fetch_array($select)) {
		mysql_query("UPDATE dragons SET fun = '1' WHERE id = '$fun[id]'");
	}

} else {
	$IP = $REMOTE_ADDR;
	echo "Your IP, $IP, has been logged.";
}
Return current item: Crown of Evanion