Jump to content
MakeWebGames

Recommended Posts

Posted

i edited karlos's crystal temple but it dont work and he dont offer support here is the erre

Parse error: syntax error, unexpected T_ELSE in /home/darkstr1/public_html/ctemple.php on line 60

and here is the code

i need help i edited this for a game but the thing is it wont wokr the error is

Parse error: syntax error, unexpected T_ELSE in /home/darkstr1/public_html/ctemple.php on line 60
the code is
<?php include_once (DIRNAME(__FILE__) . '/globals.php'); ### Start Configuration ### $BraveRefill = '10'; $PowerRefill = '10'; $Buy10steps = '10'; $Sell10steps = '10'; $Money = '1000'; ### End Configuration ### function Error($Message) { global $h; echo sprintf("<span style='color: #FF0000;'>Error!
%s</span>", stripslashes($Message)); exit($h->endpage()); } $_GET['spend'] = isset($_GET['spend']) && ctype_alpha($_GET['spend']) ? trim($_GET['spend']) : FALSE; if (!in_array($_GET['spend'], array('', 'BraveR', 'PowerR', 'Buy10s', 'Sell10s', 'Money'))) { Error('Invalid Command!'); } if (!$_GET['spend']) { echo '<span style="text-decoration: underline; font-size: 14px; font-weight: 600">Welcome To The Crystal Temple!</span>

'; echo sprintf("You have [b]%s[/b] crystals.
", number_format($ir['crystals'])); echo 'What would you like to spend your crystals on?
'; echo sprintf("
[url='ctemple.php?spend=BraveR'] BraveRefill - %s Crystals[/url]
", number_format($BraveRefill)); echo sprintf("[url='ctemple.php?spend=PowerR']Power Refill - %s Crystals[/url]
", number_format($PowerRefill)); echo sprintf("[url='ctemple.php?spend=Buy10s']Buy 10 Steps - %s Crystals[/url]
", number_format($Buy10steps)); echo sprintf("[url='ctemple.php?spend=Sell10s']Sell 10 Steps - %s Crystals[/url]
", number_format($Sell10steps)); echo sprintf("[url='ctemple.php?spend=Money']Money - $%s Per Crystal [/url]
", number_format($Money)); } else { if ($_GET['spend'] == 'BraveR') { if ($ir['crystals'] < $BraveRefill) { Error('You Don\'t Have Enough Crystals!'); } else if ($ir['brave'] == $ir['maxbrave']) { Error('You Already Have Full Brave.'); } else { $db->query(sprintf("UPDATE users SET brave=maxbrave, crystals=crystals-%d WHERE userid=%d", $BraveRefill, $userid)); echo sprintf("You Have Paid %d Crystals To Refill Your Brave Bar.", number_format($BraveRefill)); } } else if ($_GET['spend'] == 'PowerR') { if ($ir['crystals'] < $PowerRefill) { Error('You Don\'t Have Enough Crystals!'); } else if ($ir['will'] == $ir['maxwill']) { Error('You Already Have Full Power.'); } else { $db->query(sprintf("UPDATE users SET will=maxwill, crystals=crystals-%d WHERE userid=%d", $PowerRefill, $userid)); echo sprintf("You Have Paid %d Crystals To Refill Your Power Bar.", number_format($PowerRefill)); } } else if ($_GET['spend'] == 'Buy10s') { if ($ir['crystals'] < $Buy10steps) { Error('You Don\'t Have Enough Crystals!'); } } else { $db->query(sprintf("UPDATE users SET turns=turns+10, crystals=crystals-%d WHERE userid=%d", $Buy10steps, $userid)); echo sprintf("You Have Paid %d crystals to get 10 steps at scavanging.", number_format($Buy10steps)); } } else if ($_GET['spend'] == 'Sell10s') { if ($ir['crystals'] < $Sell10steps) { Error('You Don\'t Have Enough Crystals!'); } } else { $db->query(sprintf("UPDATE users SET turns=turns-10, crystals=crystals+%d WHERE userid=%d", $Sell10steps, $userid)); echo sprintf("You Have Sold 10 Steps For %d Crystals .", number_format($Sell10steps)); } } else if($_GET['spend'] == 'money') { print "Type in the amount of crystals you want to swap for money.
You have [b]{$ir['crystals']}[/b] crystals.
One crystal = \$". number_format($Money).".<form action='ctemple.php?spend=Money2' method='post'><input type='text' name='crystals' />
<input type='submit' value='Swap' /></form>"; } else if($_GET['spend'] == 'money2') { $_POST['crystals']=(int) $_POST['crystals']; if($_POST['crystals'] <= 0 || $_POST['crystals'] > $ir['crystals']) { print "Error, you either do not have enough crystals or did not fill out the form.
[url='ctemple.php?spend=Money']Back[/url]"; } else { $gain=$_POST['crystals']* $Money; $db->query("UPDATE users SET crystals=crystals-{$_POST['crystals']},money=money+$gain WHERE userid=$userid"); print "You traded {$_POST['crystals']} crystals for \$".number_format($gain)."."; $h->endpage(); ?>
Posted

Re: help with crystal temple

the code is ment to be :

<?php
include_once (DIRNAME(__FILE__) . '/globals.php');

### Start Configuration ###
$BraveRefill = '10';
$PowerRefill = '10';
$Buy10steps = '10';
$Sell10steps = '10';
$Money = '1000';
### End Configuration ###

function Error($Message) {
global $h;
echo sprintf("<span style='color: #FF0000;'>Error!
%s</span>", stripslashes($Message));
exit($h->endpage());
}

$_GET['spend'] = isset($_GET['spend']) && ctype_alpha($_GET['spend']) ? trim($_GET['spend']) : FALSE;

if (!in_array($_GET['spend'], array('', 'BraveR', 'PowerR', 'Buy10s', 'Sell10s', 'Money'))) {
Error('Invalid Command!');
}

if (!$_GET['spend']) {
echo '<span style="text-decoration: underline; font-size: 14px; font-weight: 600">Welcome To The Crystal Temple!</span>

';
echo sprintf("You have [b]%s[/b] crystals.
", number_format($ir['crystals']));
echo 'What would you like to spend your crystals on?
';
echo sprintf("
[url='ctemple.php?spend=BraveR'] BraveRefill - %s Crystals[/url]
", number_format($BraveRefill)); 
echo sprintf("[url='ctemple.php?spend=PowerR']Power Refill - %s Crystals[/url]
", number_format($PowerRefill)); 
echo sprintf("[url='ctemple.php?spend=Buy10s']Buy 10 Steps - %s Crystals[/url]
", number_format($Buy10steps)); 
echo sprintf("[url='ctemple.php?spend=Sell10s']Sell 10 Steps - %s Crystals[/url]
", number_format($Sell10steps)); 
echo sprintf("[url='ctemple.php?spend=Money']Money - $%s Per Crystal [/url]
", number_format($Money)); 
} else {
if ($_GET['spend'] == 'BraveR') {
 if ($ir['crystals'] < $BraveRefill) {
  Error('You Don\'t Have Enough Crystals!');
 } else if ($ir['brave'] == $ir['maxbrave']) {
  Error('You Already Have Full Brave.');
 } else {
  $db->query(sprintf("UPDATE users SET brave=maxbrave, crystals=crystals-%d WHERE userid=%d", $BraveRefill, $userid));
  echo sprintf("You Have Paid %d Crystals To Refill Your Brave Bar.", number_format($BraveRefill));
 }
} else if ($_GET['spend'] == 'PowerR') {
 if ($ir['crystals'] < $PowerRefill) {
  Error('You Don\'t Have Enough Crystals!');
 } else if ($ir['will'] == $ir['maxwill']) {
  Error('You Already Have Full Power.');
 } else {
  $db->query(sprintf("UPDATE users SET will=maxwill, crystals=crystals-%d WHERE userid=%d", $PowerRefill, $userid));
  echo sprintf("You Have Paid %d Crystals To Refill Your Power Bar.", number_format($PowerRefill));
 }
} else if ($_GET['spend'] == 'Buy10s') {
 if ($ir['crystals'] < $Buy10steps) {
  Error('You Don\'t Have Enough Crystals!');
 } 
 } else {
  $db->query(sprintf("UPDATE users SET turns=turns+10, crystals=crystals-%d WHERE userid=%d", $Buy10steps, $userid));
  echo sprintf("You Have Paid %d crystals to get 10 steps at scavanging.", number_format($Buy10steps));
 }
} else if ($_GET['spend'] == 'Sell10s') {
 if ($ir['crystals'] < $Sell10steps) {
  Error('You Don\'t Have Enough Crystals!');
 } } else {
  $db->query(sprintf("UPDATE users SET turns=turns-10, crystals=crystals+%d WHERE userid=%d", $Sell10steps, $userid));
  echo sprintf("You Have Sold 10 Steps For %d Crystals .", number_format($Sell10steps));
 }
}   else if($_GET['spend'] == 'money')
{
print "Type in the amount of crystals you want to swap for money.

You have [b]{$ir['crystals']}[/b] crystals.

One crystal = \$". number_format($Money).".<form action='ctemple.php?spend=Money2' method='post'><input type='text' name='crystals' />
<input type='submit' value='Swap' /></form>";
}
else if($_GET['spend'] == 'money2')
{
$_POST['crystals']=(int) $_POST['crystals'];
if($_POST['crystals'] <= 0 || $_POST['crystals'] > $ir['crystals'])
{
print "Error, you either do not have enough crystals or did not fill out the form.

[url='ctemple.php?spend=Money']Back[/url]";
}
else
{
$gain=$_POST['crystals']* $Money;
$db->query("UPDATE users SET crystals=crystals-{$_POST['crystals']},money=money+$gain WHERE userid=$userid");
print "You traded {$_POST['crystals']} crystals for \$".number_format($gain).".";

$h->endpage();
?>

 

please someone help me

Posted

Re: help with crystal temple

untested but it should work...

 

<?php
include_once (DIRNAME(__FILE__) . '/globals.php');

### Start Configuration ###
$BraveRefill = '10';
$PowerRefill = '10';
$Buy10steps = '10';
$Sell10steps = '10';
$Money = '1000';
### End Configuration ###

function Error($Message)
{
   global $h;
   echo sprintf("<span style='color: #FF0000;'>Error!
%s</span>", stripslashes($Message));
   exit($h->endpage());
}

$_GET['spend'] = isset($_GET['spend']) && ctype_alpha($_GET['spend']) ? trim($_GET['spend']) : FALSE;

if (!in_array($_GET['spend'], array('', 'BraveR', 'PowerR', 'Buy10s', 'Sell10s', 'Money')))
{
Error('Invalid Command!');
}

if (!$_GET['spend'])
{
echo '<span style="text-decoration: underline; font-size: 14px; font-weight: 600">Welcome To The Crystal Temple!</span>

';
echo sprintf("You have [b]%s[/b] crystals.
", number_format($ir['crystals']));
echo 'What would you like to spend your crystals on?
';
echo sprintf("
[url='ctemple.php?spend=BraveR'] BraveRefill - %s Crystals[/url]
", number_format($BraveRefill)); 
echo sprintf("[url='ctemple.php?spend=PowerR']Power Refill - %s Crystals[/url]
", number_format($PowerRefill)); 
echo sprintf("[url='ctemple.php?spend=Buy10s']Buy 10 Steps - %s Crystals[/url]
", number_format($Buy10steps)); 
echo sprintf("[url='ctemple.php?spend=Sell10s']Sell 10 Steps - %s Crystals[/url]
", number_format($Sell10steps)); 
echo sprintf("[url='ctemple.php?spend=Money']Money - $%s Per Crystal [/url]
", number_format($Money)); 
}
else
{
   if ($_GET['spend'] == 'BraveR')
   {
       if ($ir['crystals'] < $BraveRefill) {
           Error('You Don\'t Have Enough Crystals!');
       }
       else if ($ir['brave'] == $ir['maxbrave'])
       {
           Error('You Already Have Full Brave.');
       }
       else
       {
           $db->query(sprintf("UPDATE users SET brave=maxbrave, crystals=crystals-%d WHERE userid=%d", $BraveRefill, $userid));
           echo sprintf("You Have Paid %d Crystals To Refill Your Brave Bar.", number_format($BraveRefill));
       }
   }
   else if ($_GET['spend'] == 'PowerR')
   {
       if ($ir['crystals'] < $PowerRefill)
       {
           Error('You Don\'t Have Enough Crystals!');
       }
       else if ($ir['will'] == $ir['maxwill'])
       {
           Error('You Already Have Full Power.');
       }
       else
       {
           $db->query(sprintf("UPDATE users SET will=maxwill, crystals=crystals-%d WHERE userid=%d", $PowerRefill, $userid));
           echo sprintf("You Have Paid %d Crystals To Refill Your Power Bar.", number_format($PowerRefill));
       }
   }
   else if ($_GET['spend'] == 'Buy10s')
   {
       if ($ir['crystals'] < $Buy10steps)
       {
           Error('You Don\'t Have Enough Crystals!');
       } 
       else
       {
           $db->query(sprintf("UPDATE users SET turns=turns+10, crystals=crystals-%d WHERE userid=%d", $Buy10steps, $userid));
           echo sprintf("You Have Paid %d crystals to get 10 steps at scavanging.", number_format($Buy10steps));
       }
   }
   else if ($_GET['spend'] == 'Sell10s')
   {
       if ($ir['crystals'] < $Sell10steps)
       {
           Error('You Don\'t Have Enough Crystals!');
       }
       else
       {
           $db->query(sprintf("UPDATE users SET turns=turns-10, crystals=crystals+%d WHERE userid=%d", $Sell10steps, $userid));
           echo sprintf("You Have Sold 10 Steps For %d Crystals .", number_format($Sell10steps));
       }
   }
   else if($_GET['spend'] == 'money')
   {
       print "Type in the amount of crystals you want to swap for money.

       You have [b]{$ir['crystals']}[/b] crystals.

       One crystal = \$". number_format($Money).".<form action='ctemple.php?spend=Money2' method='post'><input type='text' name='crystals' />
<input type='submit' value='Swap' /></form>";
   }
   else if($_GET['spend'] == 'money2')
   {
       $_POST['crystals']=(int) $_POST['crystals'];
       if($_POST['crystals'] <= 0 || $_POST['crystals'] > $ir['crystals'])
       {
           print "Error, you either do not have enough crystals or did not fill out the form.

           [url='ctemple.php?spend=Money']Back[/url]";
       }
       else
       {
           $gain=$_POST['crystals']* $Money;
           $db->query("UPDATE users SET crystals=crystals-{$_POST['crystals']},money=money+$gain WHERE userid=$userid");
           print "You traded {$_POST['crystals']} crystals for \$".number_format($gain).".";
       }
   }
}
$h->endpage();
?>

 

Also, it seems you have edited poorly... i don't see Karlos even as he is learning (as he says) making errors like this ;)

Posted

Re: help with crystal temple

 

Also, it seems you have edited poorly... i don't see Karlos even as he is learning (as he says) making errors like this ;)

Umm... Thanks? :lol:

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