Jump to content

Meta Refresh, Cron Jobs, & PHP


WarDeities

Recommended Posts

I have a quick question...does anyone know if you can write a

 

<META HTTP-EQUIV = 'Refresh' Content = '1; URL =cronname.php'>

 

statement in php with a cron job.

 

Heres what I am trying to do...I have a mmorpg and I want the cron job to run a file that randomly pick an npc from my database by their ID# and has it fight another person....the reason i ask if you can refresh is because a random number could end up giving me a result of a player that is inactive or other various results i don't want...and I'd like to write a statement to this extent...

 

$randomnpc=($min,$max);

$randomtarget=($min1,$max1);

 

 

$userstats="SELECT * from *** where ID='$randomnpc'";

$userstats2=mysql_query($userstats) or die("Could not get user stats");

$userstats3=mysql_fetch_array($userstats2);

 

$targetstats="SELECT * from *** where ID='$randomnpc'";

$targetstats2=mysql_query($targetstats) or die("Could not get user stats");

$targetstats3=mysql_fetch_array($targetstats2);

 

$targetactive=$targetstats3[active];

 

if ($targetactive=='No')

{

<META HTTP-EQUIV = 'Refresh' Content = '1; URL =cronname.php'>

}

else

{

<META HTTP-EQUIV = 'Refresh' Content = '1; URL =fightpage.php?user=$userstats3[name]&target=$targetstats3[name]'>

}

 

 

Anyways I'm just not sure if it'll work...especially with cron jobs...I'm faily confendent that it will if I hit the button manualy, but I figured I'd ask before spending 3 hours programing it for it now to be able to happen!

 

I really just want the cron to re-run itself if it gets and undesirable result!!!

 

 

Thanks in advance!!!

 

 

Link to comment
https://forums.phpfreaks.com/topic/89497-meta-refresh-cron-jobs-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.