Jump to content
MakeWebGames

Recommended Posts

Posted

I've got a custom Jail Bust script that runs a 50% chance of success at the moment.

I am trying to get it so people can't use the bug...

The bug is basically this: You can bust a user out and then refresh to keep busting them out even if they aren't in jail...

This is the script I setup but doesn't work... Any suggestions?

 

$dur=mysql_query("SELECT * FROM users WHERE userid={$_GET['bust']}",$c);
if ($dur['jail']="0") {
die("You cannot bust someone out of jail if they aren't in jail!
<a href=jail.php>back</a>");
exit;
}

$_GET['bust'] = grabs userid of the user in jail.

$dur being the user you're trying to bust outta jail.

$dur['jail'] being the user you're trying to bust out's time left in jail...

Posted

Re: Jail Bust Help

FOUND OUT HOW TO DO IT ON MY OWN :)

Here it is for anyone that might need/want it.

 

$id = abs((int) $_GET['bust']);
$z=mysql_query("SELECT * FROM users WHERE userid = $id",$c) or die(mysql_error());
$user = mysql_fetch_array($z);
if(!$user['jail'])
{
print "Error: The player you selected is not in jail.";
$h->endpage();
die("");
}
Guest Anonymous
Posted

Re: Jail Bust Help

Well done and good to see you posting your solution.

May I suggest that your query can be a lot smaller though...

$sql = sprintf("SELECT `jail` FROM `users` WHERE (`userid` = %u)", $id);

$z = mysql_query($sql, $c);

No point in retrieving more information than you really need.

Posted

Re: Jail Bust Help

Thanks, and good way to put it as I am still a noob. just learning from other free mods and such! After i have an error and find the solution I like to give others the code that i did so they can learn from it also :)

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.   Paste as plain text instead

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