ok, I was thinking about this today while doing the
washing up...
So... You want to use resets but you aint got a clue
about cronjobs?
This solution will give you resets but it will need players
playing. The reset will check to see if the timer has
gone past the desired value. If it has, then it will run
your reset page, and then update the timer so it is
ready for the next one.
First you will need to make a new table with this sql
CREATE TABLE `cron_timer` (
`id` int(11) NOT NULL auto_increment,
`lpv` int(11) NOT NULL default '1091919400',
UNIQUE KEY `id` (`id`)
) TYPE=MyISAM ;
#
# Dumping data for table `cron_timer`
#
INSERT INTO `cron_timer` (`id`, `lpv`) VALUES (1,
1091919400);
The value 1091919400 is the lpv for 12:00am GMT on
8th August 2004.
To check the next lpv value, go to www.dealers-of-
destiny.org.uk/lpv.php
Next, create the cron_timer.php
<?php
$cron_timer = mysql_fetch_array(mysql_query
("select * from cron_timer where id=1"));
// Timer for 24 hours
if ($stat[lpv] > $cron_timer[lpv]) {
include
("cron_midnight.php");
print "System message.
Updating timer<br>";
mysql_query("update
cron_timer set lpv=lpv+86400");
}
//End of 24 hour timer
?>
and save it as cron_timer.php
The above is set to give me a reset every 24 hours. But
can easily be altered to give you what ever reset you
require.
If more than one reset will be running off the timer, add
an extra timer to run for the required time.
Next in the header.php under where it selects the value
of $stat enter the following line.
include("cron_timer.php");
and thats it, save all files upload to your server
cron_timer.php and header.php
Logged In: YES
user_id=912095
Sorry forgot to mention, When you require two timers, copy
the whole lot between the <?php tags
then get the paste, then get the value of $cron_timer where
id=2 and make sure alter the values in the second entry in
your table to relay your second timer.
to get values of lpv you have to calculate from the second.
for every two hours its 60 x 60 x 2 = 7200
so you would add
mysql_query("update cron_timer set lpv=lpv+7200 where
id=2");
if you are using multple resets, make sure you direct each of
the timers to the appriopriate line in your table.
Logged In: NO
i do it all write and it looks liek your says but it says
#1075 - Incorrect table definition; There can only be one
auto column and it must be defined as a key under neath and
it snt save
Logged In: NO
what's cron_midnight.php?
Logged In: YES
user_id=912095
I used cron_midnight to show that it can be used as a 24
hour reset.
You could use cron_2hour.php or revive.php or reset.php?
action=reset. It really makes no difference as to what you
put as the reset file. As long as the reset does what you
want it to do.
As for the guy who set up the table, you have to set up the
table as above and then make an entry. Use the link
www.dealers-of-
destiny.org.uk/lpv.php to find tonights lpv timer and enter
that as the lpv.
Logged In: YES
user_id=912095
I have made some alterations to the timer so that you can do
it better.
Just change the times in the $hours1 and $hours2 to the
correct times in hours.
Then alter the link to your reset page. All the calculations are
done for you.
<?php
// Enter the number of hours below.
$hours1 = 24;
$hours2 = 2;
//Hours calculation
$hours1 = $hours1*3600;
$hours2 = $hours2*3600;
$cron_timer = mysql_fetch_array(mysql_query
("select * from cron_timer where id=1"));
// Timer for 24 hours
if ($stat[lpv] > $cron_timer[lpv]) {
include("cron_midnight.php");
mysql_query("update cron_timer
set lpv=lpv+$hours1 where id=1");
}
//End of 24 hour timer
$cron_timer = mysql_fetch_array(mysql_query
("select * from cron_timer where id=2"));
// Timer for 2 hour timer
if ($stat[lpv] > $cron_timer[lpv]) {
include("reset.php");
mysql_query("update cron_timer
set lpv=lpv+$hours2 where id=2");
}
//End of 2 hour timer
?>
Logged In: NO
what do you mean where i need to paste it in the header file?
include("cron_timer.php"); """""""""where"""""""" is
need to paste it
Logged In: YES
user_id=912095
i added it after
if (empty ($stat[id])) {
print "Invalid login.";
exit;
}
which works fine
Logged In: NO
and doy you use this ? <?php
// Enter the number of hours below.
$hours1 = 24;
$hours2 = 2;
//Hours calculation
$hours1 = $hours1*3600;
$hours2 = $hours2*3600;
$cron_timer = mysql_fetch_array(mysql_query
("select * from cron_timer where id=1"));
// Timer for 24 hours
if ($stat[lpv] > $cron_timer[lpv]) {
include("cron_midnight.php");
mysql_query("update cron_timer
set lpv=lpv+$hours1 where id=1");
}
//End of 24 hour timer
$cron_timer = mysql_fetch_array(mysql_query
("select * from cron_timer where id=2"));
// Timer for 2 hour timer
if ($stat[lpv] > $cron_timer[lpv]) {
include("reset.php");
mysql_query("update cron_timer
set lpv=lpv+$hours2 where id=2");
}
//End of 2 hour timer
?> ??????????
Logged In: NO
Helle thanx for the script but how i can set it to evrey 5
min reset? is it then value 10?
Logged In: NO
can you tell me more on msn of give your email adres? my msn
: maxime-degreve@telenet.be
Logged In: NO
if i wanted to make it 30 mins
do i make it:
$hours2 = 0.5;
???????????????????
Logged In: NO
if the rest file is:
<?php
include("config.php");
if ($step == reset ) {
if ($pass == $cpass) {
mysql_query("update players set age=age+1");
mysql_query("update players set energy=max_energy");
mysql_query("update players set hp=max_hp");
mysql_query("update outposts set turns=turns+5");
mysql_query("update outposts set tokens=tokens+100");
$plat_price = rand(100, 300);
mysql_query("update market set platcost='$plat_price'");
mysql_query("update players set ops=ops+5 where mines > 0");
mysql_query("update players set trains=trains+15 where
corepass='Y'");
exit;
}
}
if ($step == revive) {
if ($pass == $cpass) {
mysql_query("update players set hp=max_hp");
mysql_query("update players set energy=max_energy");
mysql_query("update outposts set turns=turns+5");
mysql_query("update outposts set tokens=tokens+100");
mysql_query("update players set ops=ops+5 where mines > 0");
exit;
}
}
include("head.php");
print "ERROR COMMAND NOT GIVEN<br><form method=post
action=login.php><table><tr><td>Email:</td><td><input
type=text
name=email></td></tr><tr><td>Password:</td><td><input
type=password name=pass></td></tr><tr><td colspan=2
align=center><input type=submit
value=Login></td></tr></form></table>";
include("foot.php");
?>
what do we keep to make a cron_midnight.php
Logged In: YES
user_id=912095
I sue cron_midnight.php as my daily reset.
You can run as many cron as you wishfrom the system, just
make a seperate command and timer for it.