Jump to content
MakeWebGames

Recommended Posts

Posted (edited)
have you tried?

if so, what have done? What errors if any?

have you looked around your scripts to see how similar things are done?

██ This x2

Edited by sniko
Posted (edited)

well I don't know grpg off the top of my head but I'm pretty sure you can add a link in the jail and hospital like

 echo "<a href='?release=#'>Release </a>"; 

just change the # with the players id.

Then you may want to check that the link was clicked using something like:

//make sure the array is set && make sure the right key for the array exists && make sure that its an int for tye players id
if(isset($_GET["release"]) && array_key_exists("release", $_GET) && abs((int) $_GET["release"]))
{
   //execute the release here
}

Now its your duty to make it work :)

Edited by KyleMassacre
spellng typo, oops
Posted (edited)
if($_GET['buyout'] != NULL && $user_class->points > floor($user_class->hospital / 60)){
$result = mysql_query("UPDATE `grpgusers` SET `hospital` = '0', `points` = '".($user_class->points - floor($user_class->hospital / 60))."' WHERE `id` = '".$user_class->id."'");
}

 

Add the ?buyout=whatever link to your hospital page, and adapt for prison

Edited by Vaz
Posted
if($_GET['buyout'] != NULL && $user_class->points > floor($user_class->hospital / 60)){
$result = mysql_query("UPDATE `grpgusers` SET `hospital` = '0', `points` = '".($user_class->points - floor($user_class->hospital / 60))."' WHERE `id` = '".$user_class->id."'");
}

 

Add the ?buyout=whatever link to your hospital page, and adapt for prison

Well, thats a start but now you are just adding to the problem of most of these scripts for these engines. Granted your not using $_GET for anything in the database but its still promoting negligent security practices. Also you are passing ints as strings in the database, why when they are ints and not varchar, text, etc?

But here we will go with yours just a bit cleaned up:

//Always make sure that your gets and posts are set, but now whats are value for this key? anyways we'll just let it be
if(isset($_GET['buyout']) && $user_class->points > floor($user_class->hospital / 60))
{
   $result = "UPDATE `grpgusers` SET `hospital` = 0, `points` = ".($user_class->points - floor($user_class->hospital / 60))." WHERE `id` = ".$user_class->id;
   mysql_query($result);
}
Posted

Points noted, but $_GET['buyout'] isn't used at all other than to see if it exists, so there is no issue with it, still the exact same end result

Posted

If I am correct the use point option has the buy out of the hospital, so use kyle post and add the link

echo "<a href='LINK'>Release </a>";

Posted

might of read original post wrong but if i have then owell lol

 

if(isset($_GET['admin']) == "prison") {
if($user_class->admin == 1 ) {
if($user_class->jail == 0) {
echo Message("You're not in prison.");
} 
else {
$result = mysql_query("UPDATE `grpgusers` SET `jail` = '0' WHERE `id`='".$_SESSION['id']."'");
echo Message("You used your corruption powers to get out of prison.");
}
}
}

 

<a href='spendpoints.php?admin=prison'>Get Out of Prison</a><br />

Posted
might of read original post wrong but if i have then owell lol

 

if(isset($_GET['admin']) == "prison") {
if($user_class->admin == 1 ) {
if($user_class->jail == 0) {
echo Message("You're not in prison.");
} 
else {
$result = mysql_query("UPDATE `grpgusers` SET `jail` = '0' WHERE `id`='".$_SESSION['id']."'");
echo Message("You used your corruption powers to get out of prison.");
}
}
}

 

<a href='spendpoints.php?admin=prison'>Get Out of Prison</a><br />

I think he wants it so players can spend currency to get out themselves

Posted
//You should already have a form with the method of GET setup, to execute statement
if(isset($_GET['buyout']) && $user_class->points > floor($user_class->hospital / 60)){

//Time to execute the statement
$query = "UPDATE `grpgusers` SET `hospital` = 0, `points` = ".mysql_real_escape_string(($user_class->points - floor($user_class->hospital / 60)))." WHERE `id` = ".$user_class->id;
mysql_query($query) or die(mysql_error());
//End of query

echo Message("what ever you want here!");
}
Posted
//You should already have a form with the method of GET setup, to execute statement
if(isset($_GET['buyout']) && $user_class->points > floor($user_class->hospital / 60)){

//Time to execute the statement
$query = "UPDATE `grpgusers` SET `hospital` = 0, `points` = ".mysql_real_escape_string(($user_class->points - floor($user_class->hospital / 60)))." WHERE `id` = ".$user_class->id;
mysql_query($query) or die(mysql_error());
//End of query

echo Message("what ever you want here!");
}

If your going to use a form I would use post unless for some strange reason you cannot use post.

Also why mres an int? Especially in this case your "points" is and should be an (int) in your database unless you have done something horribly wrong to your database. Also it really doesn't need to be "secured" since its not user input and your not displaying info from the db.

Now would this be bad? No. Practical? No. its just adding some unnecessary strain by calling a function that doesn't need to be there.

Now back on topic,

If the OP takes all of these examples and puts the pieces together just right he has what he is looking for and I appreciate all the spoon feeding you guys have done :p

Posted
If your going to use a form I would use post unless for some strange reason you cannot use post.

Also why mres an int? Especially in this case your "points" is and should be an (int) in your database unless you have done something horribly wrong to your database. Also it really doesn't need to be "secured" since its not user input and your not displaying info from the db.

Now would this be bad? No. Practical? No. its just adding some unnecessary strain by calling a function that doesn't need to be there.

Now back on topic,

If the OP takes all of these examples and puts the pieces together just right he has what he is looking for and I appreciate all the spoon feeding you guys have done :p

My bad sorry you don't need a form it should be ?action=buyout or something like that

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