Cronwerks MCCode/MCCodes Forums

Please login or register.

Login with username, password and session length


News:

Make some extra cash by selling Cronwerks mods with our affiliate system.


AuthorTopic: home.php help  (Read 186 times)

Jawz

  • Basic Member
  • *
  • Reputation Power: 11
  • Jawz has no influence.
  • Offline Offline
  • Posts: 17
    • View Profile
home.php help
« on: December 10, 2009, 05:28:04 PM »
i get a Parse error: syntax error, unexpected ';' in /home/mafia/public_html/home.php on line 352


from this file

Code: [Select]

<?php
include "globals.php";



// CALL Your House DATA
$h=$db->query("SELECT * FROM home_users WHERE home_userid={$userid}");
$home=$db->fetch_row($h);

$hh=$db->query("SELECT * FROM houses WHERE hWILL={$ir['maxwill']}");
$hhh=$db->fetch_row($hh);




if (
$home['home_userid'] == '') {
echo 
"<br> YOU ARE HOMELESS ! ";
return;
}

echo 
"<h1> INSIDE YOUR {$hhh['hNAME']} </h1><hr>";

echo 
"<br> You have entered your house, so what you gonna do ?";
echo 
"<br><br>";
echo 
"[<a href='home.php?action=upgrades'> Buy Upgrades </a>]";
echo 
"<br><br>";
echo 
"[<a href='home.php?action=livingroom'> Enter Living Room </a>]--[<a href='home.php?action=bedroom'> Enter Bed Room </a>]--[<a href='home.php?action=kitchen'> Enter Kitchen </a>]";

switch(
$_GET['action'])
{
case 
"livingroom":
living_room();
break;

case 
"bedroom":
bed_room();
break;

case 
"kitchen":
kitchen();
break;

case 
"upgrades":
home_upgrade();
break;

default:
index();
break;
}

function 
index()
{
global 
$db$ir,$c,$userid,$h,$home;

echo 
"<br><br>";
echo 
" Each room has different things for you to do !";

}

function 
living_room()
{
global 
$db$ir,$c,$userid,$h,$home;

echo 
"<br><br><h3> LIVING ROOM </h3><hr width=25%><br><br>";

$_POST['TV'] = mysql_real_escape_string($_POST['TV']);
if(
$_POST['TV']) {


   if (
$home['home_tv'] == 0) {
   echo 
" You do not own a TV ";
   return;
   }
   else {

   if (
$ir['watched_tv'] != 0) {
   echo 
" You can only watch TV once a hour.";
   return;
   }
   
$db->query(sprintf("UPDATE home_users SET home_microwave = $u WHERE home_userid = %u",1$userid));
   
$db->query(sprintf("UPDATE users SET view_tv = view_tv + %u, brave=maxbrave WHERE userid = %u",1,$userid));

   echo 
" You watched your TV for a while and gain 100 % Nerve !";
   return;
   }
 }

$_POST['SIT'] = mysql_real_escape_string($_POST['SIT']);
if(
$_POST['SIT']) {
   if (
$home['home_couch'] == 0) {
   echo 
" You do not own a Couch ! ";
   return;
   }
   else {

   if (
$ir['watched_couch'] != 0) {
   echo 
" You can only nap on your sofa once a hour.";
   return;
   }
   
$will $ir['maxwill'] * .20;
   
$willgain$ir['will'] + $will;
   if (
$willgain $ir['maxwill']) { $willgain $ir['maxgain'];}

   
$db->query(sprintf("UPDATE users SET sleep_sofa = sleep_sofa + %u, will=%u WHERE userid = %u",1,$willgain,$userid));

   echo 
" You napped on your sofa and gained some Awake !";
   return;
   }
 }



   if (
$home['home_tv'] > 0) {
echo "<table width=80%>
      <tr>
      <td width='25%'><img src='images/home/tv.png' width ='120' height = '120'></td>
      <td> Once a HOUR you can view the television. You will gain 100% Nerve for this action. </td>
      <td>"
;
           
echo "<br /><form action='home.php?action=livingroom' method='POST'>
           <input type='hidden' name='TV' />
           <input type='submit' value='Watch TV' name='TV' /></form><br />"
;

   echo 
"</td></tr></table>";

   } else { echo 
" YOU DONT OWN A TELEVISION. "; }

   echo 
"<br><br>";

 if (
$home['home_couch'] > 0) {
   
echo "<table width=80%>
      <tr>
      <td width='25%'><img src='images/home/couch.png' width ='120' height = '120'></td>
      <td> Once a HOUR you can take a nap on your Sofa. You will gain 50% Awake for this action. </td><td>"
;

        
echo "<br /><form action='home.php?action=livingroom' method='POST'>
         <input type='hidden' name='SIT' />
         <input type='submit' value='Sit Down' name='SIT' /></form><br />"
;

   echo 
"</td></tr></table>";
  } else { echo 
" YOU DONT OWN A SOFA. "; }





}

function 
bed_room()
{
global 
$db$ir,$c,$userid,$h,$home;

echo 
"<br><br><h3> BED ROOM </h3><hr width=25%><br><br>";

$_POST['SLEEP'] = mysql_real_escape_string($_POST['SLEEP']);
if(
$_POST['SLEEP']) {


   if (
$home['home_bed'] == 0) {
   echo 
" You do not own a Bed ";
   return;
   }
   else {

   if (
$ir['sleep_bed'] >= 2) {
   echo 
" You can only Sleep in your bed 2 times a day.";
   return;
   }

   
$db->query(sprintf("UPDATE users SET sleep_bed = sleep_bed + %u, energy=maxenergy, will=maxwill WHERE userid = %u",1,$userid));

   echo 
" You went to sleep for a while and gained Full Energy and Awake !";
   return;
   }
 }

   echo 
"<br><br>";

 if (
$home['home_bed'] > 0) {
   
echo "<table width=80%>
      <tr>
      <td width='25%'><img src='images/home/bed.png' width ='120' height = '120'></td>
      <td> Twice a DAY you can go to sleep on your Bed. You will gain Full Energy and Awake for this action. </td><td>"
;

        
echo "<br /><form action='home.php?action=bedroom' method='POST'>
         <input type='hidden' name='SLEEP' />
         <input type='submit' value='Sleep' name='SLEEP' /></form><br />"
;

   echo 
"</td></tr></table>";
  } else { echo 
" YOU DONT OWN A BED. "; }

}

function 
kitchen()
{
global 
$db$ir,$c,$userid,$h,$home;

echo 
"<br><br><h3> KITCHEN </h3><hr width=25%><br><br>";

$_POST['STOVE'] = mysql_real_escape_string($_POST['STOVE']);
 if(
$_POST['STOVE']) {
      
if ($home['home_refridgerator'] ==0) {
     
echo " A refridgerator is required to cook meals. ";
     
return;
     
}
     
else {


   if (
$home['home_stove'] == 0) {
   echo 
" You do not own a stove ";
   return;
   }
   else {

   if (
$ir['meals_eat'] >= 3) {
   echo 
" You can only eat 3 meals a day.";
   return;
   }

   
$db->query(sprintf("UPDATE users SET meal_eat = meal_eat + %u, energy=maxenergy, hp=maxhp WHERE userid = %u",1,$userid));

   echo 
" You cooked a Superb Meal and gained Full Energy and Health. !";
   return;
   }
 }
}

$_POST['MICROWAVE'] = mysql_real_escape_string($_POST['MICROWAVE']);
 if(
$_POST['MICROWAVE']) {
     
if ($home['home_refridgerator'] ==0) {
     
echo " A refridgerator is required to cook meals. ";
     
return;
     
}
     
else {

   if (
$home['home_microwave'] == 0) {
   echo 
" You do not own a microwave ";
   return;
   }
   else {

   if (
$ir['meals_eat'] >= 3) {
   echo 
" You can only eat 3 times a day.";
   return;
   }
$energy $ir['maxenergy'] * .50;
$health $ir['maxhp'] * .50;
$energygain $ir['energy'] + $energy;
if ($energygain $ir['maxenergy']) { $energygain $ir['maxenergy']; }
$healthgain $ir['hp'] + $health;
if ($healthgain $ir['maxhp']) { $healthgain $ir['maxhp']; }

   
$db->query(sprintf("UPDATE users SET meal_eat = meal_eat + %u, energy=%u, hp=%u WHERE userid = %u",1,$energygain,$healthgain,$userid));

   echo 
" You Cooked a decent meal and gained some Energy and Health !";
   return;
   }
 }
}


   echo 
"<br><br>";

 if (
$home['home_refridgerator'] > 0) {
   
echo "<table width=80%>
      <tr>
      <td width='25%'><img src='images/home/fridge.png' width ='120' height = '120'></td>
      <td> You can Eat 3 Times a day.</td>
      <td> NO ACTIONS </td></tr></table>"
;
  } else { echo 
" YOU DONT OWN A REFRIDGERATOR. "; }

 
echo "<br><br>";

 if (
$home['home_stove'] > 0) {
   
echo "<table width=80%>
      <tr>
      <td width='25%'><img src='images/home/stove.png' width ='120' height = '120'></td>
      <td> You will gain FULL Energy and Awake for this action. </td><td>"
;

        
echo "<br /><form action='home.php?action=kitchen' method='POST'>
         <input type='hidden' name='STOVE' />
         <input type='submit' value='Cook' name='STOVE' /></form><br />"
;

   echo 
"</td></tr></table>";
  } else { echo 
" YOU DONT OWN A STOVE. "; }

 
echo "<br><br>";

  if (
$home['home_microwave'] > 0) {
   
echo "<table width=80%>
      <tr>
      <td width='25%'><img src='images/home/microwave.png' width ='120' height = '120'></td>
      <td> You will gain 50% Energy and Awake for this action. </td><td>"
;

        
echo "<br /><form action='home.php?action=kitchen' method='POST'>
         <input type='hidden' name='MICROWAVE' />
         <input type='submit' value='Cook' name='MICROWAVE' /></form><br />"
;

   echo 
"</td></tr></table>";
  } else { echo 
" YOU DONT OWN A MICROWAVE. "; }


}

       
function home_upgrade()
       
{
       
global $db$ir,$c,$userid,$h,$home;

       
echo "<br><br><h3> Home Upgrades </h3><hr width=25%><br><br>";

       
$_POST['buyTV'] = mysql_real_escape_string($_POST['buyTV']);
       
if($_POST['buyTV']) {

        
if ($home['home_tv'] != 0) { echo " YOU ALREADY OWN A TV. "; return;}

        
if ($ir['money'] < 10000000) {
         
echo " You cannot afford a TV ! ";
          
return;
             
}
             
$db->query(sprintf("UPDATE home_users SET home_tv = %u WHERE home_userid = %u",1,$userid));
             
$db->query(sprintf("UPDATE users SET money = money - %u WHERE userid = %u",10000000,$userid));
             
echo " You have successfully purchased a TV !";
             
return;

             
}
             
$_POST['buySOFA'] = mysql_real_escape_string($_POST['buySOFA']);
             
if($_POST['buySOFA']) {

              
if ($home['home_couch'] != 0) { echo " YOU ALREADY OWN A SOFA. "; return;}

   if (
$ir['money'] < 25000000) {
   echo 
" You cannot afford a Sofa ! ";
   return;
   }

   
$db->query(sprintf("UPDATE home_users SET home_couch = %u WHERE home_userid = %u",1,$userid));
   
$db->query(sprintf("UPDATE users SET money = money - %u WHERE userid = %u",25000000,$userid));
   echo 
" You have successfully purchased a Sofa !";
   return;

 }
$_POST['buyBED'] = mysql_real_escape_string($_POST['buyBED']);
  if(
$_POST['buyBED']) {

   if (
$home['home_bed'] != 0) { echo " YOU ALREADY OWN A BED. "; return;}

   if (
$ir['money'] < 100000000) {
   echo 
" You cannot afford a Bed! ";
   return;
   }

   
$db->query{sprintf("UPDATE home_users SET home_bed = %u WHERE home_userid = %u",1,$userid);
   
$db->query(sprintf("UPDATE users SET money = money - %u WHERE userid = %u",100000000,$userid);
   echo 
" You have successfully purchased a bed !";
   return;

 }
$_POST['buyFRIDGE'] = mysql_real_escape_string($_POST['buyFRIDGE']);
   if(
$_POST['buyFRIDGE']) {

   if (
$home['home_refridgerator'] != 0) { echo " YOU ALREADY OWN A REFRIDGERATOR. "; return;}

   if (
$ir['money'] < 150000000) {
   echo 
" You cannot afford a Refridgerator! ";
   return;
   }

   
$db->query(sprintf("UPDATE home_users SET home_refridgerator = %u WHERE home_userid = %u",1,$userid);
   
$db->query(sprintf("UPDATE users SET money = money - %u WHERE userid = %u",15000000,$userid);
   echo 
" You have successfully purchased a Refridgerator !";
   return;

 }
$_POST['buySTOVE'] = mysql_real_escape_string($_POST['buySTOVE']);
   if(
$_POST['buySTOVE']) {

   if (
$home['home_stove'] != 0) { echo " YOU ALREADY OWN A STOVE. "; return;}

   if (
$ir['money'] < 200000000) {
   echo 
" You cannot afford a Stove! ";
   return;
   }

   
$db->query(sprintf("UPDATE home_users SET home_stove = %u WHERE home_userid = %u",1,$userid);
   
$db->query((sprintf"UPDATE users SET money = money - %u WHERE userid = %u",20000000,$userid);
   echo 
" You have successfully purchased a Stove !";
   return;

 }
$_POST['buyMICROWAVE'] = mysql_real_escape_string($_POST['buyMICROWAVE']);
if($_POST['buyMICROWAVE']) {

   if (
$home['home_microwave'] != 0) { echo " YOU ALREADY OWN A MICROWAVE. "; return;}

   if (
$ir['money'] < 50000000) {
   echo 
" You cannot afford a Microwave! ";
   return;
   }

   
$db->query(sprintf("UPDATE home_users SET home_microwave = %u WHERE home_userid = %u",1$userid));
   
$db->query(sprintf("UPDATE users SET money = money - %u WHERE userid = %u",50000000$userid));
   echo 
" You have successfully purchased a Microwave !";
   return;

 }


echo 
"<table width=80%>
   <th colspan=4> LIVING ROOM UPGRADES </th> </tr>
   <th> </th> <th> DESCRIPTION </th> <th> PRICE </th> <th> PURCHASE </th>
   <tr><td width=25%><img src='images/home/tv.png' width ='120' height = '120'></td> <td> A nice addition to anyones living room !</td>
   <td> \$10,000,000 </td><td>"
;
  
if ($home['home_tv'] == 0) {
     
echo "<br /><form action='home.php?action=upgrades' method='POST'>
      <input type='hidden' name='buyTV' />
      <input type='submit' value='Buy' name='buyTV' /></form><br />"
;
     
} else { echo " BOUGHT "; }
  
echo " </td></tr><tr>
   <td><img src='images/home/couch.png' width ='120' height = '120'></td> <td> A very Comfortable Sofa to lounge on. </td>
   <td> \$25,000,000 </td><td>"
;
     
if ($home['home_couch'] == 0) {
     
echo "<br /><form action='home.php?action=upgrades' method='POST'>
      <input type='hidden' name='buySOFA' />
      <input type='submit' value='Buy' name='buySOFA' /></form><br />"
;
     
} else { echo " BOUGHT "; }
  
echo "</td></tr>
   </table>"
;

echo 
" <br><br><hr width=80%><br><br>";

  
echo "<table width=80%>
   <th colspan=4> BEDROOM UPGRADES </th> </tr>
   <th> </th> <th> DESCRIPTION </th> <th> PRICE </th> <th> PURCHASE </th>
   <tr><td width=25%><img src='images/home/bed.png' width ='120' height = '120'></td> <td> Anyone who owns a house will need a Bed !</td>
   <td> \$100,000,000 </td><td>"
;
  
if ($home['home_bed'] == 0) {
     
echo "<br /><form action='home.php?action=upgrades' method='POST'>
      <input type='hidden' name='buyBED' />
      <input type='submit' value='Buy' name='buyBED' /></form><br />"
;
     
} else { echo " BOUGHT "; }
  
echo " </td></tr>
          </table>"
;

echo 
" <br><br><hr width=80%><br><br>";

  
echo "<table width=80%>
   <th colspan=4> KITCHEN UPGRADES </th> </tr>
   <th> </th> <th> DESCRIPTION </th> <th> PRICE </th> <th> PURCHASE </th>
   <tr><td width=25%><img src='images/home/fridge.png' width ='120' height = '120'></td> <td> Who dont need a Fridgerator ?</td>
   <td> \$150,000,000 </td><td>"
;
  
if ($home['home_refridgerator'] == 0) {
     
echo "<br /><form action='home.php?action=upgrades' method='POST'>
      <input type='hidden' name='buyFRIDGE' />
      <input type='submit' value='Buy' name='buyFRIDGE' /></form><br />"
;
     
} else { echo " BOUGHT "; }

           
echo " </td></tr><tr>
      <td><img src='images/home/stove.png' width ='120' height = '120'></td> <td> Best way to cook your meals. </td>
      <td> \$200,000,000 </td><td>"
;
     
if ($home['home_stove'] == 0) {
     
echo "<br /><form action='home.php?action=upgrades' method='POST'>
      <input type='hidden' name='buySTOVE' />
      <input type='submit' value='Buy' name='buySTOVE' /></form><br />"
;
     
} else { echo " BOUGHT "; }

  
echo " </td></tr><tr>
      <td><img src='images/home/microwave.png' width ='120' height = '120'></td> <td> Cook your meals with this, not as effective as the stove but gets the job done. </td>
      <td> \$50,000,000 </td><td>"
;
     
if ($home['home_microwave'] == 0) {
     
echo "<br /><form action='home.php?action=upgrades' method='POST'>
      <input type='hidden' name='buyMICROWAVE' />
      <input type='submit' value='Buy' name='buyMICROWAVE' /></form><br />"
;
     
} else { echo " BOUGHT "; }
  
echo " </td></tr>
          </table>"
;



}
$h->endpage();
?>

could someone please help thanks
Logged

Maketextgames.com

  • Active Member
  • **
  • Reputation Power: 112
  • Maketextgames.com is working their way up.Maketextgames.com is working their way up.Maketextgames.com is working their way up.
  • Offline Offline
  • Posts: 204
    • MSN Messenger - immortalthug4ever@hotmail.com
    • View Profile
    • WWW
Re: home.php help
« Reply #1 on: December 10, 2009, 07:49:02 PM »
Code: [Select]
<?php
include "globals.php";



// CALL Your House DATA
$h=$db->query("SELECT * FROM home_users WHERE home_userid={$userid}");
$home=$db->fetch_row($h);

$hh=$db->query("SELECT * FROM houses WHERE hWILL={$ir['maxwill']}");
$hhh=$db->fetch_row($hh);




if (
$home['home_userid'] == '') {
echo 
"<br> YOU ARE HOMELESS ! ";
return;
}

echo 
"<h1> INSIDE YOUR {$hhh['hNAME']} </h1><hr>";

echo 
"<br> You have entered your house, so what you gonna do ?";
echo 
"<br><br>";
echo 
"[<a href='home.php?action=upgrades'> Buy Upgrades </a>]";
echo 
"<br><br>";
echo 
"[<a href='home.php?action=livingroom'> Enter Living Room </a>]--[<a href='home.php?action=bedroom'> Enter Bed Room </a>]--[<a href='home.php?action=kitchen'> Enter Kitchen </a>]";

switch(
$_GET['action'])
{
case 
"livingroom":
living_room();
break;

case 
"bedroom":
bed_room();
break;

case 
"kitchen":
kitchen();
break;

case 
"upgrades":
home_upgrade();
break;

default:
index();
break;
}

function 
index()
{
global 
$db$ir,$c,$userid,$h,$home;

echo 
"<br><br>";
echo 
" Each room has different things for you to do !";

}

function 
living_room()
{
global 
$db$ir,$c,$userid,$h,$home;

echo 
"<br><br><h3> LIVING ROOM </h3><hr width=25%><br><br>";

$_POST['TV'] = mysql_real_escape_string($_POST['TV']);
if(
$_POST['TV']) {


   if (
$home['home_tv'] == 0) {
   echo 
" You do not own a TV ";
   return;
   }
   else {

   if (
$ir['watched_tv'] != 0) {
   echo 
" You can only watch TV once a hour.";
   return;
   }
   
$db->query(sprintf("UPDATE home_users SET home_microwave = $u WHERE home_userid = %u",1$userid));
   
$db->query(sprintf("UPDATE users SET view_tv = view_tv + %u, brave=maxbrave WHERE userid = %u",1,$userid));

   echo 
" You watched your TV for a while and gain 100 % Nerve !";
   return;
   }
 }

$_POST['SIT'] = mysql_real_escape_string($_POST['SIT']);
if(
$_POST['SIT']) {
   if (
$home['home_couch'] == 0) {
   echo 
" You do not own a Couch ! ";
   return;
   }
   else {

   if (
$ir['watched_couch'] != 0) {
   echo 
" You can only nap on your sofa once a hour.";
   return;
   }
   
$will $ir['maxwill'] * .20;
   
$willgain$ir['will'] + $will;
   if (
$willgain $ir['maxwill']) { $willgain $ir['maxgain'];}

   
$db->query(sprintf("UPDATE users SET sleep_sofa = sleep_sofa + %u, will=%u WHERE userid = %u",1,$willgain,$userid));

   echo 
" You napped on your sofa and gained some Awake !";
   return;
   }
 }



   if (
$home['home_tv'] > 0) {
echo "<table width=80%>
      <tr>
      <td width='25%'><img src='images/home/tv.png' width ='120' height = '120'></td>
      <td> Once a HOUR you can view the television. You will gain 100% Nerve for this action. </td>
      <td>"
;
           
echo "<br /><form action='home.php?action=livingroom' method='POST'>
           <input type='hidden' name='TV' />
           <input type='submit' value='Watch TV' name='TV' /></form><br />"
;

   echo 
"</td></tr></table>";

   } else { echo 
" YOU DONT OWN A TELEVISION. "; }

   echo 
"<br><br>";

 if (
$home['home_couch'] > 0) {
   
echo "<table width=80%>
      <tr>
      <td width='25%'><img src='images/home/couch.png' width ='120' height = '120'></td>
      <td> Once a HOUR you can take a nap on your Sofa. You will gain 50% Awake for this action. </td><td>"
;

        
echo "<br /><form action='home.php?action=livingroom' method='POST'>
         <input type='hidden' name='SIT' />
         <input type='submit' value='Sit Down' name='SIT' /></form><br />"
;

   echo 
"</td></tr></table>";
  } else { echo 
" YOU DONT OWN A SOFA. "; }





}

function 
bed_room()
{
global 
$db$ir,$c,$userid,$h,$home;

echo 
"<br><br><h3> BED ROOM </h3><hr width=25%><br><br>";

$_POST['SLEEP'] = mysql_real_escape_string($_POST['SLEEP']);
if(
$_POST['SLEEP']) {


   if (
$home['home_bed'] == 0) {
   echo 
" You do not own a Bed ";
   return;
   }
   else {

   if (
$ir['sleep_bed'] >= 2) {
   echo 
" You can only Sleep in your bed 2 times a day.";
   return;
   }

   
$db->query(sprintf("UPDATE users SET sleep_bed = sleep_bed + %u, energy=maxenergy, will=maxwill WHERE userid = %u",1,$userid));

   echo 
" You went to sleep for a while and gained Full Energy and Awake !";
   return;
   }
 }

   echo 
"<br><br>";

 if (
$home['home_bed'] > 0) {
   
echo "<table width=80%>
      <tr>
      <td width='25%'><img src='images/home/bed.png' width ='120' height = '120'></td>
      <td> Twice a DAY you can go to sleep on your Bed. You will gain Full Energy and Awake for this action. </td><td>"
;

        
echo "<br /><form action='home.php?action=bedroom' method='POST'>
         <input type='hidden' name='SLEEP' />
         <input type='submit' value='Sleep' name='SLEEP' /></form><br />"
;

   echo 
"</td></tr></table>";
  } else { echo 
" YOU DONT OWN A BED. "; }

}

function 
kitchen()
{
global 
$db$ir,$c,$userid,$h,$home;

echo 
"<br><br><h3> KITCHEN </h3><hr width=25%><br><br>";

$_POST['STOVE'] = mysql_real_escape_string($_POST['STOVE']);
 if(
$_POST['STOVE']) {
      
if ($home['home_refridgerator'] ==0) {
     
echo " A refridgerator is required to cook meals. ";
     
return;
     
}
     
else {


   if (
$home['home_stove'] == 0) {
   echo 
" You do not own a stove ";
   return;
   }
   else {

   if (
$ir['meals_eat'] >= 3) {
   echo 
" You can only eat 3 meals a day.";
   return;
   }

   
$db->query(sprintf("UPDATE users SET meal_eat = meal_eat + %u, energy=maxenergy, hp=maxhp WHERE userid = %u",1,$userid));

   echo 
" You cooked a Superb Meal and gained Full Energy and Health. !";
   return;
   }
 }
}

$_POST['MICROWAVE'] = mysql_real_escape_string($_POST['MICROWAVE']);
 if(
$_POST['MICROWAVE']) {
     
if ($home['home_refridgerator'] ==0) {
     
echo " A refridgerator is required to cook meals. ";
     
return;
     
}
     
else {

   if (
$home['home_microwave'] == 0) {
   echo 
" You do not own a microwave ";
   return;
   }
   else {

   if (
$ir['meals_eat'] >= 3) {
   echo 
" You can only eat 3 times a day.";
   return;
   }
$energy $ir['maxenergy'] * .50;
$health $ir['maxhp'] * .50;
$energygain $ir['energy'] + $energy;
if ($energygain $ir['maxenergy']) { $energygain $ir['maxenergy']; }
$healthgain $ir['hp'] + $health;
if ($healthgain $ir['maxhp']) { $healthgain $ir['maxhp']; }

   
$db->query(sprintf("UPDATE users SET meal_eat = meal_eat + %u, energy=%u, hp=%u WHERE userid = %u",1,$energygain,$healthgain,$userid));

   echo 
" You Cooked a decent meal and gained some Energy and Health !";
   return;
   }
 }
}


   echo 
"<br><br>";

 if (
$home['home_refridgerator'] > 0) {
   
echo "<table width=80%>
      <tr>
      <td width='25%'><img src='images/home/fridge.png' width ='120' height = '120'></td>
      <td> You can Eat 3 Times a day.</td>
      <td> NO ACTIONS </td></tr></table>"
;
  } else { echo 
" YOU DONT OWN A REFRIDGERATOR. "; }

 
echo "<br><br>";

 if (
$home['home_stove'] > 0) {
   
echo "<table width=80%>
      <tr>
      <td width='25%'><img src='images/home/stove.png' width ='120' height = '120'></td>
      <td> You will gain FULL Energy and Awake for this action. </td><td>"
;

        
echo "<br /><form action='home.php?action=kitchen' method='POST'>
         <input type='hidden' name='STOVE' />
         <input type='submit' value='Cook' name='STOVE' /></form><br />"
;

   echo 
"</td></tr></table>";
  } else { echo 
" YOU DONT OWN A STOVE. "; }

 
echo "<br><br>";

  if (
$home['home_microwave'] > 0) {
   
echo "<table width=80%>
      <tr>
      <td width='25%'><img src='images/home/microwave.png' width ='120' height = '120'></td>
      <td> You will gain 50% Energy and Awake for this action. </td><td>"
;

        
echo "<br /><form action='home.php?action=kitchen' method='POST'>
         <input type='hidden' name='MICROWAVE' />
         <input type='submit' value='Cook' name='MICROWAVE' /></form><br />"
;

   echo 
"</td></tr></table>";
  } else { echo 
" YOU DONT OWN A MICROWAVE. "; }


}

       
function home_upgrade()
       
{
       
global $db$ir,$c,$userid,$h,$home;

       
echo "<br><br><h3> Home Upgrades </h3><hr width=25%><br><br>";

       
$_POST['buyTV'] = mysql_real_escape_string($_POST['buyTV']);
       
if($_POST['buyTV']) {

        
if ($home['home_tv'] != 0) { echo " YOU ALREADY OWN A TV. "; return;}

        
if ($ir['money'] < 10000000) {
         
echo " You cannot afford a TV ! ";
          
return;
             
}
             
$db->query(sprintf("UPDATE home_users SET home_tv = %u WHERE home_userid = %u",1,$userid));
             
$db->query(sprintf("UPDATE users SET money = money - %u WHERE userid = %u",10000000,$userid));
             
echo " You have successfully purchased a TV !";
             
return;

             
}
             
$_POST['buySOFA'] = mysql_real_escape_string($_POST['buySOFA']);
             
if($_POST['buySOFA']) {

              
if ($home['home_couch'] != 0) { echo " YOU ALREADY OWN A SOFA. "; return;}

   if (
$ir['money'] < 25000000) {
   echo 
" You cannot afford a Sofa ! ";
   return;
   }

   
$db->query(sprintf("UPDATE home_users SET home_couch = %u WHERE home_userid = %u",1,$userid));
   
$db->query(sprintf("UPDATE users SET money = money - %u WHERE userid = %u",25000000,$userid));
   echo 
" You have successfully purchased a Sofa !";
   return;

 }
$_POST['buyBED'] = mysql_real_escape_string($_POST['buyBED']);
  if(
$_POST['buyBED']) {

   if (
$home['home_bed'] != 0) { echo " YOU ALREADY OWN A BED. "; return;}

   if (
$ir['money'] < 100000000) {
   echo 
" You cannot afford a Bed! ";
   return;
   }

   
$db->query{sprintf("UPDATE home_users SET home_bed = %u WHERE home_userid = %u",1,$userid));
   
$db->query(sprintf("UPDATE users SET money = money - %u WHERE userid = %u",100000000,$userid));
   echo 
" You have successfully purchased a bed !";
   return;

 }
$_POST['buyFRIDGE'] = mysql_real_escape_string($_POST['buyFRIDGE']);
   if(
$_POST['buyFRIDGE']) {

   if (
$home['home_refridgerator'] != 0) { echo " YOU ALREADY OWN A REFRIDGERATOR. "; return;}

   if (
$ir['money'] < 150000000) {
   echo 
" You cannot afford a Refridgerator! ";
   return;
   }

   
$db->query(sprintf("UPDATE home_users SET home_refridgerator = %u WHERE home_userid = %u",1,$userid));
   
$db->query(sprintf("UPDATE users SET money = money - %u WHERE userid = %u",15000000,$userid));
   echo 
" You have successfully purchased a Refridgerator !";
   return;

 }
$_POST['buySTOVE'] = mysql_real_escape_string($_POST['buySTOVE']);
   if(
$_POST['buySTOVE']) {

   if (
$home['home_stove'] != 0) { echo " YOU ALREADY OWN A STOVE. "; return;}

   if (
$ir['money'] < 200000000) {
   echo 
" You cannot afford a Stove! ";
   return;
   }

   
$db->query(sprintf("UPDATE home_users SET home_stove = %u WHERE home_userid = %u",1,$userid));
   
$db->query((sprintf"UPDATE users SET money = money - %u WHERE userid = %u",20000000,$userid));
   echo 
" You have successfully purchased a Stove !";
   return;

 }
$_POST['buyMICROWAVE'] = mysql_real_escape_string($_POST['buyMICROWAVE']);
if($_POST['buyMICROWAVE']) {

   if (
$home['home_microwave'] != 0) { echo " YOU ALREADY OWN A MICROWAVE. "; return;}

   if (
$ir['money'] < 50000000) {
   echo 
" You cannot afford a Microwave! ";
   return;
   }

   
$db->query(sprintf("UPDATE home_users SET home_microwave = %u WHERE home_userid = %u",1$userid));
   
$db->query(sprintf("UPDATE users SET money = money - %u WHERE userid = %u",50000000$userid));
   echo 
" You have successfully purchased a Microwave !";
   return;

 }


echo 
"<table width=80%>
   <th colspan=4> LIVING ROOM UPGRADES </th> </tr>
   <th> </th> <th> DESCRIPTION </th> <th> PRICE </th> <th> PURCHASE </th>
   <tr><td width=25%><img src='images/home/tv.png' width ='120' height = '120'></td> <td> A nice addition to anyones living room !</td>
   <td> \$10,000,000 </td><td>"
;
  
if ($home['home_tv'] == 0) {
     
echo "<br /><form action='home.php?action=upgrades' method='POST'>
      <input type='hidden' name='buyTV' />
      <input type='submit' value='Buy' name='buyTV' /></form><br />"
;
     
} else { echo " BOUGHT "; }
  
echo " </td></tr><tr>
   <td><img src='images/home/couch.png' width ='120' height = '120'></td> <td> A very Comfortable Sofa to lounge on. </td>
   <td> \$25,000,000 </td><td>"
;
     
if ($home['home_couch'] == 0) {
     
echo "<br /><form action='home.php?action=upgrades' method='POST'>
      <input type='hidden' name='buySOFA' />
      <input type='submit' value='Buy' name='buySOFA' /></form><br />"
;
     
} else { echo " BOUGHT "; }
  
echo "</td></tr>
   </table>"
;

echo 
" <br><br><hr width=80%><br><br>";

  
echo "<table width=80%>
   <th colspan=4> BEDROOM UPGRADES </th> </tr>
   <th> </th> <th> DESCRIPTION </th> <th> PRICE </th> <th> PURCHASE </th>
   <tr><td width=25%><img src='images/home/bed.png' width ='120' height = '120'></td> <td> Anyone who owns a house will need a Bed !</td>
   <td> \$100,000,000 </td><td>"
;
  
if ($home['home_bed'] == 0) {
     
echo "<br /><form action='home.php?action=upgrades' method='POST'>
      <input type='hidden' name='buyBED' />
      <input type='submit' value='Buy' name='buyBED' /></form><br />"
;
     
} else { echo " BOUGHT "; }
  
echo " </td></tr>
          </table>"
;

echo 
" <br><br><hr width=80%><br><br>";

  
echo "<table width=80%>
   <th colspan=4> KITCHEN UPGRADES </th> </tr>
   <th> </th> <th> DESCRIPTION </th> <th> PRICE </th> <th> PURCHASE </th>
   <tr><td width=25%><img src='images/home/fridge.png' width ='120' height = '120'></td> <td> Who dont need a Fridgerator ?</td>
   <td> \$150,000,000 </td><td>"
;
  
if ($home['home_refridgerator'] == 0) {
     
echo "<br /><form action='home.php?action=upgrades' method='POST'>
      <input type='hidden' name='buyFRIDGE' />
      <input type='submit' value='Buy' name='buyFRIDGE' /></form><br />"
;
     
} else { echo " BOUGHT "; }

           
echo " </td></tr><tr>
      <td><img src='images/home/stove.png' width ='120' height = '120'></td> <td> Best way to cook your meals. </td>
      <td> \$200,000,000 </td><td>"
;
     
if ($home['home_stove'] == 0) {
     
echo "<br /><form action='home.php?action=upgrades' method='POST'>
      <input type='hidden' name='buySTOVE' />
      <input type='submit' value='Buy' name='buySTOVE' /></form><br />"
;
     
} else { echo " BOUGHT "; }

  
echo " </td></tr><tr>
      <td><img src='images/home/microwave.png' width ='120' height = '120'></td> <td> Cook your meals with this, not as effective as the stove but gets the job done. </td>
      <td> \$50,000,000 </td><td>"
;
     
if ($home['home_microwave'] == 0) {
     
echo "<br /><form action='home.php?action=upgrades' method='POST'>
      <input type='hidden' name='buyMICROWAVE' />
      <input type='submit' value='Buy' name='buyMICROWAVE' /></form><br />"
;
     
} else { echo " BOUGHT "; }
  
echo " </td></tr>
          </table>"
;



}
$h->endpage();
?>

Jawz

  • Basic Member
  • *
  • Reputation Power: 11
  • Jawz has no influence.
  • Offline Offline
  • Posts: 17
    • View Profile
Re: home.php help
« Reply #2 on: December 11, 2009, 11:38:24 AM »
thanks but now i get

Parse error: syntax error, unexpected ')' in /home/mafia/public_html/home.php on line 352
Logged

Maketextgames.com

  • Active Member
  • **
  • Reputation Power: 112
  • Maketextgames.com is working their way up.Maketextgames.com is working their way up.Maketextgames.com is working their way up.
  • Offline Offline
  • Posts: 204
    • MSN Messenger - immortalthug4ever@hotmail.com
    • View Profile
    • WWW
Re: home.php help
« Reply #3 on: December 11, 2009, 12:18:17 PM »
The code is a mess, a lot of the sprintf queries weren't double )) closed
i'd say go through and find the sprint f queries and make sure )) is at the end not just )