Hi, I'm trying to fix something on my site so that a user can only kill when a certain rank. I currently have this code

if ($rank < "Boss, Supreme Boss, Kingpin, Don, Godfather"){ echo "You have to be ranked atleast Boss to kill";
}

It does return the correct "You have to be. . . " But also carries on through the page and continues to try and kill? So aswell as getting "You have to be. . " I get"You dont have enough bullets. . . or you have to wait to shoot again"

Thanksinadvance

It sounds like you have:

if ($rank < "Boss, Supreme Boss, Kingpin, Don, Godfather"){ 
  echo "You have to be ranked atleast Boss to kill";
}
//code that "kills" follows here
...

You need to wrap the code that kills in an else clause:

if ($rank < "Boss, Supreme Boss, Kingpin, Don, Godfather"){ 
  echo "You have to be ranked atleast Boss to kill";
}
else
{
  //code that "kills" follows here
  ...
}

OR simply exit the script immediately from the if clause:

if ($rank < "Boss, Supreme Boss, Kingpin, Don, Godfather"){ 
  echo "You have to be ranked atleast Boss to kill";
  exit;
}

Last one worked perfect. Don't know why I didn't do that in the first place!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.