Jump to content
MakeWebGames

Body Gaurd feature


modernmafia
 Share

Recommended Posts

Hi Every one this is a bodygaurd feature for my game which i created in notepad ++

small problem when i upload it to my server and test it all i get is a error code

( Parse error: syntax error, unexpected '{', expecting '(' in /home/********/public_html/v2/body.php on line 212 )

 

couple of line im not sure on too is line:211 i think i need to put echo instead of print but im sure one of you will tell me looking for guidence

 

lines 197-217 is the recent work that throws the error

 

<?php
include_once "includes/db_connect.php";
include_once "includes/functions.php";
logincheck();
$username = $_SESSION['username'];

$query1=mysql_query("SELECT * FROM user_info WHERE username='$username'");
$fetch2=mysql_fetch_object($query1); 
$fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'"));
$fetch123=mysql_fetch_object(mysql_query("SELECT * FROM bodygaurd WHERE username='$username'"));
$date = gmdate('Y-m-d H:i:S');
$bo=mysql_fetch_object(mysql_query("SELECT * FROM bodygaurd WHERE username='$username'"));
$check=mysql_fetch_object(mysql_query("SELECT * FROM bodygaurd WHERE username='$username'"));
$page=strip_tags($_GET['page']);
if($check == "0"){ echo"<link href=\"style.css\" rel=\"stylesheet\" type=\"text/css\" /><table width=\"384\" align=\"center\" cellspacing=\"0\" cellpadding=\"0\" class=table>
<tr><td class=\"header\" colspan=\"2\"><center>Bodyguard</td></tr>
<tr><td height=1 colspan=3><center>You do not have a bodyguard buy one here <br><a href=credits.php>credits page</a></td></tr></table><center>";
exit();
}

?>
<html>
<head>
<link rel=stylesheet href=style.css type=text/css>
<title>The Bodygaurd Shop</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="style.css" rel="stylesheet" type="text/css" />
</head>


<table width="384" border="0" align="center" cellpadding="2" cellspacing="0" class="table">  
<tr>

           <td height="22" colspan="7" align="center" class="header">

           <div align="center"><strong>Your Bodyguard</strong></div>  </td>
 </tr>

       <tr>

<td>
<img src="">
</td>

</tr>
<tr>
         <td align="center" colspan="2" class="tableborder">Now, Pick from the options below to edit your bodygaurd! <br><br>
	  <a href='?page=inven'><img src='images/bodygaurd/bng.png' border="0"></a>   <a href='?page=rankfire'><img src='images/bodygaurd/ranks.png' border="0"></a>   <a href='?page=status'><img src='images/bodygaurd/status.png' border="0"></a>    <a href='?page=shop'><img src='images/bodygaurd/shop.png' border="0"> </a><br>
	  <br></td>
       </tr>
</table><br>
<?php if($page == "inven"){?>
<link href="style.css" rel="stylesheet" type="text/css">
<center>
<table width="384" border="0" align="center" cellpadding="2" cellspacing="0" class="table">  
<tr>

           <td height="22" colspan="7" align="center" class="header">

           <div align="center"><strong>Your Bodyguards Inventory</strong></div>  </td>
 </tr>



       <tr>

         <td align="center" colspan="2" class="tableborder"><div align="center"><u><b>Inventory</b></u><br><br>
	  Your bodyguard currently has an <?php if($bo->weapon != "<b>Unidentified</b>"){ echo"<b>$bo->weapon</b>"; }else{ echo"<b>Unidentified</b>"; }?> weapon<br>
	  Your bodyguard currently has <b><?php echo"".makecomma($bo->bullets).""; ?></b> bullets<br /></td>
       </tr>
</table>
<? }elseif($page == "rankfire"){?>

<form action="" method="post" id="">
<table width="384" border="0" align="center" cellpadding="2" cellspacing="0" class="table">  
<tr>

           <td height="22" colspan="7" align="center" class="header">

   <div align="center"><strong>Rank to Fire at </strong></div>  </td>
 </tr>



       <tr>

         <td colspan="2" align="center" class="tableborder"><div align="center"><u><b>Rank to fire at</b></u><br>
           <br>
	  Here you can choose which rank you want your bodygaurd to fire back at, update it here;<br><br>
	  Fire back at rank: <select name="fireat" class="textbox">
     <option value="0"  selected="selected" >All Ranks</option>
          <option value="1" >Dirty Cop +</option>
     <option value="2" >Scum +</option>
     <option value="3" >Criminal +</option>
     <option value="4" >Vandal +</option>
     <option value="5" >Arsonist +</option>
     <option value="6" >Thug +</option>

     <option value="7" >Boss +</option>
     <option value="8" >Assassin +</option>
     <option value="9" >Don +</option>
     <option value="10" >Godfather +</option>
     <option value="11" >Global Threat +</option>
     <option value="12" >Global Dominator +</option>

     <option value="13" >Untouchable Godfather +</option>
     <option value="14" >Man Of Honour +</option>
     <option value="15" >Respectable Don +</option>
     <option value="16" >Legend +</option>
     <option value="17" >Official MM Legend +</option>
     <option value="18" >True MM Legend +</option>




   </select><br><br>
<input type="submit" class="button" name="rank2" id="rank2" value="Change Rank" /><br>
<?php


	   if ($_POST['rank2']){
	   $rname=$_POST['rname'];
	   $fireat=strip_tags($_POST['fireat']); 
mysql_query("UPDATE bodygaurd SET ranktoshoot='$fireat' WHERE username='$username'");
echo "Your have changed the minimum rank that your bodyguard will shoot at.";
}

?><br />
       </tr>
</table> 
<?php }elseif($page == "status"){ ?>
<form action="" method="post" id="">
<table width="384" border="0" align="center" cellpadding="2" cellspacing="0" class="table">  
<tr>

           <td height="22" colspan="7" align="center" class="header">

   <div align="center"><strong>Status</strong></div>  </td>
 </tr>



       <tr>

         <td colspan="2" align="center" class="tableborder"><div align="center"><u><b>Status</b></u><br>
           <br>
           Here you can turn your bodygaurd on or off.
           <br>
		Your bodygaurd is currently;  <b><?php echo"$bo->status"; ?></b><br>
           <br>
           Bodygaurd
           : 
	    <select name="status" class="textbox">
     <option value="On"  selected="selected" >On</option>
     <option value="Off" >Off</option>

   </select><br><br>
      <input type="submit" class="button" name="stat" id="stat" value="Change!">
      <br><?php


	   if ($_POST['stat']){
	   $status=strip_tags($_POST['status']); 
mysql_query("UPDATE bodygaurd SET status='$status' WHERE username='$username'");
echo "You have changed your bodyguard status to $status.";
}

?>
	  <br />
       </tr>
</table>
<?php }elseif($page == "shop"){ ?>
<form action="" method="post" id="">
<table width="384" border="0" align="center" cellpadding="2" cellspacing="0" class="table">  
<tr>

           <td height="22" colspan="7" align="center" class="header">

   <div align="center"><strong>The Bodyguard Shop  </strong></div>  </td>
 </tr>



       <tr>

         <td colspan="2" align="center" class="tableborder"><div align="center"><u><b>The shop </b></u><br>
           <br>
	  Here you can purchase weapons for your bodygaurd. <br>
	  <br>
	  Purchase a gun: 

	    <select name="guntype" class="textbox">
	      <option value="M16">M16 - £2,500,000</option>
	      <option value="AWP">AWP - £10,000,000</option>
           </select><br><br><input type="submit" class="button" name="buyg" id="buyg" value="Buy Weapon" />

<?php


	   if ($_POST['buyg']){
	   $guntype=$_POST['guntype'];

if($guntype == "M16")
{$guncost = "2500000"; 
}elseif($guntype == "AWP"){
$guncost = "10000000"; 
}
elseif($info->money  < $guncost){
print "You don't have enougth money for this";
} elseif($bo['weapon'] == $guntype){
print "Your bodyguard already has that weapon";
} elseif {
mysql_query("UPDATE bodygaurd SET weapon='$guntype' WHERE username='$username'");
mysql_query("UPDATE users SET money=money-$guncost WHERE username='$username'");
echo "<br>The $guntype was delivered to your body gaurd.";
}
}

?>
<br>
<br>
Here you can swap normal bullets for Bodygaurd bullets. <br>
<br><br />
<b>Add bullets from your account: </b>
<input name="buyb" type="text" class="textbox"  id="buyb" value="<?php echo "$fetch2->FMJ"; ?>" size="20">
<br>
<br>
<em>Please note when you have added the bullet(s), you can't get them back!</em><br>
<br>
<input type="submit" class="button" name="buys" id="buys" value="Add Bullets" />
<?php


	   if ($_POST['buys']){
	   $buyb=$_POST['buyb'];
	   $status=strip_tags($_POST['status']); 
	   if($fetch2->FMJ < $buyb){ 
	   echo"You have not got that many FMJ.";
	   }elseif($fetch2->FMJ >= $buyb){
mysql_query("UPDATE bodygaurd SET bullets=bullets+$buyb WHERE username='$username'");
mysql_query("UPDATE users SET FMJ=FMJ-$buyb WHERE username='$username'");
echo "<br>You successfully added <b>".makecomma($buyb)."</b> FMJ for your bodyguard!";
}}

?><br>
<br />        </tr>
</table>
<? } ?></p>

 

Thank you in advance for your time and patience and your willing to help

Link to comment
Share on other sites

Hi Every one this is a bodygaurd feature for my game which i created in notepad ++

small problem when i upload it to my server and test it all i get is a error code

( Parse error: syntax error, unexpected '{', expecting '(' in /home/********/public_html/v2/body.php on line 212 )

 

couple of line im not sure on too is line:211 i think i need to put echo instead of print but im sure one of you will tell me looking for guidence

 

lines 197-217 is the recent work that throws the error

 

<?php
include_once "includes/db_connect.php";
include_once "includes/functions.php";
logincheck();
$username = $_SESSION['username'];

$query1=mysql_query("SELECT * FROM user_info WHERE username='$username'");
$fetch2=mysql_fetch_object($query1); 
$fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'"));
$fetch123=mysql_fetch_object(mysql_query("SELECT * FROM bodygaurd WHERE username='$username'"));
$date = gmdate('Y-m-d H:i:S');
$bo=mysql_fetch_object(mysql_query("SELECT * FROM bodygaurd WHERE username='$username'"));
$check=mysql_fetch_object(mysql_query("SELECT * FROM bodygaurd WHERE username='$username'"));
$page=strip_tags($_GET['page']);
if($check == "0"){ echo"<link href=\"style.css\" rel=\"stylesheet\" type=\"text/css\" /><table width=\"384\" align=\"center\" cellspacing=\"0\" cellpadding=\"0\" class=table>
<tr><td class=\"header\" colspan=\"2\"><center>Bodyguard</td></tr>
<tr><td height=1 colspan=3><center>You do not have a bodyguard buy one here <br><a href=credits.php>credits page</a></td></tr></table><center>";
exit();
}

?>
<html>
<head>
<link rel=stylesheet href=style.css type=text/css>
<title>The Bodygaurd Shop</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="style.css" rel="stylesheet" type="text/css" />
</head>


<table width="384" border="0" align="center" cellpadding="2" cellspacing="0" class="table">  
<tr>

           <td height="22" colspan="7" align="center" class="header">

           <div align="center"><strong>Your Bodyguard</strong></div>  </td>
 </tr>

       <tr>

<td>
<img src="">
</td>

</tr>
<tr>
         <td align="center" colspan="2" class="tableborder">Now, Pick from the options below to edit your bodygaurd! <br><br>
         <a href='?page=inven'><img src='images/bodygaurd/bng.png' border="0"></a>   <a href='?page=rankfire'><img src='images/bodygaurd/ranks.png' border="0"></a>   <a href='?page=status'><img src='images/bodygaurd/status.png' border="0"></a>    <a href='?page=shop'><img src='images/bodygaurd/shop.png' border="0"> </a><br>
         <br></td>
       </tr>
</table><br>
<?php if($page == "inven"){?>
<link href="style.css" rel="stylesheet" type="text/css">
<center>
<table width="384" border="0" align="center" cellpadding="2" cellspacing="0" class="table">  
<tr>

           <td height="22" colspan="7" align="center" class="header">

           <div align="center"><strong>Your Bodyguards Inventory</strong></div>  </td>
 </tr>



       <tr>

         <td align="center" colspan="2" class="tableborder"><div align="center"><u><b>Inventory</b></u><br><br>
         Your bodyguard currently has an <?php if($bo->weapon != "<b>Unidentified</b>"){ echo"<b>$bo->weapon</b>"; }else{ echo"<b>Unidentified</b>"; }?> weapon<br>
         Your bodyguard currently has <b><?php echo"".makecomma($bo->bullets).""; ?></b> bullets<br /></td>
       </tr>
</table>
<? }elseif($page == "rankfire"){?>

<form action="" method="post" id="">
<table width="384" border="0" align="center" cellpadding="2" cellspacing="0" class="table">  
<tr>

           <td height="22" colspan="7" align="center" class="header">

   <div align="center"><strong>Rank to Fire at </strong></div>  </td>
 </tr>



       <tr>

         <td colspan="2" align="center" class="tableborder"><div align="center"><u><b>Rank to fire at</b></u><br>
           <br>
         Here you can choose which rank you want your bodygaurd to fire back at, update it here;<br><br>
         Fire back at rank: <select name="fireat" class="textbox">
     <option value="0"  selected="selected" >All Ranks</option>
          <option value="1" >Dirty Cop +</option>
     <option value="2" >Scum +</option>
     <option value="3" >Criminal +</option>
     <option value="4" >Vandal +</option>
     <option value="5" >Arsonist +</option>
     <option value="6" >Thug +</option>

     <option value="7" >Boss +</option>
     <option value="8" >Assassin +</option>
     <option value="9" >Don +</option>
     <option value="10" >Godfather +</option>
     <option value="11" >Global Threat +</option>
     <option value="12" >Global Dominator +</option>

     <option value="13" >Untouchable Godfather +</option>
     <option value="14" >Man Of Honour +</option>
     <option value="15" >Respectable Don +</option>
     <option value="16" >Legend +</option>
     <option value="17" >Official MM Legend +</option>
     <option value="18" >True MM Legend +</option>




   </select><br><br>
   <input type="submit" class="button" name="rank2" id="rank2" value="Change Rank" /><br>
   <?php


          if ($_POST['rank2']){
          $rname=$_POST['rname'];
          $fireat=strip_tags($_POST['fireat']); 
mysql_query("UPDATE bodygaurd SET ranktoshoot='$fireat' WHERE username='$username'");
echo "Your have changed the minimum rank that your bodyguard will shoot at.";
}

?><br />
       </tr>
</table> 
<?php }elseif($page == "status"){ ?>
<form action="" method="post" id="">
<table width="384" border="0" align="center" cellpadding="2" cellspacing="0" class="table">  
<tr>

           <td height="22" colspan="7" align="center" class="header">

   <div align="center"><strong>Status</strong></div>  </td>
 </tr>



       <tr>

         <td colspan="2" align="center" class="tableborder"><div align="center"><u><b>Status</b></u><br>
           <br>
           Here you can turn your bodygaurd on or off.
           <br>
           Your bodygaurd is currently;  <b><?php echo"$bo->status"; ?></b><br>
           <br>
           Bodygaurd
           : 
           <select name="status" class="textbox">
     <option value="On"  selected="selected" >On</option>
     <option value="Off" >Off</option>

   </select><br><br>
         <input type="submit" class="button" name="stat" id="stat" value="Change!">
         <br><?php


          if ($_POST['stat']){
          $status=strip_tags($_POST['status']); 
mysql_query("UPDATE bodygaurd SET status='$status' WHERE username='$username'");
echo "You have changed your bodyguard status to $status.";
}

?>
         <br />
       </tr>
</table>
<?php }elseif($page == "shop"){ ?>
<form action="" method="post" id="">
<table width="384" border="0" align="center" cellpadding="2" cellspacing="0" class="table">  
<tr>

           <td height="22" colspan="7" align="center" class="header">

   <div align="center"><strong>The Bodyguard Shop  </strong></div>  </td>
 </tr>



       <tr>

         <td colspan="2" align="center" class="tableborder"><div align="center"><u><b>The shop </b></u><br>
           <br>
         Here you can purchase weapons for your bodygaurd. <br>
         <br>
         Purchase a gun: 

           <select name="guntype" class="textbox">
             <option value="M16">M16 - £2,500,000</option>
             <option value="AWP">AWP - £10,000,000</option>
           </select><br><br><input type="submit" class="button" name="buyg" id="buyg" value="Buy Weapon" />

   <?php


          if ($_POST['buyg']){
          $guntype=$_POST['guntype'];

if($guntype == "M16")
{$guncost = "2500000"; 
}elseif($guntype == "AWP"){
$guncost = "10000000"; 
}
elseif($info->money  < $guncost){
print "You don't have enougth money for this";
} elseif($bo['weapon'] == $guntype){
print "Your bodyguard already has that weapon";
} elseif {
mysql_query("UPDATE bodygaurd SET weapon='$guntype' WHERE username='$username'");
mysql_query("UPDATE users SET money=money-$guncost WHERE username='$username'");
echo "<br>The $guntype was delivered to your body gaurd.";
}
}

?>
   <br>
   <br>
   Here you can swap normal bullets for Bodygaurd bullets. <br>
   <br><br />
   <b>Add bullets from your account: </b>
   <input name="buyb" type="text" class="textbox"  id="buyb" value="<?php echo "$fetch2->FMJ"; ?>" size="20">
   <br>
   <br>
   <em>Please note when you have added the bullet(s), you can't get them back!</em><br>
   <br>
   <input type="submit" class="button" name="buys" id="buys" value="Add Bullets" />
   <?php


          if ($_POST['buys']){
          $buyb=$_POST['buyb'];
          $status=strip_tags($_POST['status']); 
          if($fetch2->FMJ < $buyb){ 
          echo"You have not got that many FMJ.";
          }elseif($fetch2->FMJ >= $buyb){
mysql_query("UPDATE bodygaurd SET bullets=bullets+$buyb WHERE username='$username'");
mysql_query("UPDATE users SET FMJ=FMJ-$buyb WHERE username='$username'");
echo "<br>You successfully added <b>".makecomma($buyb)."</b> FMJ for your bodyguard!";
}}

?><br>
   <br />        </tr>
</table>
<? } ?></p>

 

Thank you in advance for your time and patience and your willing to help

Give the elseif a condition or make it just an "else"

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.

 Share

×
×
  • Create New...