Ok yah i know that ... but what i dont know is where to put it so ok maybe if i put my crappy scripting up here someone can help me better... and i took some of the results for random out...
what i need is to have the delay after the process is done before they are allowed to hit submit again...
and i need to print you may not preform action at this time if submit is hit before the sleep time is over
<?
$random = rand(1, 100);
$command = $GET['command'];
if (!isset($command)){
$command = $POST['command'];
}
include("db.php");
$userid=$COOKIE['login'];
$query = mysql_query("SELECT FROM character WHERE sessid='$userid' LIMIT 0, 1");
while ($row = @mysql_fetch_array($query))
{
$user=$row["User"];
$location=$row["Location"];
$loggedin=$row["Loggedin"];
$rest=$row["rest"];
$palive=$row["alive"];
$weapon=$row["weapon"];
}
include("db.php");
$userid=$COOKIE['login'];
$query = mysql_query("SELECT FROM items WHERE sessid='$userid' LIMIT 0, 100");
while ($row = @mysql_fetch_array($query))
{
$itemname=$row["name"];
}
$query = mysql_query("SELECT * FROM rooms WHERE location='$location' LIMIT 0, 1");
while ($row = @mysql_fetch_array($query))
{
$mine = $row["mine"];
$fish = $row["fish"];
$chop = $row["chop"];
$gather = $row["gather"];
}
if ($command == "mine" AND $mine == "y" AND $weapon == "Mining Axe"){
if ($random == '1'){
$string = "As you strike the wall with your axe, the walls begin to shake as the roof suddenly falls upon you. CAVE IN! ";
}
if ($random == '2' OR $random == '3'){
$string = "Your axe struck the wall with such force that it split into two pieces. Perhaps you can find a blacksmith to repair it?";
}
if ($random > '3' AND $random <= '50'){
$string = "You strike away at the stone wall, but to no avail, only pieces of rock seem to scatter around you.";
}
if ($random > '50' AND $random <= '75'){
$itemname="copper ore";
$string = "You found a piece of Copper!";
include('db.php');
$item_found=mysql_query("SELECT * FROM items WHERE name ='$itemname'");
while ($row = @mysql_fetch_array($item_found)){
$proceed=$row['name'];
if ($proceed != ''){
include('db.php');
$findempty=mysql_query("SELECT * FROM inv WHERE name ='$user'") or die (mysql_error());
while ($row = @mysql_fetch_array($findempty)){
for ($i='1'; $i < '25'; $i++){
$item_number = $row['item'.$i];
if($item_number == ''){
$num_empty = 'item'.$i;
}else{
$item = explode(' ', $item_number);
$number=$item[0];
$name1=$item[1];
$name2=$item[2];
if ($name2 != ''){
$full_name = $name1.' '.$name2;
}else{
$full_name = $name1;
}
if ($full_name == $itemname){
$number_of_items=$number + '1';
$num = $i;
$found='y';
}
}
}
}
if ($found != ''){
$itemnumber = 'item'.$num;
}else{
$itemnumber = $num_empty;
}
$new_number=$number_of_items++;
$new_number++;
$full_details = $new_number." ".$itemname;
include('db.php');
mysql_query("UPDATE inv SET $itemnumber='$full_details' WHERE name='$user'") or die (mysql_error());
}
}
if ($done == 'y'){
$number10 = $number;
$itemnum = 'item'.$num;
}
}
print "$string";
?>
<form action="<? $PHP_SELF ?>" method="POST">
<input type='hidden' name='command' value='mine'>
<input type="submit" name="submit" value="Mine!">
</form>
<?
}else{
if ($command == "mine" AND $mine == "n"){
print "You can not mine here.";
}else{
if ($command == "mine" AND $weapon != "Mining Axe"){
print "You must equip a Mining Axe before mining.";
}
}
}