Jump to content
MakeWebGames

Refill Will?


DELETE-ME-NOW-

Recommended Posts

Add the link:

<a href = "crystaltemple.com?spend=wrefill">Refill Will</a>

Now add the code:

 

if($_GET['spend'] == 'wrefill') {
if($ir['will'] >= $ir['maxwill']) {
echo 'You have full will';
}
if($ir['crystals'] < 10) {
echo 'You don\'t have enough crystals';
} else {
mysql_query("UPDATE `users` SET `crystals` = `crystals` - 10, `will` = ".$ir['maxwill']." WHERE (`userid` = ".$_SESSION['userid'].")");
echo 'Will refilled';
}
}
Link to comment
Share on other sites

if($_GET['spend'] == 'wrefill') {

if($ir['will'] >= $ir['maxwill']) {

echo 'You have full will';

}

if($ir['crystals'] < 10) {

echo 'You don\'t have enough crystals';

} else {

mysql_query("UPDATE `users` SET `crystals` = `crystals` - 10, `will` = ".$ir['maxwill']." WHERE (`userid` = ".$_SESSION['userid'].")");

echo 'Will refilled';

}

}

Thanks. Added that longer code just before the ?> in my code, also added that smaller code, but when i clcik on, 'refill will, it says theres no place there on my server. "Oops! This link appears to be broken."

Link to comment
Share on other sites

else if($_GET['spend'] == 'wrefill')
{
print "Type in the percent of will you need to refill.

You have [b]{$ir['crystals']}[/b] points.
";
$wiperc1=(int) ($ir['will']/$ir['maxwill']*100);
$wiperc=100-$wiperc1;
print "One point = One Percent <form action='crystaltemple.php?spend=willrefill' method='post'><input type='text' name='willperc' value='{$wiperc}'/>
<input type='submit' value='Swap' /></form>";
}
else if($_GET['spend'] == 'willrefill')
{
$_POST['willperc']=(int) $_POST['willperc'];
if($_POST['willperc'] <= 0 || $_POST['willperc'] > $ir['crystals'])
{
print "You do not have enough points, or you did not fill out the form right.

[url='crystaltemple.php?spend=money']Back[/url]";
}
else
{
$_POST['willperc']=abs((int) $_POST['willperc']);
$willgain1=$_POST['willperc']/100;
$willgain2=$willgain1 * $ir['maxwill'];
$wiperc1=(int) ($ir['will']/$ir['maxwill']*100);
$wiperc=100-$wiperc1;
if($_POST['willperc'] > $wiperc) {
die ("You do not have that much will.");
$h->endpage();
}
if($willgain2 > $ir['maxwill']) 
{
print "You do not have that much will.";
$h->endpage();
}
$db->query("UPDATE users SET crystals=crystals-{$_POST['willperc']},will=will+{$willgain2} WHERE userid=$userid");
print "You successfully refilled ".$_POST['willperc']."% will!";
}
}

 

Lets choosers use how much to refill . 1 Points per %

Link to comment
Share on other sites

else if($_GET['spend'] == 'wrefill')

{

print "Type in the percent of will you need to refill.<br />

You have {$ir['crystals']} points.<br />";

$wiperc1=(int) ($ir['will']/$ir['maxwill']*100);

$wiperc=100-$wiperc1;

print "One point = One Percent <form action='crystaltemple.php?spend=willrefill' method='post'><input type='text' name='willperc' value='{$wiperc}'/><br /><input type='submit' value='Swap' /></form>";

}

else if($_GET['spend'] == 'willrefill')

{

$_POST['willperc']=(int) $_POST['willperc'];

if($_POST['willperc'] <= 0 || $_POST['willperc'] > $ir['crystals'])

{

print "You do not have enough points, or you did not fill out the form right.<br />

Back";

}

else

{

$_POST['willperc']=abs((int) $_POST['willperc']);

$willgain1=$_POST['willperc']/100;

$willgain2=$willgain1 * $ir['maxwill'];

$wiperc1=(int) ($ir['will']/$ir['maxwill']*100);

$wiperc=100-$wiperc1;

if($_POST['willperc'] > $wiperc) {

die ("You do not have that much will.");

$h->endpage();

}

if($willgain2 > $ir['maxwill']) 

{

print "You do not have that much will.";

$h->endpage();

}

$db->query("UPDATE users SET crystals=crystals-{$_POST['willperc']},will=will+{$willgain2} WHERE userid=$userid");

print "You successfully refilled ".$_POST['willperc']."% will!";

}

}

Where exactly do i add that code?

Link to comment
Share on other sites

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