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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.