Jump to content

Recommended Posts

Hey guys, I can seem to find my phase error on this.  I am getting this error

 

[error]

Parse error: syntax error, unexpected $end in /home/klrbal/public_html/Mafia-test/tempfam.php on line 524[/error]

 

Well, 524 is the LAST line in my script.  I know that it usually means that there is a } missing somewhere, but I can't seem to find it.  Can anyone help?

 

<?
session_start();  

if (!(isset($_SESSION["real_name"])))
{
//echo "I'm not logged in";
header('Location: index.php');
}
else
{
echo "";
}


?>



<html>
<head>
<title>Mafia Syndicate BETA .::. Families</title></head>
    	<link REL="stylesheet" TYPE="text/css" HREF="main.css">

<script language=javascript src=Menus.js></script>

<body background="wallpaper.jpg">
<center> 
<table border="0" cellspacing="0" cellpadding="0" align="center" width="95%" class="cat">

<TR> 

<TD width="150" background="tdbg3.jpg" bgcolor="#222222" valign="top">
<?php include("leftmenu.php");?>
</TD>
  
    <td width="100%" valign="top">	<br>	


<?php

	$fetch=mysql_fetch_object(mysql_query("SELECT * FROM crews WHERE name='$crew' LIMIT 1"));

////CREATE CREW/////
if ($_POST['createfamily'] && $_POST['familyname']){

$familyname == $_POST['familyname']; 

if ($rankpoints <= 140109){ 

echo "You must be Underboss before you can make a crew!";

}else{


if ($crewlevel==0){

$finalcash = $cash - 500000000000 ;

if ($finalcash <0){

echo "You do not have enough cash!";

}elseif ($finalcash >=0){

$num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE id >1"));
if ($num_true >= 5){
echo "There are already 5 Crew Slots!"; 
}else{

$num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE name='$familyname'"));
if ($num_true >= 1){

echo "There is already a Family with that name!";
}else{

function change($msg){
$post = $msg;
$post = str_replace("'", "`", $post); 
return $post;
}

$new=change($crewname);

mysql_query("INSERT INTO `family` ( `id` , `owner` , `name` , `bank` , `quote` , `news` , `slot` ) VALUES ('', '$username', '$new', '0', 'No Quote!', 'You have no family news8)', '50')");
mysql_query("UPDATE users SET famlevel='9' WHERE username='$username'");
mysql_query("UPDATE users SET cash='$finalcash', family='$new'  WHERE username='$username'");
mysql_query("INSERT INTO `logs` ( `id` , `who` , `action` , `date` , `ip` ) VALUES ('', '$username', 'Bought a Family called <b>$new</b>!', '$date', '$realip')");

echo "You have created the Family <b>$new!</b>";



}
}
}
}
}

}

if ($_POST['cancelapply']){

mysql_query("DELETE FROM famreq WHERE username='$username'");

echo "You have cancelled your application!";

}


/////END OF CREATE CREW!!!/////

if (famlevel->2);

if ($_POST['inviteuser'] && strip_tags($_POST['inviteusername'])){

$sql2="SELECT * from famreq WHERE username='$username'";
$result2=mysql_query($sql2);

$num_true=mysql_num_rows($result2);
if ($num_true >= 1){
echo "You have already pending Family request!"; 
}elseif ($num_true <=1){

$crewnamejoin = $_POST['inviteusername'];
$crewnamejoin = strip_tags($inviteusername);

$sql="SELECT * FROM users WHERE username='$username'";
$result=mysql_query($sql);

if ($_POST['acceptinvite']){

$sql="SELECT * from famreq WHERE family='$famid'";
$result=mysql_query($sql);


mysql_query("INSERT INTO `famreq` ( `id` , `famid` , `username` , `status` , `f` ) VALUES (
'', '$invitedusername', '$username', '$status', '$f' )");


echo "You have requested $invitedusername to join your family!";

}
}

if ($_POST['leave'] && $famlevel >=2 && $famlevel <7){

if ($famlevel <= 0) 
{
echo "You are not in a Family!";
}else{


if ($famlevel >= 4) 
{
echo "You can not leave your family!";

if ($_POST['change'] && strip_tags($_POST['newfamname']) && strip_tags($_POST['famid']) && $userlevel >=10){

$newcrewname = $_POST['newfamname'];
$newcrewname = strip_tags($newfamname);
$crewid = $_POST['famid'];
$crewid = strip_tags($famid);

$sql="SELECT * from family WHERE id='$famid'";
$result=mysql_query($sql);

while($rows=mysql_fetch_array($result)){ // Start looping table row 

$oname = $rows['name'];
}

$num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE name='$newfamname'"));
if ($num_true >= 1){

echo "There is already a family with that name!";
}else{


function change($msg)
{
$post = $msg;
$post = str_replace("'", "`", $post); 
return $post;
}

$newfamname=change($newfamame);

mysql_query("UPDATE users SET famname='$newfamname' WHERE famname='$oname'");
mysql_query("UPDATE famreq SET famid='$newfamname' WHERE famid='$oname'");
mysql_query("UPDATE forum_answer SET place='$newfamname' WHERE place='$oname'");
mysql_query("UPDATE forum_question SET place='$newfamname' WHERE place='$oname'");
mysql_query("UPDATE family_donations SET fam='$newfamname' WHERE famname='$oname'");
mysql_query("UPDATE family SET famname='$newfamname' WHERE id='$crewid'");
mysql_query("UPDATE BG SET crew='$newfamname' WHERE crew='$oname'");


echo "You changed the family $oname to $newfamname!";

}}

if ($_POST['dropfam'] && strip_tags($_POST['famnamedrop']) && $userlevel >=15){

$crewnamedrop = $_POST['famnamedrop'];
$crewnamedrop = strip_tags($famnamedrop);

mysql_query("DELETE FROM crews WHERE name='$crewnamedrop'");
mysql_query("UPDATE users SET crewlevel='0', crew='None' WHERE crew='$crewnamedrop'");
mysql_query("DELETE FROM crewapply WHERE crew='$crewnamedrop'");
mysql_query("DELETE FROM forum_answer WHERE place='$crewnamedrop'");
mysql_query("DELETE FROM forum_question WHERE place='$crewnamedrop'");
mysql_query("DELETE FROM crew_donations WHERE place='$crewnamedrop'");

echo "You have droped <b>$crewnamedrop</b>!";

}

if ($_POST['acceptbg']){

mysql_query("UPDATE BG SET status='Accepted' WHERE bg='$username' AND status='Pending'");

echo "You are now a bodyguard";

}

if ($_POST['acceptbg2']){

mysql_query("UPDATE BG SET status='Accepted' WHERE bg='$username' AND status='Pending'");

echo "You are now a bodyguard!";

}

if ($_POST['upgrade'] && $famlevel >=7 && $fetch->slot <500){

if ($fetch->slot ==75){$next=125; $upgradecost=10000000000;}
elseif ($fetch->slot ==125){$next=200; $upgradecost=150000000000;}
elseif ($fetch->slot ==200){$next=300; $upgradecost=20000000000;}
elseif ($fetch->slot ==300){$next=500; $upgradecost=30000000000;}	


$newcash = $cash - $upgradecost;

if ($newcash <0){
echo "You do not have enough cash to upgrade!";
}else{

mysql_query("UPDATE family SET slot='$next' WHERE name='$name' AND owner='$username'");
mysql_query("UPDATE users SET cash=cash-'$upgradecost' WHERE username='$username' AND family='$famname'");

echo "Your Family size is now <b>$next</b>!";

}}

?>


<table border="1" class="sub2" align="center" cellspacing="0" cellpadding="1" bordercolor=black width=81%>
<tr>
<td align="center" colspan="5" class="header">Crews</td>
</tr>
<?
include "includes/db_connect.php"; 

$sql="SELECT * FROM family ORDER by id ASC";
$result=mysql_query($sql);


while($rows=mysql_fetch_array($result)){ // Start looping table row 

$name=$rows['owner'];
$famname=$rows['id'];
$famname2=$rows['name'];


$sql2="SELECT * from users WHERE family='$famname2'";
$result2=mysql_query($sql2);

$num=mysql_num_rows($result2);
?>
<tr>
<td width="70%"><a href="viewcrewprofile.php?viewcrew=<? echo $famname ?>"><? echo $rows['name']; ?></a></td><td width="20%"><a href="viewprofile.php?viewuser=<? echo $name ?>"><? echo $rows['owner']; ?></a></td><td width="10%"><? echo "$num"; ?></td>
</tr>
<?
}
?>
    <tr>
      <td colspan="5" align="right"><?
  
  $num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE id >1"));

  
   echo "$num_true"; ?>/5 Families</td>
    </tr>
</table>

<br>
<br>
<td>

<?
$sql2="SELECT * from famreq WHERE famid='$famid' AND status='Pending'";
$result2=mysql_query($sql2);

$num_true=mysql_num_rows($result2);
?>
<? echo "$num_true"; ?>
</td><td align="center"><input type="submit" name="acceptreq" value="Accept"></td>
    <tr>
      <td class="header" colspan="2" align="center">Create Crew </td>
    </tr>
	<tr>
<td>
      <p><font color="blue"><b>Making a family will Cost $500,000,000,000.
You must be ranked Underboss + to make a Family.</b></font></p></td>
</tr>
<tr>
<td width="92%" bgcolor="#3c3025" border="0">
<center>
Crew Name:<br>
<input type="text" style="border:1px solid black;" name="familyname">
<br><br>
<input type="submit" value="Create Family" name="createfamily"></center>	  </td>
    </tr>
<?
$num_true=mysql_num_rows(mysql_query("SELECT * FROM famreq WHERE username='$username'"));
if ($num_true == 1){
?>

    <tr>
      <td class="header" colspan="2" align="center">Pending Application</td>
    </tr>
<?
include "includes/db_connect.php"; 

$sql="SELECT * FROM famreq WHERE username='$username'";
$result=mysql_query($sql);


while($rows=mysql_fetch_array($result)){ // Start looping table row 
?>
    <tr>
      <td colspan="2" align="center">
  You have requested <b><? echo $username; ?></b><br><br>
  <input type="submit" value="Cancel Application" name="cancelapply"></td>
    </tr>
<?
}}	
?>	
</table></form>
<?
}
?>
<br>

<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
<?
$num_true=mysql_num_rows(mysql_query("SELECT * FROM BG WHERE bg='$username' AND status='Pending' AND crew=''"));
if ($num_true >= 1){
?>
    <tr>
    </tr>
<?

$sql="SELECT * FROM BG WHERE bg='$username' AND crew=''";
$result=mysql_query($sql);


while($rows=mysql_fetch_array($result)){ // Start looping table row 
?>
    <tr>
    </tr>
<?
}}	
?>	
</table>
<br>


<?
if ($famlevel >= 0) 
{
?>
<form method="post" action="">
<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
<?
$num_true=mysql_num_rows(mysql_query("SELECT * FROM BG WHERE bg='$username' AND status='Pending'"));
if ($num_true >= 1){
?>
    <tr>
      <td class="header" colspan="2" align="center">Bodyguard Invitation</td>
    </tr>
<?

$sql="SELECT * FROM BG WHERE bg='$username'";
$result=mysql_query($sql);


while($rows=mysql_fetch_array($result)){ // Start looping table row 
?>
    <tr>
      <td colspan="2" align="center">
  You have been invited to be a bodyguard!<br>
  <input type="submit" value="Accept" name="acceptbg"></td>
    </tr>
<?
}}	
?>	
</table>
<br>



<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
    <tr>
      <td class="header" colspan="2" align="center">Leave Crew</td>
    </tr>
    <tr>
      <td colspan="2" align="center"><font color="red"><b>Note: Leaving crew can result in you losing up to 85% health</b></font>
  <br>
  <br>
  <input type="submit" value="Leave Crew" name="leave">	  </td>
    </tr>
<? if ($crewlevel >=7 && $fetch->slot <200){ ?>
    <tr>
      <td class="header" colspan="2" align="center">Upgrade Crew Size</td>
    </tr>
<tr>
<td align="center">
<?

if ($fetch->slot ==50){$next=75; $upgradecost=100000000;}
if ($fetch->slot ==75){$next=125; $upgradecost=1250000000;}
elseif ($fetch->slot ==125){$next=200; $upgradecost=1500000000;}
elseif ($fetch->slot ==200){$next=300; $upgradecost=3000000000;}
elseif ($fetch->slot ==300){$next=500; $upgradecost=5000000000;}	

?>
Your Families current size is <b><? echo $fetch->slot ; ?></b>, it will cost $<? echo number_format($upgradecost); ?> to upgrade it to <? echo $next ;?>.<br>
<input type="submit" name="upgrade" value="Upgrade">
</td>
</tr>
<? } ?>
</table>
		<?
}
?>
</form>
<?
if ($userlevel >= 5) 
{
?>
<form method="post" action="">
<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
    <tr>
      <td class="header" colspan="2" align="center">Change Family Name</td>
    </tr>
    <tr>
      <td width="90%" align="center">Family ID:<br><input style="border:1px solid black;" type="text" name="famid"><br></td>
    </tr>
    <tr>
      <td align="center">New family Name:<br><input type="text" style="border:1px solid black;" name="newfamname"><br><br>
  <input type="submit" value="Change" name="change">	  </td>
    </tr>
</table>
</form>
<br><br>
<? }
?>	

<?
if ($userlevel >= 15) 
{
?>

<form method="post" action="">
<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
    <tr>
      <td class="header" colspan="2" align="center">Drop Family</td>
    </tr>
    <tr>
      <td width="90%" align="center"><br>
  <center><select name="famnamedrop">
<?
include "includes/db_connect.php"; 

$sql="SELECT * FROM family ORDER by id";
$result=mysql_query($sql);


while($rows=mysql_fetch_array($result)){ // Start looping table row 
?>
<option><? echo $rows['name']; ?></option>
<?
}
?>
</select>
<br><br>
<input type="submit" value="Drop Family" name="dropfamily"></center>
  
  </td>
    </tr>
</table>
</form>

<? } ?>	
<br><br>


</td>



  	  <TD width="150" valign="top">
<?php include("rightmenu.php");?>
</TD>

</TR>


</table>
<?  }  ?>
</center>
</body>
</html>

 

Sorry, I'm still kinda new, so it's a little sloppy.

Link to comment
https://forums.phpfreaks.com/topic/178925-phase-error-i-cant-seem-to-find/
Share on other sites

  • Replies 51
  • Created
  • Last Reply

Top Posters In This Topic

If you indent your code properly these errors become alot easier to find.

 

By the way, they are parse errors. PHP cannot parse your code.

 

gotcha! :)

 

Well, went through my script again, and here is what I got:

 

Parse error: syntax error, unexpected '<' in /home/klrbal/public_html/Mafia-test/tempfam.php on line 332

 

here is the coding, it has something to do with my <tr> and I don't know why it's not working.:

 

<?php
session_start();  

if (!(isset($_SESSION["real_name"])))
{
//echo "I'm not logged in";
header('Location: index.php');
}
else
{
echo "";
}


?>



<html>
<head>
<title>Mafia Syndicate BETA .::. Families</title></head>
    	<link REL="stylesheet" TYPE="text/css" HREF="main.css">

<script language=javascript src=Menus.js></script>

<body background="wallpaper.jpg">
<center> 
<table border="0" cellspacing="0" cellpadding="0" align="center" width="95%" class="cat">

<TR> 

<TD width="150" background="tdbg3.jpg" bgcolor="#222222" valign="top">
<?php include("leftmenu.php");?>
</TD>
  
    <td width="100%" valign="top">	<br>	


<?php

	$fetch=mysql_fetch_object(mysql_query("SELECT * FROM crews WHERE name='$crew' LIMIT 1"));

////CREATE CREW/////
if ($_POST['createfamily'] && $_POST['familyname']){

$familyname == $_POST['familyname']; 

if ($rankpoints <= 140109){ 

echo "You must be Underboss before you can make a crew!";

}else{


if ($crewlevel==0){

$finalcash = $cash - 500000000000 ;

if ($finalcash <0){

echo "You do not have enough cash!";

}}elseif ($finalcash >=0){

$num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE id >1"));
if ($num_true >= 5){
echo "There are already 5 Crew Slots!"; 
}else{

$num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE name='$familyname'"));
if ($num_true >= 1){

echo "There is already a Family with that name!";
}else{

function change($msg){
$post = $msg;
$post = str_replace("'", "`", $post); 
return $post;
}

$new=change($crewname);

mysql_query("INSERT INTO `family` ( `id` , `owner` , `name` , `bank` , `quote` , `news` , `slot` ) VALUES ('', '$username', '$new', '0', 'No Quote!', 'You have no family news8)', '50')");
mysql_query("UPDATE users SET famlevel='9' WHERE username='$username'");
mysql_query("UPDATE users SET cash='$finalcash', family='$new'  WHERE username='$username'");
mysql_query("INSERT INTO `logs` ( `id` , `who` , `action` , `date` , `ip` ) VALUES ('', '$username', 'Bought a Family called <b>$new</b>!', '$date', '$realip')");

echo "You have created the Family <b>$new!</b>";


}
}
}


if ($_POST['cancelapply']){

mysql_query("DELETE FROM famreq WHERE username='$username'");

echo "You have cancelled your application!";

}


/////END OF CREATE CREW!!!/////
mysql_query("SELECT * from users WHERE famlevel='$famlevel'");

if ($famlevel >= 2);

if ($_POST['inviteuser'] && strip_tags($_POST['inviteusername'])){

$sql2="SELECT * from famreq WHERE username='$username'";
$result2=mysql_query($sql2);

$num_true=mysql_num_rows($result2);
if ($num_true >= 1){
echo "You have already pending Family request!"; 
}elseif ($num_true <=1){

$crewnamejoin = $_POST['inviteusername'];
$crewnamejoin = strip_tags($inviteusername);

$sql="SELECT * FROM users WHERE username='$username'";
$result=mysql_query($sql);

if ($_POST['acceptinvite']){

$sql="SELECT * from famreq WHERE family='$famid'";
$result=mysql_query($sql);


mysql_query("INSERT INTO `famreq` ( `id` , `famid` , `username` , `status` , `f` ) VALUES (
'', '$invitedusername', '$username', '$status', '$f' )");


echo "You have requested $invitedusername to join your family!";

}
}
}

if ($_POST['leave'] && $famlevel >=2 && $famlevel <7)


if ($famlevel <= 0) 
{
echo "You are not in a Family!";
}else


if ($famlevel >= 4)
{
echo "You can not leave your family!"; }

if ($_POST['change'] && strip_tags($_POST['newfamname']) && strip_tags($_POST['famid']) && $userlevel >=10){

$newcrewname = $_POST['newfamname'];
$newcrewname = strip_tags($newfamname);
$crewid = $_POST['famid'];
$crewid = strip_tags($famid);

$sql="SELECT * from family WHERE id='$famid'";
$result=mysql_query($sql);

while($rows=mysql_fetch_array($result)){ // Start looping table row 

$oname = $rows['name'];
}
}

$num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE name='$newfamname'"));
if ($num_true >= 1){

echo "There is already a family with that name!";
}else{


function change($msg)
{
$post = $msg;
$post = str_replace("'", "`", $post); 
return $post;
}
}
{
$newfamname=change($newfamame);

mysql_query("UPDATE users SET famname='$newfamname' WHERE famname='$oname'");
mysql_query("UPDATE famreq SET famid='$newfamname' WHERE famid='$oname'");
mysql_query("UPDATE forum_answer SET place='$newfamname' WHERE place='$oname'");
mysql_query("UPDATE forum_question SET place='$newfamname' WHERE place='$oname'");
mysql_query("UPDATE family_donations SET fam='$newfamname' WHERE famname='$oname'");
mysql_query("UPDATE family SET famname='$newfamname' WHERE id='$crewid'");
mysql_query("UPDATE BG SET crew='$newfamname' WHERE crew='$oname'");

{
echo "You changed the family $oname to $newfamname!";
}
}

if ($_POST['dropfam'] && strip_tags($_POST['famnamedrop']) && $userlevel >=15){

$crewnamedrop = $_POST['famnamedrop'];
$crewnamedrop = strip_tags($famnamedrop);

mysql_query("DELETE FROM crews WHERE name='$crewnamedrop'");
mysql_query("UPDATE users SET crewlevel='0', crew='None' WHERE crew='$crewnamedrop'");
mysql_query("DELETE FROM crewapply WHERE crew='$crewnamedrop'");
mysql_query("DELETE FROM forum_answer WHERE place='$crewnamedrop'");
mysql_query("DELETE FROM forum_question WHERE place='$crewnamedrop'");
mysql_query("DELETE FROM crew_donations WHERE place='$crewnamedrop'");

echo "You have droped <b>$crewnamedrop</b>!";

}

if ($_POST['acceptbg']){

mysql_query("UPDATE BG SET status='Accepted' WHERE bg='$username' AND status='Pending'");

echo "You are now a bodyguard";

}

if ($_POST['acceptbg2']){

mysql_query("UPDATE BG SET status='Accepted' WHERE bg='$username' AND status='Pending'");

echo "You are now a bodyguard!";

}

if ($_POST['upgrade'] && $famlevel >=7 && $fetch->slot <500){

if ($fetch->slot ==75){$next=125; $upgradecost=10000000000;}
elseif ($fetch->slot ==125){$next=200; $upgradecost=150000000000;}
elseif ($fetch->slot ==200){$next=300; $upgradecost=20000000000;}
elseif ($fetch->slot ==300){$next=500; $upgradecost=30000000000;}	


$newcash = $cash - $upgradecost;

if ($newcash <0){
echo "You do not have enough cash to upgrade!";
}else{

mysql_query("UPDATE family SET slot='$next' WHERE name='$name' AND owner='$username'");
mysql_query("UPDATE users SET cash=cash-'$upgradecost' WHERE username='$username' AND family='$famname'");

echo "Your Family size is now <b>$next</b>!";

}}

?>


<table border="1" class="sub2" align="center" cellspacing="0" cellpadding="1" bordercolor=black width=81%>
<tr>
<td align="center" colspan="5" class="header">Crews</td>
</tr>
<?php
include "includes/db_connect.php"; 

$sql="SELECT * FROM family ORDER by id ASC";
$result=mysql_query($sql);


while($rows=mysql_fetch_array($result)){ // Start looping table row 

$name=$rows['owner'];
$famname=$rows['id'];
$famname2=$rows['name'];


$sql2="SELECT * from users WHERE family='$famname2'";
$result2=mysql_query($sql2);

$num=mysql_num_rows($result2);
}
?>
<tr>
<td width="70%"><a href="viewcrewprofile.php?viewcrew=<? echo $famname ?>"><? echo $rows['name']; ?></a></td><td width="20%"><a href="viewprofile.php?viewuser=<? echo $name ?>"><? echo $rows['owner']; ?></a></td><td width="10%"><? echo "$num"; ?></td>
</tr>

    <tr>
      <td colspan="5" align="right"><?php
  
  $num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE id >1"));

  {
   echo "$num_true";}
   ?> /5 Families</td> 

    </tr>
</table>

<br>
<br>
<td>

<?php
$sql2="SELECT * from famreq WHERE famid='$famid' AND status='Pending'";
$result2=mysql_query($sql2);

$num_true=mysql_num_rows($result2);{
  echo "$num_true"; 
}
?>
</td><td align="center"><input type="submit" name="acceptreq" value="Accept"></td>
    <tr>
      <td class="header" colspan="2" align="center">Create Crew </td>
    </tr>
	<tr>
<td>
      <p><font color="blue"><b>Making a family will Cost $500,000,000,000.
You must be ranked Underboss + to make a Family.</b></font></p></td>
</tr>
<tr>
<td width="92%" bgcolor="#3c3025" border="0">
<center>
Crew Name:<br>
<input type="text" style="border:1px solid black;" name="familyname">
<br><br>
<input type="submit" value="Create Family" name="createfamily"></center>	  </td>
    </tr>
<?php
$num_true=mysql_num_rows(mysql_query("SELECT * FROM famreq WHERE username='$username'"));
if ($num_true == 1)


    <tr>
      <td class="header" colspan="2" align="center">Pending Application </td>
    </tr>

include "includes/db_connect.php"; 

$sql="SELECT * FROM famreq WHERE username='$username'";
$result=mysql_query($sql);


while($rows=mysql_fetch_array($result)){ // Start looping table row 
    <tr>
      <td colspan="2" align="center">
  You have requested <b><? echo $username; 
}	  
  ?></b><br><br>
  <input type="submit" value="Cancel Application" name="cancelapply"></td>
    </tr>


</table>
</form>
<br>

<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2"></table>
<?php
$num_true=mysql_num_rows(mysql_query("SELECT * FROM BG WHERE bg='$username' AND status='Pending' AND crew=''"));
if ($num_true >= 1)


$sql="SELECT * FROM BG WHERE bg='$username' AND crew=''";
$result=mysql_query($sql);


while($rows=mysql_fetch_array($result)){ // Start looping table row 

}
?>	
</table>
<br>


<?php
if ($famlevel >= 0) {


<form method="post" action="">
<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">

$num_true=mysql_num_rows(mysql_query("SELECT * FROM BG WHERE bg='$username' AND status='Pending'"));
if ($num_true >= 1){

    <tr>
      <td class="header" colspan="2" align="center">Bodyguard Invitation</td>
    </tr>
}
}

$sql="SELECT * FROM BG WHERE bg='$username'";
$result=mysql_query($sql);


while($rows=mysql_fetch_array($result)){ // Start looping table row 

    <tr>
      <td colspan="2" align="center">"You have been invited to be a bodyguard!"<br>
  <input type="submit" value="Accept" name="acceptbg"></td>
    </tr>

}	
?>	
</table>
<br>



<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
    <tr>
      <td class="header" colspan="2" align="center">Leave Crew</td>
    </tr>
    <tr>
      <td colspan="2" align="center"><font color="red"><b>Note: Leaving crew can result in you losing up to 85% health</b></font>
  <br>
  <br>
  <input type="submit" value="Leave Crew" name="leave">	  </td>
    </tr>
<? if ($crewlevel >=7 && $fetch->slot <200){ ?>
    <tr>
      <td class="header" colspan="2" align="center">Upgrade Crew Size</td>
    </tr>
<tr>
<td align="center">
<?php

if ($fetch->slot ==50){$next=75; $upgradecost=100000000;}
if ($fetch->slot ==75){$next=125; $upgradecost=1250000000;}
elseif ($fetch->slot ==125){$next=200; $upgradecost=1500000000;}
elseif ($fetch->slot ==200){$next=300; $upgradecost=3000000000;}
elseif ($fetch->slot ==300){$next=500; $upgradecost=5000000000;}	

?>
Your Families current size is <b>
<?php echo $fetch->slot ; ?></b>, it will cost $
<?php echo number_format('$upgradecost'); ?> to upgrade it to 
<?php echo $next ;?>.<br>
<input type="submit" name="upgrade" value="Upgrade">
</td>
</tr>

</table>

</form>
<?php
if ($userlevel >= 5) 

?>
<form method="post" action="">
<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
    <tr>
      <td class="header" colspan="2" align="center">Change Family Name</td>
    </tr>
    <tr>
      <td width="90%" align="center">Family ID:<br><input style="border:1px solid black;" type="text" name="famid"><br></td>
    </tr>
    <tr>
      <td align="center">New family Name:<br><input type="text" style="border:1px solid black;" name="newfamname"><br><br>
  <input type="submit" value="Change" name="change">	  </td>
    </tr>
</table>
</form>
<br><br>

<?php
if ($userlevel >= 15) 

?>

<form method="post" action="">
<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
    <tr>
      <td class="header" colspan="2" align="center">Drop Family</td>
    </tr>
    <tr>
      <td width="90%" align="center"><br>
  <center><select name="famnamedrop">
<?php
include "includes/db_connect.php"; 

$sql="SELECT * FROM family ORDER by id";
$result=mysql_query($sql);


while($rows=mysql_fetch_array($result)) // Start looping table row 


?>
<option><?php	 echo $rows['name']; ?>
</option>

</select>
<br><br>
<input type="submit" value="Drop Family" name="dropfamily"></center>
  
  </td>
    </tr>
</table>
</form>


<br><br>


</td>



  	  <TD width="150" valign="top">
<?php include("rightmenu.php");?>
</TD>

</TR>


</table>

</center>
</body>
</html>

Hi

 

Try this:-

 

$num_true=mysql_num_rows(mysql_query("SELECT * FROM famreq WHERE username='$username'"));

if ($num_true == 1)

{

    echo '<tr>

      <td class="header" colspan="2" align="center">Pending Application </td>

    </tr>';

}

 

All the best

 

Keith

That worked!  I appreciate that!  Now I have this, (of course I don't think I'm allowed to do this, but I tried lol)

 

Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /home/klrbal/public_html/Mafia-test/tempfam.php on line 347

 

<?php
session_start();  

if (!(isset($_SESSION["real_name"])))
{
//echo "I'm not logged in";
header('Location: index.php');
}
else
{
echo "";
}


?>



<html>
<head>
<title>Mafia Syndicate BETA .::. Families</title></head>
    	<link REL="stylesheet" TYPE="text/css" HREF="main.css">

<script language=javascript src=Menus.js></script>

<body background="wallpaper.jpg">
<center> 
<table border="0" cellspacing="0" cellpadding="0" align="center" width="95%" class="cat">

<TR> 

<TD width="150" background="tdbg3.jpg" bgcolor="#222222" valign="top">
<?php include("leftmenu.php");?>
</TD>
  
    <td width="100%" valign="top">	<br>	


<?php

	$fetch=mysql_fetch_object(mysql_query("SELECT * FROM crews WHERE name='$crew' LIMIT 1"));

////CREATE CREW/////
if ($_POST['createfamily'] && $_POST['familyname']){

$familyname == $_POST['familyname']; 

if ($rankpoints <= 140109){ 

echo "You must be Underboss before you can make a crew!";

}else{


if ($crewlevel==0){

$finalcash = $cash - 500000000000 ;

if ($finalcash <0){

echo "You do not have enough cash!";

}}elseif ($finalcash >=0){

$num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE id >1"));
if ($num_true >= 5){
echo "There are already 5 Crew Slots!"; 
}else{

$num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE name='$familyname'"));
if ($num_true >= 1){

echo "There is already a Family with that name!";
}else{

function change($msg){
$post = $msg;
$post = str_replace("'", "`", $post); 
return $post;
}

$new=change($crewname);

mysql_query("INSERT INTO `family` ( `id` , `owner` , `name` , `bank` , `quote` , `news` , `slot` ) VALUES ('', '$username', '$new', '0', 'No Quote!', 'You have no family news8)', '50')");
mysql_query("UPDATE users SET famlevel='9' WHERE username='$username'");
mysql_query("UPDATE users SET cash='$finalcash', family='$new'  WHERE username='$username'");
mysql_query("INSERT INTO `logs` ( `id` , `who` , `action` , `date` , `ip` ) VALUES ('', '$username', 'Bought a Family called <b>$new</b>!', '$date', '$realip')");

echo "You have created the Family <b>$new!</b>";


}
}
}


if ($_POST['cancelapply']){

mysql_query("DELETE FROM famreq WHERE username='$username'");

echo "You have cancelled your application!";

}


/////END OF CREATE CREW!!!/////
mysql_query("SELECT * from users WHERE famlevel='$famlevel'");

if ($famlevel >= 2);

if ($_POST['inviteuser'] && strip_tags($_POST['inviteusername'])){

$sql2="SELECT * from famreq WHERE username='$username'";
$result2=mysql_query($sql2);

$num_true=mysql_num_rows($result2);
if ($num_true >= 1){
echo "You have already pending Family request!"; 
}elseif ($num_true <=1){

$crewnamejoin = $_POST['inviteusername'];
$crewnamejoin = strip_tags($inviteusername);

$sql="SELECT * FROM users WHERE username='$username'";
$result=mysql_query($sql);

if ($_POST['acceptinvite']){

$sql="SELECT * from famreq WHERE family='$famid'";
$result=mysql_query($sql);


mysql_query("INSERT INTO `famreq` ( `id` , `famid` , `username` , `status` , `f` ) VALUES (
'', '$invitedusername', '$username', '$status', '$f' )");


echo "You have requested $invitedusername to join your family!";

}
}
}

if ($_POST['leave'] && $famlevel >=2 && $famlevel <7)


if ($famlevel <= 0) 
{
echo "You are not in a Family!";
}else


if ($famlevel >= 4)
{
echo "You can not leave your family!"; }

if ($_POST['change'] && strip_tags($_POST['newfamname']) && strip_tags($_POST['famid']) && $userlevel >=10){

$newcrewname = $_POST['newfamname'];
$newcrewname = strip_tags($newfamname);
$crewid = $_POST['famid'];
$crewid = strip_tags($famid);

$sql="SELECT * from family WHERE id='$famid'";
$result=mysql_query($sql);

while($rows=mysql_fetch_array($result)){ // Start looping table row 

$oname = $rows['name'];
}
}

$num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE name='$newfamname'"));
if ($num_true >= 1){

echo "There is already a family with that name!";
}else{


function change($msg)
{
$post = $msg;
$post = str_replace("'", "`", $post); 
return $post;
}
}
{
$newfamname=change($newfamame);

mysql_query("UPDATE users SET famname='$newfamname' WHERE famname='$oname'");
mysql_query("UPDATE famreq SET famid='$newfamname' WHERE famid='$oname'");
mysql_query("UPDATE forum_answer SET place='$newfamname' WHERE place='$oname'");
mysql_query("UPDATE forum_question SET place='$newfamname' WHERE place='$oname'");
mysql_query("UPDATE family_donations SET fam='$newfamname' WHERE famname='$oname'");
mysql_query("UPDATE family SET famname='$newfamname' WHERE id='$crewid'");
mysql_query("UPDATE BG SET crew='$newfamname' WHERE crew='$oname'");

{
echo "You changed the family $oname to $newfamname!";
}
}

if ($_POST['dropfam'] && strip_tags($_POST['famnamedrop']) && $userlevel >=15){

$crewnamedrop = $_POST['famnamedrop'];
$crewnamedrop = strip_tags($famnamedrop);

mysql_query("DELETE FROM crews WHERE name='$crewnamedrop'");
mysql_query("UPDATE users SET crewlevel='0', crew='None' WHERE crew='$crewnamedrop'");
mysql_query("DELETE FROM crewapply WHERE crew='$crewnamedrop'");
mysql_query("DELETE FROM forum_answer WHERE place='$crewnamedrop'");
mysql_query("DELETE FROM forum_question WHERE place='$crewnamedrop'");
mysql_query("DELETE FROM crew_donations WHERE place='$crewnamedrop'");

echo "You have droped <b>$crewnamedrop</b>!";

}

if ($_POST['acceptbg']){

mysql_query("UPDATE BG SET status='Accepted' WHERE bg='$username' AND status='Pending'");

echo "You are now a bodyguard";

}

if ($_POST['acceptbg2']){

mysql_query("UPDATE BG SET status='Accepted' WHERE bg='$username' AND status='Pending'");

echo "You are now a bodyguard!";

}

if ($_POST['upgrade'] && $famlevel >=7 && $fetch->slot <500){

if ($fetch->slot ==75){$next=125; $upgradecost=10000000000;}
elseif ($fetch->slot ==125){$next=200; $upgradecost=150000000000;}
elseif ($fetch->slot ==200){$next=300; $upgradecost=20000000000;}
elseif ($fetch->slot ==300){$next=500; $upgradecost=30000000000;}	


$newcash = $cash - $upgradecost;

if ($newcash <0){
echo "You do not have enough cash to upgrade!";
}else{

mysql_query("UPDATE family SET slot='$next' WHERE name='$name' AND owner='$username'");
mysql_query("UPDATE users SET cash=cash-'$upgradecost' WHERE username='$username' AND family='$famname'");

echo "Your Family size is now <b>$next</b>!";

}}

?>


<table border="1" class="sub2" align="center" cellspacing="0" cellpadding="1" bordercolor=black width=81%>
<tr>
<td align="center" colspan="5" class="header">Crews</td>
</tr>
<?php
include "includes/db_connect.php"; 

$sql="SELECT * FROM family ORDER by id ASC";
$result=mysql_query($sql);


while($rows=mysql_fetch_array($result)){ // Start looping table row 

$name=$rows['owner'];
$famname=$rows['id'];
$famname2=$rows['name'];


$sql2="SELECT * from users WHERE family='$famname2'";
$result2=mysql_query($sql2);

$num=mysql_num_rows($result2);
}
?>
<tr>
<td width="70%"><a href="viewcrewprofile.php?viewcrew=<? echo $famname ?>"><? echo $rows['name']; ?></a></td><td width="20%"><a href="viewprofile.php?viewuser=<? echo $name ?>"><? echo $rows['owner']; ?></a></td><td width="10%"><? echo "$num"; ?></td>
</tr>

    <tr>
      <td colspan="5" align="right"><?php
  
  $num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE id >1"));

  {
   echo "$num_true";}
   ?> /5 Families</td> 

    </tr>
</table>

<br>
<br>
<td>

<?php
$sql2="SELECT * from famreq WHERE famid='$famid' AND status='Pending'";
$result2=mysql_query($sql2);

$num_true=mysql_num_rows($result2);{
  echo "$num_true"; 
}
?>
</td><td align="center"><input type="submit" name="acceptreq" value="Accept"></td>
    <tr>
      <td class="header" colspan="2" align="center">Create Crew </td>
    </tr>
	<tr>
<td>
      <p><font color="blue"><b>Making a family will Cost $500,000,000,000.
You must be ranked Underboss + to make a Family.</b></font></p></td>
</tr>
<tr>
<td width="92%" bgcolor="#3c3025" border="0">
<center>
Crew Name:<br>
<input type="text" style="border:1px solid black;" name="familyname">
<br><br>
<input type="submit" value="Create Family" name="createfamily"></center>	  </td>
    </tr>
<?php
$num_true=mysql_num_rows(mysql_query("SELECT * FROM famreq WHERE username='$username'"));
if ($num_true == 1)


{
echo'<tr>
      <td class="header" colspan="2" align="center">Pending Application </td>
    </tr>';
    }

include "includes/db_connect.php"; 

$sql="SELECT * FROM famreq WHERE username='$username'";
$result=mysql_query($sql);


while($rows=mysql_fetch_array($result)){ // Start looping table row 
    echo'<tr>
      <td colspan="2" align="center">
  You have requested <b>'$username'!></b><br><br>
  <input type="submit" value="Cancel Application" name="cancelapply"></td>
    </tr>';
    }


</table>
</form>
<br>

<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2"></table>
<?php
$num_true=mysql_num_rows(mysql_query("SELECT * FROM BG WHERE bg='$username' AND status='Pending' AND crew=''"));
if ($num_true >= 1)


$sql="SELECT * FROM BG WHERE bg='$username' AND crew=''";
$result=mysql_query($sql);


while($rows=mysql_fetch_array($result)){ // Start looping table row 

}
?>	
</table>
<br>


<?php
if ($famlevel >= 0) {


<form method="post" action="">
<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">

$num_true=mysql_num_rows(mysql_query("SELECT * FROM BG WHERE bg='$username' AND status='Pending'"));
if ($num_true >= 1){

    <tr>
      <td class="header" colspan="2" align="center">Bodyguard Invitation</td>
    </tr>
}
}

$sql="SELECT * FROM BG WHERE bg='$username'";
$result=mysql_query($sql);


while($rows=mysql_fetch_array($result)){ // Start looping table row 

    <tr>
      <td colspan="2" align="center">"You have been invited to be a bodyguard!"<br>
  <input type="submit" value="Accept" name="acceptbg"></td>
    </tr>

}	
?>	
</table>
<br>



<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
    <tr>
      <td class="header" colspan="2" align="center">Leave Crew</td>
    </tr>
    <tr>
      <td colspan="2" align="center"><font color="red"><b>Note: Leaving crew can result in you losing up to 85% health</b></font>
  <br>
  <br>
  <input type="submit" value="Leave Crew" name="leave">	  </td>
    </tr>
<? if ($crewlevel >=7 && $fetch->slot <200){ ?>
    <tr>
      <td class="header" colspan="2" align="center">Upgrade Crew Size</td>
    </tr>
<tr>
<td align="center">
<?php

if ($fetch->slot ==50){$next=75; $upgradecost=100000000;}
if ($fetch->slot ==75){$next=125; $upgradecost=1250000000;}
elseif ($fetch->slot ==125){$next=200; $upgradecost=1500000000;}
elseif ($fetch->slot ==200){$next=300; $upgradecost=3000000000;}
elseif ($fetch->slot ==300){$next=500; $upgradecost=5000000000;}	

?>
Your Families current size is <b>
<?php echo $fetch->slot ; ?></b>, it will cost $
<?php echo number_format('$upgradecost'); ?> to upgrade it to 
<?php echo $next ;?>.<br>
<input type="submit" name="upgrade" value="Upgrade">
</td>
</tr>

</table>

</form>
<?php
if ($userlevel >= 5) 

?>
<form method="post" action="">
<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
    <tr>
      <td class="header" colspan="2" align="center">Change Family Name</td>
    </tr>
    <tr>
      <td width="90%" align="center">Family ID:<br><input style="border:1px solid black;" type="text" name="famid"><br></td>
    </tr>
    <tr>
      <td align="center">New family Name:<br><input type="text" style="border:1px solid black;" name="newfamname"><br><br>
  <input type="submit" value="Change" name="change">	  </td>
    </tr>
</table>
</form>
<br><br>

<?php
if ($userlevel >= 15) 

?>

<form method="post" action="">
<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
    <tr>
      <td class="header" colspan="2" align="center">Drop Family</td>
    </tr>
    <tr>
      <td width="90%" align="center"><br>
  <center><select name="famnamedrop">
<?php
include "includes/db_connect.php"; 

$sql="SELECT * FROM family ORDER by id";
$result=mysql_query($sql);


while($rows=mysql_fetch_array($result)) // Start looping table row 


?>
<option><?php	 echo $rows['name']; ?>
</option>

</select>
<br><br>
<input type="submit" value="Drop Family" name="dropfamily"></center>
  
  </td>
    </tr>
</table>
</form>


<br><br>


</td>



  	  <TD width="150" valign="top">
<?php include("rightmenu.php");?>
</TD>

</TR>


</table>

</center>
</body>
</html>

 

Am I NOT allowed to do that?? :confused:

You are missing a ?>

 

while($rows=mysql_fetch_array($result))
{ // Start looping table row 
?>
    <tr>
      <td colspan="2" align="center">
  You have requested <b><?php echo $username; 
}	

 

 

Although I would use an echo for such a short bit of HTML rather than jumping out of php mode and back in:-

 

while($rows=mysql_fetch_array($result))
{ // Start looping table row 
    echo '<tr><td colspan="2" align="center">You have requested <b>'.$username; 
}	  

 

All the best

 

Keith

You are missing a ?>

 

while($rows=mysql_fetch_array($result))
{ // Start looping table row 
?>
    <tr>
      <td colspan="2" align="center">
  You have requested <b><?php echo $username; 
}	

 

 

Although I would use an echo for such a short bit of HTML rather than jumping out of php mode and back in:-

 

while($rows=mysql_fetch_array($result))
{ // Start looping table row 
    echo '<tr><td colspan="2" align="center">You have requested <b>'.$username; 
}	  

 

All the best

 

Keith

 

 

Ok, I got the echo to the left of my <tr> section, and got pretty much the same error, only 1 line up.

 

<?php
session_start();  

if (!(isset($_SESSION["real_name"])))
{
//echo "I'm not logged in";
header('Location: index.php');
}
else
{
echo "";
}


?>



<html>
<head>
<title>Mafia Syndicate BETA .::. Families</title></head>
    	<link REL="stylesheet" TYPE="text/css" HREF="main.css">

<script language=javascript src=Menus.js></script>

<body background="wallpaper.jpg">
<center> 
<table border="0" cellspacing="0" cellpadding="0" align="center" width="95%" class="cat">

<TR> 

<TD width="150" background="tdbg3.jpg" bgcolor="#222222" valign="top">
<?php include("leftmenu.php");?>
</TD>
  
    <td width="100%" valign="top">	<br>	


<?php

	$fetch=mysql_fetch_object(mysql_query("SELECT * FROM crews WHERE name='$crew' LIMIT 1"));

////CREATE CREW/////
if ($_POST['createfamily'] && $_POST['familyname']){

$familyname == $_POST['familyname']; 

if ($rankpoints <= 140109){ 

echo "You must be Underboss before you can make a crew!";

}else{


if ($crewlevel==0){

$finalcash = $cash - 500000000000 ;

if ($finalcash <0){

echo "You do not have enough cash!";

}}elseif ($finalcash >=0){

$num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE id >1"));
if ($num_true >= 5){
echo "There are already 5 Crew Slots!"; 
}else{

$num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE name='$familyname'"));
if ($num_true >= 1){

echo "There is already a Family with that name!";
}else{

function change($msg){
$post = $msg;
$post = str_replace("'", "`", $post); 
return $post;
}

$new=change($crewname);

mysql_query("INSERT INTO `family` ( `id` , `owner` , `name` , `bank` , `quote` , `news` , `slot` ) VALUES ('', '$username', '$new', '0', 'No Quote!', 'You have no family news8)', '50')");
mysql_query("UPDATE users SET famlevel='9' WHERE username='$username'");
mysql_query("UPDATE users SET cash='$finalcash', family='$new'  WHERE username='$username'");
mysql_query("INSERT INTO `logs` ( `id` , `who` , `action` , `date` , `ip` ) VALUES ('', '$username', 'Bought a Family called <b>$new</b>!', '$date', '$realip')");

echo "You have created the Family <b>$new!</b>";


}
}
}


if ($_POST['cancelapply']){

mysql_query("DELETE FROM famreq WHERE username='$username'");

echo "You have cancelled your application!";

}


/////END OF CREATE CREW!!!/////
mysql_query("SELECT * from users WHERE famlevel='$famlevel'");

if ($famlevel >= 2);

if ($_POST['inviteuser'] && strip_tags($_POST['inviteusername'])){

$sql2="SELECT * from famreq WHERE username='$username'";
$result2=mysql_query($sql2);

$num_true=mysql_num_rows($result2);
if ($num_true >= 1){
echo "You have already pending Family request!"; 
}elseif ($num_true <=1){

$crewnamejoin = $_POST['inviteusername'];
$crewnamejoin = strip_tags($inviteusername);

$sql="SELECT * FROM users WHERE username='$username'";
$result=mysql_query($sql);

if ($_POST['acceptinvite']){

$sql="SELECT * from famreq WHERE family='$famid'";
$result=mysql_query($sql);


mysql_query("INSERT INTO `famreq` ( `id` , `famid` , `username` , `status` , `f` ) VALUES (
'', '$invitedusername', '$username', '$status', '$f' )");


echo "You have requested $invitedusername to join your family!";

}
}
}

if ($_POST['leave'] && $famlevel >=2 && $famlevel <7)


if ($famlevel <= 0) 
{
echo "You are not in a Family!";
}else


if ($famlevel >= 4)
{
echo "You can not leave your family!"; }

if ($_POST['change'] && strip_tags($_POST['newfamname']) && strip_tags($_POST['famid']) && $userlevel >=10){

$newcrewname = $_POST['newfamname'];
$newcrewname = strip_tags($newfamname);
$crewid = $_POST['famid'];
$crewid = strip_tags($famid);

$sql="SELECT * from family WHERE id='$famid'";
$result=mysql_query($sql);

while($rows=mysql_fetch_array($result)){ // Start looping table row 

$oname = $rows['name'];
}
}

$num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE name='$newfamname'"));
if ($num_true >= 1){

echo "There is already a family with that name!";
}else{


function change($msg)
{
$post = $msg;
$post = str_replace("'", "`", $post); 
return $post;
}
}
{
$newfamname=change($newfamame);

mysql_query("UPDATE users SET famname='$newfamname' WHERE famname='$oname'");
mysql_query("UPDATE famreq SET famid='$newfamname' WHERE famid='$oname'");
mysql_query("UPDATE forum_answer SET place='$newfamname' WHERE place='$oname'");
mysql_query("UPDATE forum_question SET place='$newfamname' WHERE place='$oname'");
mysql_query("UPDATE family_donations SET fam='$newfamname' WHERE famname='$oname'");
mysql_query("UPDATE family SET famname='$newfamname' WHERE id='$crewid'");
mysql_query("UPDATE BG SET crew='$newfamname' WHERE crew='$oname'");

{
echo "You changed the family $oname to $newfamname!";
}
}

if ($_POST['dropfam'] && strip_tags($_POST['famnamedrop']) && $userlevel >=15){

$crewnamedrop = $_POST['famnamedrop'];
$crewnamedrop = strip_tags($famnamedrop);

mysql_query("DELETE FROM crews WHERE name='$crewnamedrop'");
mysql_query("UPDATE users SET crewlevel='0', crew='None' WHERE crew='$crewnamedrop'");
mysql_query("DELETE FROM crewapply WHERE crew='$crewnamedrop'");
mysql_query("DELETE FROM forum_answer WHERE place='$crewnamedrop'");
mysql_query("DELETE FROM forum_question WHERE place='$crewnamedrop'");
mysql_query("DELETE FROM crew_donations WHERE place='$crewnamedrop'");

echo "You have droped <b>$crewnamedrop</b>!";

}

if ($_POST['acceptbg']){

mysql_query("UPDATE BG SET status='Accepted' WHERE bg='$username' AND status='Pending'");

echo "You are now a bodyguard";

}

if ($_POST['acceptbg2']){

mysql_query("UPDATE BG SET status='Accepted' WHERE bg='$username' AND status='Pending'");

echo "You are now a bodyguard!";

}

if ($_POST['upgrade'] && $famlevel >=7 && $fetch->slot <500){

if ($fetch->slot ==75){$next=125; $upgradecost=10000000000;}
elseif ($fetch->slot ==125){$next=200; $upgradecost=150000000000;}
elseif ($fetch->slot ==200){$next=300; $upgradecost=20000000000;}
elseif ($fetch->slot ==300){$next=500; $upgradecost=30000000000;}	


$newcash = $cash - $upgradecost;

if ($newcash <0){
echo "You do not have enough cash to upgrade!";
}else{

mysql_query("UPDATE family SET slot='$next' WHERE name='$name' AND owner='$username'");
mysql_query("UPDATE users SET cash=cash-'$upgradecost' WHERE username='$username' AND family='$famname'");

echo "Your Family size is now <b>$next</b>!";

}}

?>


<table border="1" class="sub2" align="center" cellspacing="0" cellpadding="1" bordercolor=black width=81%>
<tr>
<td align="center" colspan="5" class="header">Crews</td>
</tr>
<?php
include "includes/db_connect.php"; 

$sql="SELECT * FROM family ORDER by id ASC";
$result=mysql_query($sql);


while($rows=mysql_fetch_array($result)){ // Start looping table row 

$name=$rows['owner'];
$famname=$rows['id'];
$famname2=$rows['name'];


$sql2="SELECT * from users WHERE family='$famname2'";
$result2=mysql_query($sql2);

$num=mysql_num_rows($result2);
}
?>
<tr>
<td width="70%"><a href="viewcrewprofile.php?viewcrew=<? echo $famname ?>"><? echo $rows['name']; ?></a></td><td width="20%"><a href="viewprofile.php?viewuser=<? echo $name ?>"><? echo $rows['owner']; ?></a></td><td width="10%"><? echo "$num"; ?></td>
</tr>

    <tr>
      <td colspan="5" align="right"><?php
  
  $num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE id >1"));

  {
   echo "$num_true";}
   ?> /5 Families</td> 

    </tr>
</table>

<br>
<br>
<td>

<?php
$sql2="SELECT * from famreq WHERE famid='$famid' AND status='Pending'";
$result2=mysql_query($sql2);

$num_true=mysql_num_rows($result2);{
  echo "$num_true"; 
}
?>
</td><td align="center"><input type="submit" name="acceptreq" value="Accept"></td>
    <tr>
      <td class="header" colspan="2" align="center">Create Crew </td>
    </tr>
	<tr>
<td>
      <p><font color="blue"><b>Making a family will Cost $500,000,000,000.
You must be ranked Underboss + to make a Family.</b></font></p></td>
</tr>
<tr>
<td width="92%" bgcolor="#3c3025" border="0">
<center>
Crew Name:<br>
<input type="text" style="border:1px solid black;" name="familyname">
<br><br>
<input type="submit" value="Create Family" name="createfamily"></center>	  </td>
    </tr>
<?php
$num_true=mysql_num_rows(mysql_query("SELECT * FROM famreq WHERE username='$username'"));
if ($num_true == 1)


{
echo'<tr>
      <td class="header" colspan="2" align="center">Pending Application </td>
    </tr>';
    }

include "includes/db_connect.php"; 

$sql="SELECT * FROM famreq WHERE username='$username'";
$result=mysql_query($sql);


while($rows=mysql_fetch_array($result)){ // Start looping table row 
    echo'<tr>
      <td colspan="2" align="center">You have requested <b>'$username'</b>!><br><br>
  <input type="submit" value="Cancel Application" name="cancelapply"></td>
    </tr>';
    }


</table>
</form>
<br>

<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2"></table>
<?php
$num_true=mysql_num_rows(mysql_query("SELECT * FROM BG WHERE bg='$username' AND status='Pending' AND crew=''"));
if ($num_true >= 1)


$sql="SELECT * FROM BG WHERE bg='$username' AND crew=''";
$result=mysql_query($sql);


while($rows=mysql_fetch_array($result)){ // Start looping table row 

}
?>	
</table>
<br>


<?php
if ($famlevel >= 0) {


<form method="post" action="">
<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">

$num_true=mysql_num_rows(mysql_query("SELECT * FROM BG WHERE bg='$username' AND status='Pending'"));
if ($num_true >= 1){

    <tr>
      <td class="header" colspan="2" align="center">Bodyguard Invitation</td>
    </tr>
}
}

$sql="SELECT * FROM BG WHERE bg='$username'";
$result=mysql_query($sql);


while($rows=mysql_fetch_array($result)){ // Start looping table row 

    <tr>
      <td colspan="2" align="center">"You have been invited to be a bodyguard!"<br>
  <input type="submit" value="Accept" name="acceptbg"></td>
    </tr>

}	
?>	
</table>
<br>



<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
    <tr>
      <td class="header" colspan="2" align="center">Leave Crew</td>
    </tr>
    <tr>
      <td colspan="2" align="center"><font color="red"><b>Note: Leaving crew can result in you losing up to 85% health</b></font>
  <br>
  <br>
  <input type="submit" value="Leave Crew" name="leave">	  </td>
    </tr>
<? if ($crewlevel >=7 && $fetch->slot <200){ ?>
    <tr>
      <td class="header" colspan="2" align="center">Upgrade Crew Size</td>
    </tr>
<tr>
<td align="center">
<?php

if ($fetch->slot ==50){$next=75; $upgradecost=100000000;}
if ($fetch->slot ==75){$next=125; $upgradecost=1250000000;}
elseif ($fetch->slot ==125){$next=200; $upgradecost=1500000000;}
elseif ($fetch->slot ==200){$next=300; $upgradecost=3000000000;}
elseif ($fetch->slot ==300){$next=500; $upgradecost=5000000000;}	

?>
Your Families current size is <b>
<?php echo $fetch->slot ; ?></b>, it will cost $
<?php echo number_format('$upgradecost'); ?> to upgrade it to 
<?php echo $next ;?>.<br>
<input type="submit" name="upgrade" value="Upgrade">
</td>
</tr>

</table>

</form>
<?php
if ($userlevel >= 5) 

?>
<form method="post" action="">
<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
    <tr>
      <td class="header" colspan="2" align="center">Change Family Name</td>
    </tr>
    <tr>
      <td width="90%" align="center">Family ID:<br><input style="border:1px solid black;" type="text" name="famid"><br></td>
    </tr>
    <tr>
      <td align="center">New family Name:<br><input type="text" style="border:1px solid black;" name="newfamname"><br><br>
  <input type="submit" value="Change" name="change">	  </td>
    </tr>
</table>
</form>
<br><br>

<?php
if ($userlevel >= 15) 

?>

<form method="post" action="">
<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
    <tr>
      <td class="header" colspan="2" align="center">Drop Family</td>
    </tr>
    <tr>
      <td width="90%" align="center"><br>
  <center><select name="famnamedrop">
<?php
include "includes/db_connect.php"; 

$sql="SELECT * FROM family ORDER by id";
$result=mysql_query($sql);


while($rows=mysql_fetch_array($result)) // Start looping table row 


?>
<option><?php	 echo $rows['name']; ?>
</option>

</select>
<br><br>
<input type="submit" value="Drop Family" name="dropfamily"></center>
  
  </td>
    </tr>
</table>
</form>


<br><br>


</td>



  	  <TD width="150" valign="top">
<?php include("rightmenu.php");?>
</TD>

</TR>


</table>

</center>
</body>
</html>

 

It looks right and my program says it's right, but the website says differently :lol:

Hi

 

You have the following code that is missing a few full stops

 

echo'<tr>

<td colspan="2" align="center">You have requested <b>'.$username.'</b>!><br><br>

<input type="submit" value="Cancel Application" name="cancelapply"></td>

</tr>';

 

All the best

 

Keith

Seriously, what thorpe said, properly formatting your code helps a TON in finding errors.  I mean, seriously, with all those nested if statements, why would you NOT format it?  Makes it a lot easier to go back later and update things, too.  Just realize that if you ever work for a company doing this sorta thing, they will make you adhere to their standards of coding and formatting, best to learn how now and have to change later than have to learn how later.  I find that indenting everything inside an if/for/foreach/while statement, up to and including the final }, with 2 spaces, it helps a lot, like this:

 

if(something) {
  //indented 2 spaces;
  if(something else) {
    //indented an additional 2 spaces;
    } else {
    //still indented;
    }
  } else {
  //outside of the other if statement, go back to just 2 spaces;
  } //and end the if with a 2-space-indented bracket

 

See how nicely organized that is?  Of course, that's just my way, everyone has their own, some people use tabs, I find it takes up too much horizontal space.

I took the liberty of cleaning up your php for you.  I didn't clean up the errors with the HTML, you'll have to do that, but there are a LOT of them.  Tags that are closed but never opened or opened and never closed, all sorts of things.  But anyway, here is your php:

 

<?php
session_start();

if(!(isset($_SESSION["real_name"]))) {
  //echo "I'm not logged in";
  header('Location: index.php');
  } else {
  echo "";
  }
?>
<html>
<head>
<title>Mafia Syndicate BETA .::. Families</title>
<link REL="stylesheet" TYPE="text/css" HREF="main.css">
<script language=javascript src=Menus.js></script>
</head>

<body background="wallpaper.jpg">
<center>
<table border="0" cellspacing="0" cellpadding="0" align="center" width="95%" class="cat">
<TR>
<TD width="150" background="tdbg3.jpg" bgcolor="#222222" valign="top"><?php include("leftmenu.php");?></TD>
<td width="100%" valign="top"><br>
<?php
$fetch=mysql_fetch_object(mysql_query("SELECT * FROM crews WHERE name='$crew' LIMIT 1"));

////CREATE CREW/////
if($_POST['createfamily'] && $_POST['familyname']) {
  $familyname == $_POST['familyname'];
  if($rankpoints <= 140109) {
    echo "You must be Underboss before you can make a crew!";
    } else {
    if($crewlevel==0) {
      $finalcash = $cash - 500000000000 ;
      if($finalcash <0) {
        echo "You do not have enough cash!";
        } elseif($finalcash >=0) {
        $num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE id >1"));
if($num_true >= 5) {
  echo "There are already 5 Crew Slots!";
  } else {
          $num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE name='$familyname'"));
  if($num_true >= 1) {
            echo "There is already a Family with that name!";
    } else {
            function change($msg) {
      $post = $msg;
      $post = str_replace("'", "`", $post);
      return $post;
      }
            $new=change($crewname);
            mysql_query("INSERT INTO `family` ( `id` , `owner` , `name` , `bank` , `quote` , `news` , `slot` ) VALUES ('', '$username', '$new', '0', 'No Quote!', 'You have no family news8)', '50')");
            mysql_query("UPDATE users SET famlevel='9' WHERE username='$username'");
            mysql_query("UPDATE users SET cash='$finalcash', family='$new'  WHERE username='$username'");
            mysql_query("INSERT INTO `logs` ( `id` , `who` , `action` , `date` , `ip` ) VALUES ('', '$username', 'Bought a Family called <b>$new</b>!', '$date', '$realip')");
            echo "You have created the Family <b>$new!</b>";
            }
          }
        }
      }
    }
  }

if($_POST['cancelapply']) {
  mysql_query("DELETE FROM famreq WHERE username='$username'");
  echo "You have cancelled your application!";
  }


/////END OF CREATE CREW!!!/////

if(famlevel->2);
  if($_POST['inviteuser'] && strip_tags($_POST['inviteusername'])) {
    $sql2="SELECT * from famreq WHERE username='$username'";
    $result2=mysql_query($sql2);
    $num_true=mysql_num_rows($result2);
    if($num_true >= 1) {
      echo "You have already pending Family request!";
      } elseif($num_true <=1) {
      $crewnamejoin = $_POST['inviteusername'];
      $crewnamejoin = strip_tags($inviteusername);
      $sql="SELECT * FROM users WHERE username='$username'";
      $result=mysql_query($sql);
      if($_POST['acceptinvite']) {
        $sql="SELECT * from famreq WHERE family='$famid'";
$result=mysql_query($sql);
        mysql_query("INSERT INTO `famreq` ( `id` , `famid` , `username` , `status` , `f` ) VALUES ('', '$invitedusername', '$username', '$status', '$f' )");
        echo "You have requested $invitedusername to join your family!";
        }
      }
    if($_POST['leave'] && $famlevel >=2 && $famlevel <7){
      if($famlevel <= 0) {
        echo "You are not in a Family!";
        } else {
        if($famlevel >= 4) {
          echo "You can not leave your family!";
          if($_POST['change'] && strip_tags($_POST['newfamname']) && strip_tags($_POST['famid']) && $userlevel >=10) {
            $newcrewname = $_POST['newfamname'];
            $newcrewname = strip_tags($newfamname);
            $crewid = $_POST['famid'];
            $crewid = strip_tags($famid);
            $sql="SELECT * from family WHERE id='$famid'";
            $result=mysql_query($sql);
            while($rows=mysql_fetch_array($result)) { // Start looping table row
              $oname = $rows['name'];
              }
            $num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE name='$newfamname'"));
            if($num_true >= 1) {
            echo "There is already a family with that name!";
            } else {
            function change($msg) {
              $post = $msg;
              $post = str_replace("'", "`", $post);
              return $post;
              }
            $newfamname=change($newfamame);
            mysql_query("UPDATE users SET famname='$newfamname' WHERE famname='$oname'");
            mysql_query("UPDATE famreq SET famid='$newfamname' WHERE famid='$oname'");
            mysql_query("UPDATE forum_answer SET place='$newfamname' WHERE place='$oname'");
            mysql_query("UPDATE forum_question SET place='$newfamname' WHERE place='$oname'");
            mysql_query("UPDATE family_donations SET fam='$newfamname' WHERE famname='$oname'");
            mysql_query("UPDATE family SET famname='$newfamname' WHERE id='$crewid'");
            mysql_query("UPDATE BG SET crew='$newfamname' WHERE crew='$oname'");
            echo "You changed the family $oname to $newfamname!";
            }
          }
        if($_POST['dropfam'] && strip_tags($_POST['famnamedrop']) && $userlevel >=15) {
          $crewnamedrop = $_POST['famnamedrop'];
          $crewnamedrop = strip_tags($famnamedrop);
          mysql_query("DELETE FROM crews WHERE name='$crewnamedrop'");
  mysql_query("UPDATE users SET crewlevel='0', crew='None' WHERE crew='$crewnamedrop'");
          mysql_query("DELETE FROM crewapply WHERE crew='$crewnamedrop'");
          mysql_query("DELETE FROM forum_answer WHERE place='$crewnamedrop'");
          mysql_query("DELETE FROM forum_question WHERE place='$crewnamedrop'");
          mysql_query("DELETE FROM crew_donations WHERE place='$crewnamedrop'");
          echo "You have droped <b>$crewnamedrop</b>!";
          }
        if($_POST['acceptbg']) {
          mysql_query("UPDATE BG SET status='Accepted' WHERE bg='$username' AND status='Pending'");
          echo "You are now a bodyguard";
          }
        if($_POST['acceptbg2']) {
          mysql_query("UPDATE BG SET status='Accepted' WHERE bg='$username' AND status='Pending'");
          echo "You are now a bodyguard!";
          }
        if($_POST['upgrade'] && $famlevel >=7 && $fetch->slot <500) {
          if($fetch->slot ==75) {
            $next=125; $upgradecost=10000000000;
            } elseif($fetch->slot ==125) {
            $next=200; $upgradecost=150000000000;
            } elseif($fetch->slot ==200) {
            $next=300; $upgradecost=20000000000;
            } elseif($fetch->slot ==300) {
            $next=500; $upgradecost=30000000000;
            }
          $newcash = $cash - $upgradecost;
          if($newcash <0) {
          echo "You do not have enough cash to upgrade!";
          } else {
          mysql_query("UPDATE family SET slot='$next' WHERE name='$name' AND owner='$username'");
          mysql_query("UPDATE users SET cash=cash-'$upgradecost' WHERE username='$username' AND family='$famname'");
          echo "Your Family size is now <b>$next</b>!";
          }
        }
?>
<table border="1" class="sub2" align="center" cellspacing="0" cellpadding="1" bordercolor=black width=81%>
<tr>
<td align="center" colspan="5" class="header">Crews</td>
</tr>
<?php
      include "includes/db_connect.php";
      $sql="SELECT * FROM family ORDER by id ASC";
      $result=mysql_query($sql);
      while($rows=mysql_fetch_array($result)) { // Start looping table row
        $name=$rows['owner'];
        $famname=$rows['id'];
        $famname2=$rows['name'];
        $sql2="SELECT * from users WHERE family='$famname2'";
        $result2=mysql_query($sql2);
        $num=mysql_num_rows($result2);
?>
<tr>
<td width="70%"><a href="viewcrewprofile.php?viewcrew=<?php echo $famname ?>"><?php echo $rows['name']; ?></a></td>
<td width="20%"><a href="viewprofile.php?viewuser=<?php echo $name ?>"><?php echo $rows['owner']; ?></a></td>
<td width="10%"><?php echo "$num"; ?></td>
</tr>
<?php
        }
?>
<tr>
<td colspan="5" align="right">
<?php
      $num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE id >1"));
      echo "$num_true";
?>
/5 Families
</td>
</tr>
</table>
<br><br>
<td>
<?php
      $sql2="SELECT * from famreq WHERE famid='$famid' AND status='Pending'";
      $result2=mysql_query($sql2);
      $num_true=mysql_num_rows($result2);
      echo "$num_true";
?>
</td>
  <td align="center"><input type="submit" name="acceptreq" value="Accept"></td>
<tr>
  <td class="header" colspan="2" align="center">Create Crew </td>
</tr>
<tr>
  <td><p><font color="blue"><b>Making a family will Cost $500,000,000,000.  You must be ranked Underboss + to make a Family.</b></font></p></td>
</tr>
<tr>
  <td width="92%" bgcolor="#3c3025" border="0"><center>Crew Name:<br><input type="text" style="border:1px solid black;" name="familyname"><br><br><input type="submit" value="Create Family" name="createfamily"></center></td>
</tr>
<?php
      $num_true=mysql_num_rows(mysql_query("SELECT * FROM famreq WHERE username='$username'"));
      if($num_true == 1) {
?>
<tr>
  <td class="header" colspan="2" align="center">Pending Application</td>
</tr>
<?php
        include "includes/db_connect.php";
        $sql="SELECT * FROM famreq WHERE username='$username'";
        $result=mysql_query($sql);
        while($rows=mysql_fetch_array($result)) { // Start looping table row
?>
<tr>
  <td colspan="2" align="center">You have requested <b><?php echo $username; ?></b><br><br><input type="submit" value="Cancel Application" name="cancelapply"></td>
</tr>
<?php
          }
        }
?>
</table></form>
<?php
      }
?>
<br>

<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
<?php
    $num_true=mysql_num_rows(mysql_query("SELECT * FROM BG WHERE bg='$username' AND status='Pending' AND crew=''"));
    if($num_true >= 1){
?>
<tr>
</tr>
<?php
      $sql="SELECT * FROM BG WHERE bg='$username' AND crew=''";
      $result=mysql_query($sql);
      while($rows=mysql_fetch_array($result)) { // Start looping table row
?>
<tr>
</tr>
<?php
        }
      }
?>
</table>
<br>
<?php
    if($famlevel >= 0) {
?>
<form method="post" action="">
<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
<?php
      $num_true=mysql_num_rows(mysql_query("SELECT * FROM BG WHERE bg='$username' AND status='Pending'"));
      if($num_true >= 1) {
?>
<tr>
<td class="header" colspan="2" align="center">Bodyguard Invitation</td>
</tr>
<?php
        $sql="SELECT * FROM BG WHERE bg='$username'";
        $result=mysql_query($sql);
        while($rows=mysql_fetch_array($result)) { // Start looping table row
?>
<tr>
<td colspan="2" align="center">You have been invited to be a bodyguard!<br><input type="submit" value="Accept" name="acceptbg"></td>
</tr>
<?php
          }
        }
?>
</table>
<br>
<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
<tr>
<td class="header" colspan="2" align="center">Leave Crew</td>
</tr>
<tr>
<td colspan="2" align="center"><font color="red"><b>Note: Leaving crew can result in you losing up to 85% health</b></font><br><br><input type="submit" value="Leave Crew" name="leave"></td>
</tr>
<?php
      if($crewlevel >=7 && $fetch->slot <200) {
?>
<tr>
<td class="header" colspan="2" align="center">Upgrade Crew Size</td>
</tr>
<tr>
<td align="center">
<?php
        if($fetch->slot ==50) {
          $next=75; $upgradecost=100000000;
          }
        if($fetch->slot ==75) {
          $next=125; $upgradecost=1250000000;
          } elseif($fetch->slot ==125) {
          $next=200; $upgradecost=1500000000;
          } elseif($fetch->slot ==200) {
          $next=300; $upgradecost=3000000000;
          } elseif($fetch->slot ==300) {
          $next=500; $upgradecost=5000000000;
          }
?>
Your Families current size is <b><?php echo $fetch->slot ; ?></b>, it will cost $<?php echo number_format($upgradecost); ?> to upgrade it to <?php echo $next ;?>.<br>
<input type="submit" name="upgrade" value="Upgrade">
</td>
</tr>
<?php
        }
?>
</table>
<?php
      }
?>
</form>
<?php
    if($userlevel >= 5) {
?>
<form method="post" action="">
<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
<tr>
<td class="header" colspan="2" align="center">Change Family Name</td>
</tr>
<tr>
<td width="90%" align="center">Family ID:<br><input style="border:1px solid black;" type="text" name="famid"><br></td>
</tr>
<tr>
<td align="center">New family Name:<br><input type="text" style="border:1px solid black;" name="newfamname"><br><br>
<input type="submit" value="Change" name="change">	  </td>
</tr>
</table>
</form>
<br><br>
<?php
      }
    if($userlevel >= 15) {
?>
<form method="post" action="">
<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
<tr>
<td class="header" colspan="2" align="center">Drop Family</td>
</tr>
<tr>
<td width="90%" align="center"><br><center><select name="famnamedrop">
<?php
      include "includes/db_connect.php";
      $sql="SELECT * FROM family ORDER by id";
      $result=mysql_query($sql);
      while($rows=mysql_fetch_array($result)) { // Start looping table row
?>
<option><?php echo $rows['name']; ?></option>
<?php
        }
?>
</select>
<br><br>
<input type="submit" value="Drop Family" name="dropfamily"></center>
</td>
</tr>
</table>
</form>
<?php
      }
?>
<br><br></td>
<TD width="150" valign="top">
<?php include("rightmenu.php");?>
</TD>
</TR>
</table>
<?php
    }
  }
?>
</center>
</body>
</html>

 

And your problem seems to be 1 missing }, right at the end, the last <?php ?> tag, there was only 1 } there originally, so I put another.  Try it out.

 

Also, there's no need to include the same file more than once in a script, just include it once at the very beginning of the file.  db_connect as an example, you include it I think 3 times, it only needs to be included once.  And you also only include it inside multiple if statements, which is bad because it makes you HAVE to include it more than once.  ALSO, it seems that you're running queries before you've even included db_connect at all, so you'll probably get errors there, too.

Hi

 

You have the following code that is missing a few full stops

 

echo'<tr>

<td colspan="2" align="center">You have requested <b>'.$username.'</b>!><br><br>

<input type="submit" value="Cancel Application" name="cancelapply"></td>

</tr>';

 

All the best

 

Keith

 

Ok, I edited it to what you said, and some other things and I am getting this:

 

Parse error: syntax error, unexpected $end in /home/klrbal/public_html/Mafia-test/tempfam.php on line 523

 

Here is my code:

<?php
session_start();  

if (!(isset($_SESSION["real_name"])))
{
//echo "I'm not logged in";
header('Location: index.php');
}
else
{
echo "";
}


?>



<html>
<head>
<title>Mafia Syndicate BETA .::. Families</title></head>
    	<link REL="stylesheet" TYPE="text/css" HREF="main.css">

<script language=javascript src=Menus.js></script>

<body background="wallpaper.jpg">
<center> 
<table border="0" cellspacing="0" cellpadding="0" align="center" width="95%" class="cat">

<TR> 

<TD width="150" background="tdbg3.jpg" bgcolor="#222222" valign="top">
<?php include("leftmenu.php");?>
</TD>
  
    <td width="100%" valign="top">	<br>	


<?php

	$fetch=mysql_fetch_object(mysql_query("SELECT * FROM crews WHERE name='$crew' LIMIT 1"));

////CREATE CREW/////
if ($_POST['createfamily'] && $_POST['familyname']){

$familyname == $_POST['familyname']; 

if ($rankpoints <= 140109){ 

echo "You must be Underboss before you can make a crew!";

}else{


if ($crewlevel==0){

$finalcash = $cash - 500000000000 ;

if ($finalcash <0){

echo "You do not have enough cash!";

}}elseif ($finalcash >=0){

$num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE id >1"));
if ($num_true >= 5){
echo "There are already 5 Crew Slots!"; 
}else{

$num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE name='$familyname'"));
if ($num_true >= 1){

echo "There is already a Family with that name!";
}else{

function change($msg){
$post = $msg;
$post = str_replace("'", "`", $post); 
return $post;
}

$new=change($crewname);

mysql_query("INSERT INTO `family` ( `id` , `owner` , `name` , `bank` , `quote` , `news` , `slot` ) VALUES ('', '$username', '$new', '0', 'No Quote!', 'You have no family news8)', '50')");
mysql_query("UPDATE users SET famlevel='9' WHERE username='$username'");
mysql_query("UPDATE users SET cash='$finalcash', family='$new'  WHERE username='$username'");
mysql_query("INSERT INTO `logs` ( `id` , `who` , `action` , `date` , `ip` ) VALUES ('', '$username', 'Bought a Family called <b>$new</b>!', '$date', '$realip')");

echo "You have created the Family <b>$new!</b>";


}
}
}


if ($_POST['cancelapply']){

mysql_query("DELETE FROM famreq WHERE username='$username'");

echo "You have cancelled your application!";

}


/////END OF CREATE CREW!!!/////
mysql_query("SELECT * from users WHERE famlevel='$famlevel'");

if ($famlevel >= 2);

if ($_POST['inviteuser'] && strip_tags($_POST['inviteusername'])){

$sql2="SELECT * from famreq WHERE username='$username'";
$result2=mysql_query($sql2);

$num_true=mysql_num_rows($result2);
if ($num_true >= 1){
echo "You have already pending Family request!"; 
}elseif ($num_true <=1){

$crewnamejoin = $_POST['inviteusername'];
$crewnamejoin = strip_tags($inviteusername);

$sql="SELECT * FROM users WHERE username='$username'";
$result=mysql_query($sql);

if ($_POST['acceptinvite']){

$sql="SELECT * from famreq WHERE family='$famid'";
$result=mysql_query($sql);


mysql_query("INSERT INTO `famreq` ( `id` , `famid` , `username` , `status` , `f` ) VALUES (
'', '$invitedusername', '$username', '$status', '$f' )");


echo "You have requested $invitedusername to join your family!";

}
}
}

if ($_POST['leave'] && $famlevel >=2 && $famlevel <7)


if ($famlevel <= 0) 
{
echo "You are not in a Family!";
}else


if ($famlevel >= 4)
{
echo "You can not leave your family!"; }

if ($_POST['change'] && strip_tags($_POST['newfamname']) && strip_tags($_POST['famid']) && $userlevel >=10){

$newcrewname = $_POST['newfamname'];
$newcrewname = strip_tags($newfamname);
$crewid = $_POST['famid'];
$crewid = strip_tags($famid);

$sql="SELECT * from family WHERE id='$famid'";
$result=mysql_query($sql);

while($rows=mysql_fetch_array($result)){ // Start looping table row 

$oname = $rows['name'];
}
}

$num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE name='$newfamname'"));
if ($num_true >= 1){

echo "There is already a family with that name!";
}else{


function change($msg)
{
$post = $msg;
$post = str_replace("'", "`", $post); 
return $post;
}
}
{
$newfamname=change($newfamame);

mysql_query("UPDATE users SET famname='$newfamname' WHERE famname='$oname'");
mysql_query("UPDATE famreq SET famid='$newfamname' WHERE famid='$oname'");
mysql_query("UPDATE forum_answer SET place='$newfamname' WHERE place='$oname'");
mysql_query("UPDATE forum_question SET place='$newfamname' WHERE place='$oname'");
mysql_query("UPDATE family_donations SET fam='$newfamname' WHERE famname='$oname'");
mysql_query("UPDATE family SET famname='$newfamname' WHERE id='$crewid'");
mysql_query("UPDATE BG SET crew='$newfamname' WHERE crew='$oname'");

{
echo "You changed the family $oname to $newfamname!";
}
}

if ($_POST['dropfam'] && strip_tags($_POST['famnamedrop']) && $userlevel >=15){

$crewnamedrop = $_POST['famnamedrop'];
$crewnamedrop = strip_tags($famnamedrop);

mysql_query("DELETE FROM crews WHERE name='$crewnamedrop'");
mysql_query("UPDATE users SET crewlevel='0', crew='None' WHERE crew='$crewnamedrop'");
mysql_query("DELETE FROM crewapply WHERE crew='$crewnamedrop'");
mysql_query("DELETE FROM forum_answer WHERE place='$crewnamedrop'");
mysql_query("DELETE FROM forum_question WHERE place='$crewnamedrop'");
mysql_query("DELETE FROM crew_donations WHERE place='$crewnamedrop'");

echo "You have droped <b>$crewnamedrop</b>!";

}

if ($_POST['acceptbg']){

mysql_query("UPDATE BG SET status='Accepted' WHERE bg='$username' AND status='Pending'");

echo "You are now a bodyguard";

}

if ($_POST['acceptbg2']){

mysql_query("UPDATE BG SET status='Accepted' WHERE bg='$username' AND status='Pending'");

echo "You are now a bodyguard!";

}

if ($_POST['upgrade'] && $famlevel >=7 && $fetch->slot <500){

if ($fetch->slot ==75){$next=125; $upgradecost=10000000000;}
elseif ($fetch->slot ==125){$next=200; $upgradecost=150000000000;}
elseif ($fetch->slot ==200){$next=300; $upgradecost=20000000000;}
elseif ($fetch->slot ==300){$next=500; $upgradecost=30000000000;}	


$newcash = $cash - $upgradecost;

if ($newcash <0){
echo "You do not have enough cash to upgrade!";
}else{

mysql_query("UPDATE family SET slot='$next' WHERE name='$name' AND owner='$username'");
mysql_query("UPDATE users SET cash=cash-'$upgradecost' WHERE username='$username' AND family='$famname'");

echo "Your Family size is now <b>$next</b>!";

}}

?>


<table border="1" class="sub2" align="center" cellspacing="0" cellpadding="1" bordercolor=black width=81%>
<tr>
<td align="center" colspan="5" class="header">Crews</td>
</tr>
<?php
include "includes/db_connect.php"; 

$sql="SELECT * FROM family ORDER by id ASC";
$result=mysql_query($sql);


while($rows=mysql_fetch_array($result)){ // Start looping table row 

$name=$rows['owner'];
$famname=$rows['id'];
$famname2=$rows['name'];


$sql2="SELECT * from users WHERE family='$famname2'";
$result2=mysql_query($sql2);

$num=mysql_num_rows($result2);
}
?>
<tr>
<td width="70%"><a href="viewcrewprofile.php?viewcrew=<? echo $famname ?>"><? echo $rows['name']; ?></a></td><td width="20%"><a href="viewprofile.php?viewuser=<? echo $name ?>"><? echo $rows['owner']; ?></a></td><td width="10%"><? echo "$num"; ?></td>
</tr>

    <tr>
      <td colspan="5" align="right"><?php
  
  $num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE id >1"));

  {
   echo "$num_true";}
   ?> /5 Families</td> 

    </tr>
</table>

<br>
<br>
<td>

<?php
$sql2="SELECT * from famreq WHERE famid='$famid' AND status='Pending'";
$result2=mysql_query($sql2);

$num_true=mysql_num_rows($result2);{
  echo "$num_true"; 
}
?>
</td><td align="center"><input type="submit" name="acceptreq" value="Accept"></td>
    <tr>
      <td class="header" colspan="2" align="center">Create Crew </td>
    </tr>
	<tr>
<td>
      <p><font color="blue"><b>Making a family will Cost $500,000,000,000.
You must be ranked Underboss + to make a Family.</b></font></p></td>
</tr>
<tr>
<td width="92%" bgcolor="#3c3025" border="0">
<center>
Crew Name:<br>
<input type="text" style="border:1px solid black;" name="familyname">
<br><br>
<input type="submit" value="Create Family" name="createfamily"></center>	  </td>
    </tr>
<?php
$num_true=mysql_num_rows(mysql_query("SELECT * FROM famreq WHERE username='$username'"));
if ($num_true == 1)


{
echo'<tr>
      <td class="header" colspan="2" align="center">Pending Application </td>
    </tr>';
    }

include "includes/db_connect.php"; 

$sql="SELECT * FROM famreq WHERE username='$username'";
$result=mysql_query($sql);


while($rows=mysql_fetch_array($result)) // Start looping table row 
    echo'<tr>
      <td colspan="2" align="center">You have requested '.$username.'!>';
      ?>
      	  <input type="submit" value="Cancel Request" name="cancelapply"></td>
    </tr>
    


</table>
</form>

<br>


<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2"></table>
<?php
$num_true=mysql_num_rows(mysql_query("SELECT * FROM BG WHERE bg='$username' AND status='Pending' AND crew=''"));
if ($num_true >= 1)


$sql="SELECT * FROM BG WHERE bg='$username' AND crew=''";
$result=mysql_query($sql);


while($rows=mysql_fetch_array($result)) // Start looping table row 


?>	
</table>
<br>


<?php
if ($famlevel >= 0)
?>

    <form method="post" action="">
    <table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
<?php
$num_true=mysql_num_rows(mysql_query("SELECT * FROM BG WHERE bg='$username' AND status='Pending'"));
if ($num_true >= 1){
?>
    <tr>
      <td class="header" colspan="2" align="center">Bodyguard Invitation</td>
    </tr>


<?php
$sql="SELECT * FROM BG WHERE bg='$username'";
$result=mysql_query($sql);


while($rows=mysql_fetch_array($result)) // Start looping table row 
   echo'
    <tr>
      <td colspan="2" align="center">"You have been invited to be a bodyguard!"<br>'?>
  <input type="submit" value="Accept" name="acceptbg"></td>
    </tr>

</table>
<br>




<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
    <tr>
      <td class="header" colspan="2" align="center">Leave Crew</td>
    </tr>
    <tr>
      <td colspan="2" align="center"><font color="red"><b>Note: Leaving crew can result in you losing up to 85% health</b></font>
  <br>
  <br>
  <input type="submit" value="Leave Crew" name="leave">	  </td>
    </tr>
<?php
if ($crewlevel >=7 && $fetch->slot <200) ?>
    <tr>
      <td class="header" colspan="2" align="center">Upgrade Crew Size</td>
    </tr>
<tr>
<td align="center">
<?php

if ($fetch->slot ==50){$next=75; $upgradecost=100000000;}
if ($fetch->slot ==75){$next=125; $upgradecost=1250000000;}
elseif ($fetch->slot ==125){$next=200; $upgradecost=1500000000;}
elseif ($fetch->slot ==200){$next=300; $upgradecost=3000000000;}
elseif ($fetch->slot ==300){$next=500; $upgradecost=5000000000;}	
?>
<?php
echo'
Your Families current size is'?>
<?php echo $fetch->slot ; ?></b>, it will cost $
<?php echo number_format('$upgradecost'); ?> to upgrade it to 
<?php echo $next ;?>.<br>
<input type="submit" name="upgrade" value="Upgrade">
</td>
</tr>

</table>

</form>
<?php
if ($userlevel >= 5) 

?>
<form method="post" action="">
<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
    <tr>
      <td class="header" colspan="2" align="center">Change Family Name</td>
    </tr>
    <tr>
      <td width="90%" align="center">Family ID:<br><input style="border:1px solid black;" type="text" name="famid"><br></td>
    </tr>
    <tr>
      <td align="center">New family Name:<br><input type="text" style="border:1px solid black;" name="newfamname"><br><br>
  <input type="submit" value="Change" name="change">	  </td>
    </tr>
</table>
</form>
<br><br>

<?php
if ($userlevel >= 15) 

?>

<form method="post" action="">
<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
    <tr>
      <td class="header" colspan="2" align="center">Drop Family</td>
    </tr>
    <tr>
      <td width="90%" align="center"><br>
  <center><select name="famnamedrop">
<?php
include "includes/db_connect.php"; 

$sql="SELECT * FROM family ORDER by id";
$result=mysql_query($sql);


while($rows=mysql_fetch_array($result)) // Start looping table row 


?>
<option><?php	 echo $rows['name']; ?>
</option>

</select>
<br><br>
<input type="submit" value="Drop Family" name="dropfamily"></center>
  
  </td>
    </tr>
</table>
</form>


<br><br>


</td>



  	  <TD width="150" valign="top">
<?php include("rightmenu.php");?>
</TD>

</TR>


</table>

</center>
</body>
</html>

<td colspan="2" align="center">"You have been invited to be a bodyguard!"<br>'?>

 

no ; at the end of this echo.  line 400.

 

fixed, same error

 

<?php
session_start();  

if (!(isset($_SESSION["real_name"])))
{
//echo "I'm not logged in";
header('Location: index.php');
}
else
{
echo "";
}


?>



<html>
<head>
<title>Mafia Syndicate BETA .::. Families</title></head>
    	<link REL="stylesheet" TYPE="text/css" HREF="main.css">

<script language=javascript src=Menus.js></script>

<body background="wallpaper.jpg">
<center> 
<table border="0" cellspacing="0" cellpadding="0" align="center" width="95%" class="cat">

<TR> 

<TD width="150" background="tdbg3.jpg" bgcolor="#222222" valign="top">
<?php include("leftmenu.php");?>
</TD>
  
    <td width="100%" valign="top">	<br>	


<?php

	$fetch=mysql_fetch_object(mysql_query("SELECT * FROM crews WHERE name='$crew' LIMIT 1"));

////CREATE CREW/////
if ($_POST['createfamily'] && $_POST['familyname']){

$familyname == $_POST['familyname']; 

if ($rankpoints <= 140109){ 

echo "You must be Underboss before you can make a crew!";

}else{


if ($crewlevel==0){

$finalcash = $cash - 500000000000 ;

if ($finalcash <0){

echo "You do not have enough cash!";

}}elseif ($finalcash >=0){

$num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE id >1"));
if ($num_true >= 5){
echo "There are already 5 Crew Slots!"; 
}else{

$num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE name='$familyname'"));
if ($num_true >= 1){

echo "There is already a Family with that name!";
}else{

function change($msg){
$post = $msg;
$post = str_replace("'", "`", $post); 
return $post;
}

$new=change($crewname);

mysql_query("INSERT INTO `family` ( `id` , `owner` , `name` , `bank` , `quote` , `news` , `slot` ) VALUES ('', '$username', '$new', '0', 'No Quote!', 'You have no family news8)', '50')");
mysql_query("UPDATE users SET famlevel='9' WHERE username='$username'");
mysql_query("UPDATE users SET cash='$finalcash', family='$new'  WHERE username='$username'");
mysql_query("INSERT INTO `logs` ( `id` , `who` , `action` , `date` , `ip` ) VALUES ('', '$username', 'Bought a Family called <b>$new</b>!', '$date', '$realip')");

echo "You have created the Family <b>$new!</b>";


}
}
}


if ($_POST['cancelapply']){

mysql_query("DELETE FROM famreq WHERE username='$username'");

echo "You have cancelled your application!";

}


/////END OF CREATE CREW!!!/////
mysql_query("SELECT * from users WHERE famlevel='$famlevel'");

if ($famlevel >= 2);

if ($_POST['inviteuser'] && strip_tags($_POST['inviteusername'])){

$sql2="SELECT * from famreq WHERE username='$username'";
$result2=mysql_query($sql2);

$num_true=mysql_num_rows($result2);
if ($num_true >= 1){
echo "You have already pending Family request!"; 
}elseif ($num_true <=1){

$crewnamejoin = $_POST['inviteusername'];
$crewnamejoin = strip_tags($inviteusername);

$sql="SELECT * FROM users WHERE username='$username'";
$result=mysql_query($sql);

if ($_POST['acceptinvite']){

$sql="SELECT * from famreq WHERE family='$famid'";
$result=mysql_query($sql);


mysql_query("INSERT INTO `famreq` ( `id` , `famid` , `username` , `status` , `f` ) VALUES (
'', '$invitedusername', '$username', '$status', '$f' )");


echo "You have requested $invitedusername to join your family!";

}
}
}

if ($_POST['leave'] && $famlevel >=2 && $famlevel <7)


if ($famlevel <= 0) 
{
echo "You are not in a Family!";
}else


if ($famlevel >= 4)
{
echo "You can not leave your family!"; }

if ($_POST['change'] && strip_tags($_POST['newfamname']) && strip_tags($_POST['famid']) && $userlevel >=10){

$newcrewname = $_POST['newfamname'];
$newcrewname = strip_tags($newfamname);
$crewid = $_POST['famid'];
$crewid = strip_tags($famid);

$sql="SELECT * from family WHERE id='$famid'";
$result=mysql_query($sql);

while($rows=mysql_fetch_array($result)){ // Start looping table row 

$oname = $rows['name'];
}
}

$num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE name='$newfamname'"));
if ($num_true >= 1){

echo "There is already a family with that name!";
}else{


function change($msg)
{
$post = $msg;
$post = str_replace("'", "`", $post); 
return $post;
}
}
{
$newfamname=change($newfamame);

mysql_query("UPDATE users SET famname='$newfamname' WHERE famname='$oname'");
mysql_query("UPDATE famreq SET famid='$newfamname' WHERE famid='$oname'");
mysql_query("UPDATE forum_answer SET place='$newfamname' WHERE place='$oname'");
mysql_query("UPDATE forum_question SET place='$newfamname' WHERE place='$oname'");
mysql_query("UPDATE family_donations SET fam='$newfamname' WHERE famname='$oname'");
mysql_query("UPDATE family SET famname='$newfamname' WHERE id='$crewid'");
mysql_query("UPDATE BG SET crew='$newfamname' WHERE crew='$oname'");

{
echo "You changed the family $oname to $newfamname!";
}
}

if ($_POST['dropfam'] && strip_tags($_POST['famnamedrop']) && $userlevel >=15){

$crewnamedrop = $_POST['famnamedrop'];
$crewnamedrop = strip_tags($famnamedrop);

mysql_query("DELETE FROM crews WHERE name='$crewnamedrop'");
mysql_query("UPDATE users SET crewlevel='0', crew='None' WHERE crew='$crewnamedrop'");
mysql_query("DELETE FROM crewapply WHERE crew='$crewnamedrop'");
mysql_query("DELETE FROM forum_answer WHERE place='$crewnamedrop'");
mysql_query("DELETE FROM forum_question WHERE place='$crewnamedrop'");
mysql_query("DELETE FROM crew_donations WHERE place='$crewnamedrop'");

echo "You have droped <b>$crewnamedrop</b>!";

}

if ($_POST['acceptbg']){

mysql_query("UPDATE BG SET status='Accepted' WHERE bg='$username' AND status='Pending'");

echo "You are now a bodyguard";

}

if ($_POST['acceptbg2']){

mysql_query("UPDATE BG SET status='Accepted' WHERE bg='$username' AND status='Pending'");

echo "You are now a bodyguard!";

}

if ($_POST['upgrade'] && $famlevel >=7 && $fetch->slot <500){

if ($fetch->slot ==75){$next=125; $upgradecost=10000000000;}
elseif ($fetch->slot ==125){$next=200; $upgradecost=150000000000;}
elseif ($fetch->slot ==200){$next=300; $upgradecost=20000000000;}
elseif ($fetch->slot ==300){$next=500; $upgradecost=30000000000;}	


$newcash = $cash - $upgradecost;

if ($newcash <0){
echo "You do not have enough cash to upgrade!";
}else{

mysql_query("UPDATE family SET slot='$next' WHERE name='$name' AND owner='$username'");
mysql_query("UPDATE users SET cash=cash-'$upgradecost' WHERE username='$username' AND family='$famname'");

echo "Your Family size is now <b>$next</b>!";

}}

?>


<table border="1" class="sub2" align="center" cellspacing="0" cellpadding="1" bordercolor=black width=81%>
<tr>
<td align="center" colspan="5" class="header">Crews</td>
</tr>
<?php
include "includes/db_connect.php"; 

$sql="SELECT * FROM family ORDER by id ASC";
$result=mysql_query($sql);


while($rows=mysql_fetch_array($result)){ // Start looping table row 

$name=$rows['owner'];
$famname=$rows['id'];
$famname2=$rows['name'];


$sql2="SELECT * from users WHERE family='$famname2'";
$result2=mysql_query($sql2);

$num=mysql_num_rows($result2);
}
?>
<tr>
<td width="70%"><a href="viewcrewprofile.php?viewcrew=<? echo $famname ?>"><? echo $rows['name']; ?></a></td><td width="20%"><a href="viewprofile.php?viewuser=<? echo $name ?>"><? echo $rows['owner']; ?></a></td><td width="10%"><? echo "$num"; ?></td>
</tr>

    <tr>
      <td colspan="5" align="right"><?php
  
  $num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE id >1"));

  {
   echo "$num_true";}
   ?> /5 Families</td> 

    </tr>
</table>

<br>
<br>
<td>

<?php
$sql2="SELECT * from famreq WHERE famid='$famid' AND status='Pending'";
$result2=mysql_query($sql2);

$num_true=mysql_num_rows($result2);{
  echo "$num_true"; 
}
?>
</td><td align="center"><input type="submit" name="acceptreq" value="Accept"></td>
    <tr>
      <td class="header" colspan="2" align="center">Create Crew </td>
    </tr>
	<tr>
<td>
      <p><font color="blue"><b>Making a family will Cost $500,000,000,000.
You must be ranked Underboss + to make a Family.</b></font></p></td>
</tr>
<tr>
<td width="92%" bgcolor="#3c3025" border="0">
<center>
Crew Name:<br>
<input type="text" style="border:1px solid black;" name="familyname">
<br><br>
<input type="submit" value="Create Family" name="createfamily"></center>	  </td>
    </tr>
<?php
$num_true=mysql_num_rows(mysql_query("SELECT * FROM famreq WHERE username='$username'"));
if ($num_true == 1)


{
echo'<tr>
      <td class="header" colspan="2" align="center">Pending Application </td>
    </tr>';
    }

include "includes/db_connect.php"; 

$sql="SELECT * FROM famreq WHERE username='$username'";
$result=mysql_query($sql);


while($rows=mysql_fetch_array($result)) // Start looping table row 
    echo'<tr>
      <td colspan="2" align="center">You have requested '.$username.'!>';
      ?>
      	  <input type="submit" value="Cancel Request" name="cancelapply"></td>
    </tr>
    


</table>
</form>

<br>


<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2"></table>
<?php
$num_true=mysql_num_rows(mysql_query("SELECT * FROM BG WHERE bg='$username' AND status='Pending' AND crew=''"));
if ($num_true >= 1)


$sql="SELECT * FROM BG WHERE bg='$username' AND crew=''";
$result=mysql_query($sql);


while($rows=mysql_fetch_array($result)) // Start looping table row 


?>	
</table>
<br>


<?php
if ($famlevel >= 0)
?>

    <form method="post" action="">
    <table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
<?php
$num_true=mysql_num_rows(mysql_query("SELECT * FROM BG WHERE bg='$username' AND status='Pending'"));
if ($num_true >= 1){
?>
    <tr>
      <td class="header" colspan="2" align="center">Bodyguard Invitation</td>
    </tr>


<?php
$sql="SELECT * FROM BG WHERE bg='$username'";
$result=mysql_query($sql);


while($rows=mysql_fetch_array($result)) // Start looping table row 
   echo'
    <tr>
      <td colspan="2" align="center">"You have been invited to be a bodyguard!"<br>'?>;
  <input type="submit" value="Accept" name="acceptbg"></td>
    </tr>

</table>
<br>




<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
    <tr>
      <td class="header" colspan="2" align="center">Leave Crew</td>
    </tr>
    <tr>
      <td colspan="2" align="center"><font color="red"><b>Note: Leaving crew can result in you losing up to 85% health</b></font>
  <br>
  <br>
  <input type="submit" value="Leave Crew" name="leave">	  </td>
    </tr>
<?php
if ($crewlevel >=7 && $fetch->slot <200) ?>
    <tr>
      <td class="header" colspan="2" align="center">Upgrade Crew Size</td>
    </tr>
<tr>
<td align="center">
<?php

if ($fetch->slot ==50){$next=75; $upgradecost=100000000;}
if ($fetch->slot ==75){$next=125; $upgradecost=1250000000;}
elseif ($fetch->slot ==125){$next=200; $upgradecost=1500000000;}
elseif ($fetch->slot ==200){$next=300; $upgradecost=3000000000;}
elseif ($fetch->slot ==300){$next=500; $upgradecost=5000000000;}	
?>
<?php
echo'
Your Families current size is'?>
<?php echo $fetch->slot ; ?></b>, it will cost $
<?php echo number_format('$upgradecost'); ?> to upgrade it to 
<?php echo $next ;?>.<br>
<input type="submit" name="upgrade" value="Upgrade">
</td>
</tr>

</table>

</form>
<?php
if ($userlevel >= 5) 

?>
<form method="post" action="">
<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
    <tr>
      <td class="header" colspan="2" align="center">Change Family Name</td>
    </tr>
    <tr>
      <td width="90%" align="center">Family ID:<br><input style="border:1px solid black;" type="text" name="famid"><br></td>
    </tr>
    <tr>
      <td align="center">New family Name:<br><input type="text" style="border:1px solid black;" name="newfamname"><br><br>
  <input type="submit" value="Change" name="change">	  </td>
    </tr>
</table>
</form>
<br><br>

<?php
if ($userlevel >= 15) 

?>

<form method="post" action="">
<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
    <tr>
      <td class="header" colspan="2" align="center">Drop Family</td>
    </tr>
    <tr>
      <td width="90%" align="center"><br>
  <center><select name="famnamedrop">
<?php
include "includes/db_connect.php"; 

$sql="SELECT * FROM family ORDER by id";
$result=mysql_query($sql);


while($rows=mysql_fetch_array($result)) // Start looping table row 


?>
<option><?php	 echo $rows['name']; ?>
</option>

</select>
<br><br>
<input type="submit" value="Drop Family" name="dropfamily"></center>
  
  </td>
    </tr>
</table>
</form>


<br><br>


</td>



  	  <TD width="150" valign="top">
<?php include("rightmenu.php");?>
</TD>

</TR>


</table>

</center>
</body>
</html>

So I fixed the line 72 issue on the other code and here is what I get now:

 

Parse error: syntax error, unexpected $end in /home/klrbal/public_html/Mafia-test/tempfam.php on line 393

 

<?php
session_start();

if(!(isset($_SESSION["real_name"]))) {
  //echo "I'm not logged in";
  header('Location: index.php');
  } else {
  echo "";
  }
?>
<html>
<head>
<title>Mafia Syndicate BETA .::. Families</title>
<link REL="stylesheet" TYPE="text/css" HREF="main.css">
<script language=javascript src=Menus.js></script>
</head>

<body background="wallpaper.jpg">
<center>
<table border="0" cellspacing="0" cellpadding="0" align="center" width="95%" class="cat">
<TR>
<TD width="150" background="tdbg3.jpg" bgcolor="#222222" valign="top"><?php include("leftmenu.php");?></TD>
<td width="100%" valign="top"><br>
<?php
$fetch=mysql_fetch_object(mysql_query("SELECT * FROM crews WHERE name='$crew' LIMIT 1"));

////CREATE CREW/////
if($_POST['createfamily'] && $_POST['familyname']) {
  $familyname == $_POST['familyname'];
  if($rankpoints <= 140109) {
    echo "You must be Underboss before you can make a crew!";
    } else {
    if($crewlevel==0) {
      $finalcash = $cash - 500000000000 ;
      if($finalcash <0) {
        echo "You do not have enough cash!";
        } elseif($finalcash >=0) {
        $num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE id >1"));
if($num_true >= 5) {
  echo "There are already 5 Crew Slots!";
  } else {
          $num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE name='$familyname'"));
  if($num_true >= 1) {
            echo "There is already a Family with that name!";
    } else {
            function change($msg) {
      $post = $msg;
      $post = str_replace("'", "`", $post);
      return $post;
      }
            $new=change($crewname);
            mysql_query("INSERT INTO `family` ( `id` , `owner` , `name` , `bank` , `quote` , `news` , `slot` ) VALUES ('', '$username', '$new', '0', 'No Quote!', 'You have no family news8)', '50')");
            mysql_query("UPDATE users SET famlevel='9' WHERE username='$username'");
            mysql_query("UPDATE users SET cash='$finalcash', family='$new'  WHERE username='$username'");
            mysql_query("INSERT INTO `logs` ( `id` , `who` , `action` , `date` , `ip` ) VALUES ('', '$username', 'Bought a Family called <b>$new</b>!', '$date', '$realip')");
            echo "You have created the Family <b>$new!</b>";
            }
          }
        }
      }
    }
  }

if($_POST['cancelapply']) {
  mysql_query("DELETE FROM famreq WHERE username='$username'");
  echo "You have cancelled your application!";
  }


/////END OF CREATE CREW!!!/////

if(famlevel >= 2);
  if($_POST['inviteuser'] && strip_tags($_POST['inviteusername'])) {
    $sql2="SELECT * from famreq WHERE username='$username'";
    $result2=mysql_query($sql2);
    $num_true=mysql_num_rows($result2);
    if($num_true >= 1) {
      echo "You have already pending Family request!";
      } elseif($num_true <=1) {
      $crewnamejoin = $_POST['inviteusername'];
      $crewnamejoin = strip_tags($inviteusername);
      $sql="SELECT * FROM users WHERE username='$username'";
      $result=mysql_query($sql);
      if($_POST['acceptinvite']) {
        $sql="SELECT * from famreq WHERE family='$famid'";
$result=mysql_query($sql);
        mysql_query("INSERT INTO `famreq` ( `id` , `famid` , `username` , `status` , `f` ) VALUES ('', '$invitedusername', '$username', '$status', '$f' )");
        echo "You have requested $invitedusername to join your family!";
        }
      }
    if($_POST['leave'] && $famlevel >=2 && $famlevel <7){
      if($famlevel <= 0) {
        echo "You are not in a Family!";
        } else {
        if($famlevel >= 4) {
          echo "You can not leave your family!";
          if($_POST['change'] && strip_tags($_POST['newfamname']) && strip_tags($_POST['famid']) && $userlevel >=10) {
            $newcrewname = $_POST['newfamname'];
            $newcrewname = strip_tags($newfamname);
            $crewid = $_POST['famid'];
            $crewid = strip_tags($famid);
            $sql="SELECT * from family WHERE id='$famid'";
            $result=mysql_query($sql);
            while($rows=mysql_fetch_array($result)) { // Start looping table row
              $oname = $rows['name'];
              }
            $num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE name='$newfamname'"));
            if($num_true >= 1) {
            echo "There is already a family with that name!";
            } else {
            function change($msg) {
              $post = $msg;
              $post = str_replace("'", "`", $post);
              return $post;
              }
            $newfamname=change($newfamame);
            mysql_query("UPDATE users SET famname='$newfamname' WHERE famname='$oname'");
            mysql_query("UPDATE famreq SET famid='$newfamname' WHERE famid='$oname'");
            mysql_query("UPDATE forum_answer SET place='$newfamname' WHERE place='$oname'");
            mysql_query("UPDATE forum_question SET place='$newfamname' WHERE place='$oname'");
            mysql_query("UPDATE family_donations SET fam='$newfamname' WHERE famname='$oname'");
            mysql_query("UPDATE family SET famname='$newfamname' WHERE id='$crewid'");
            mysql_query("UPDATE BG SET crew='$newfamname' WHERE crew='$oname'");
            echo "You changed the family $oname to $newfamname!";
            }
          }
        if($_POST['dropfam'] && strip_tags($_POST['famnamedrop']) && $userlevel >=15) {
          $crewnamedrop = $_POST['famnamedrop'];
          $crewnamedrop = strip_tags($famnamedrop);
          mysql_query("DELETE FROM crews WHERE name='$crewnamedrop'");
  mysql_query("UPDATE users SET crewlevel='0', crew='None' WHERE crew='$crewnamedrop'");
          mysql_query("DELETE FROM crewapply WHERE crew='$crewnamedrop'");
          mysql_query("DELETE FROM forum_answer WHERE place='$crewnamedrop'");
          mysql_query("DELETE FROM forum_question WHERE place='$crewnamedrop'");
          mysql_query("DELETE FROM crew_donations WHERE place='$crewnamedrop'");
          echo "You have droped <b>$crewnamedrop</b>!";
          }
        if($_POST['acceptbg']) {
          mysql_query("UPDATE BG SET status='Accepted' WHERE bg='$username' AND status='Pending'");
          echo "You are now a bodyguard";
          }
        if($_POST['acceptbg2']) {
          mysql_query("UPDATE BG SET status='Accepted' WHERE bg='$username' AND status='Pending'");
          echo "You are now a bodyguard!";
          }
        if($_POST['upgrade'] && $famlevel >=7 && $fetch->slot <500) {
          if($fetch->slot ==75) {
            $next=125; $upgradecost=10000000000;
            } elseif($fetch->slot ==125) {
            $next=200; $upgradecost=150000000000;
            } elseif($fetch->slot ==200) {
            $next=300; $upgradecost=20000000000;
            } elseif($fetch->slot ==300) {
            $next=500; $upgradecost=30000000000;
            }
          $newcash = $cash - $upgradecost;
          if($newcash <0) {
          echo "You do not have enough cash to upgrade!";
          } else {
          mysql_query("UPDATE family SET slot='$next' WHERE name='$name' AND owner='$username'");
          mysql_query("UPDATE users SET cash=cash-'$upgradecost' WHERE username='$username' AND family='$famname'");
          echo "Your Family size is now <b>$next</b>!";
          }
        }
?>
<table border="1" class="sub2" align="center" cellspacing="0" cellpadding="1" bordercolor=black width=81%>
<tr>
<td align="center" colspan="5" class="header">Crews</td>
</tr>
<?php
      include "includes/db_connect.php";
      $sql="SELECT * FROM family ORDER by id ASC";
      $result=mysql_query($sql);
      while($rows=mysql_fetch_array($result)) { // Start looping table row
        $name=$rows['owner'];
        $famname=$rows['id'];
        $famname2=$rows['name'];
        $sql2="SELECT * from users WHERE family='$famname2'";
        $result2=mysql_query($sql2);
        $num=mysql_num_rows($result2);
?>
<tr>
<td width="70%"><a href="viewcrewprofile.php?viewcrew=<?php echo $famname ?>"><?php echo $rows['name']; ?></a></td>
<td width="20%"><a href="viewprofile.php?viewuser=<?php echo $name ?>"><?php echo $rows['owner']; ?></a></td>
<td width="10%"><?php echo "$num"; ?></td>
</tr>
<?php
        }
?>
<tr>
<td colspan="5" align="right">
<?php
      $num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE id >1"));
      echo "$num_true";
?>
/5 Families
</td>
</tr>
</table>
<br><br>
<td>
<?php
      $sql2="SELECT * from famreq WHERE famid='$famid' AND status='Pending'";
      $result2=mysql_query($sql2);
      $num_true=mysql_num_rows($result2);
      echo "$num_true";
?>
</td>
  <td align="center"><input type="submit" name="acceptreq" value="Accept"></td>
<tr>
  <td class="header" colspan="2" align="center">Create Crew </td>
</tr>
<tr>
  <td><p><font color="blue"><b>Making a family will Cost $500,000,000,000.  You must be ranked Underboss + to make a Family.</b></font></p></td>
</tr>
<tr>
  <td width="92%" bgcolor="#3c3025" border="0"><center>Crew Name:<br><input type="text" style="border:1px solid black;" name="familyname"><br><br><input type="submit" value="Create Family" name="createfamily"></center></td>
</tr>
<?php
      $num_true=mysql_num_rows(mysql_query("SELECT * FROM famreq WHERE username='$username'"));
      if($num_true == 1) {
?>
<tr>
  <td class="header" colspan="2" align="center">Pending Application</td>
</tr>
<?php
        include "includes/db_connect.php";
        $sql="SELECT * FROM famreq WHERE username='$username'";
        $result=mysql_query($sql);
        while($rows=mysql_fetch_array($result)) { // Start looping table row
?>
<tr>
  <td colspan="2" align="center">You have requested <b><?php echo $username; ?></b><br><br><input type="submit" value="Cancel Application" name="cancelapply"></td>
</tr>
<?php
          }
        }
?>
</table></form>
<?php
      }
?>
<br>

<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
<?php
    $num_true=mysql_num_rows(mysql_query("SELECT * FROM BG WHERE bg='$username' AND status='Pending' AND crew=''"));
    if($num_true >= 1){
?>
<tr>
</tr>
<?php
      $sql="SELECT * FROM BG WHERE bg='$username' AND crew=''";
      $result=mysql_query($sql);
      while($rows=mysql_fetch_array($result)) { // Start looping table row
?>
<tr>
</tr>
<?php
        }
      }
?>
</table>
<br>
<?php
    if($famlevel >= 0) {
?>
<form method="post" action="">
<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
<?php
      $num_true=mysql_num_rows(mysql_query("SELECT * FROM BG WHERE bg='$username' AND status='Pending'"));
      if($num_true >= 1) {
?>
<tr>
<td class="header" colspan="2" align="center">Bodyguard Invitation</td>
</tr>
<?php
        $sql="SELECT * FROM BG WHERE bg='$username'";
        $result=mysql_query($sql);
        while($rows=mysql_fetch_array($result)) { // Start looping table row
?>
<tr>
<td colspan="2" align="center">You have been invited to be a bodyguard!<br><input type="submit" value="Accept" name="acceptbg"></td>
</tr>
<?php
          }
        }
?>
</table>
<br>
<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
<tr>
<td class="header" colspan="2" align="center">Leave Crew</td>
</tr>
<tr>
<td colspan="2" align="center"><font color="red"><b>Note: Leaving crew can result in you losing up to 85% health</b></font><br><br><input type="submit" value="Leave Crew" name="leave"></td>
</tr>
<?php
      if($crewlevel >=7 && $fetch->slot <200) {
?>
<tr>
<td class="header" colspan="2" align="center">Upgrade Crew Size</td>
</tr>
<tr>
<td align="center">
<?php
        if($fetch->slot ==50) {
          $next=75; $upgradecost=100000000;
          }
        if($fetch->slot ==75) {
          $next=125; $upgradecost=1250000000;
          } elseif($fetch->slot ==125) {
          $next=200; $upgradecost=1500000000;
          } elseif($fetch->slot ==200) {
          $next=300; $upgradecost=3000000000;
          } elseif($fetch->slot ==300) {
          $next=500; $upgradecost=5000000000;
          }
?>
Your Families current size is <b><?php echo $fetch->slot ; ?></b>, it will cost $<?php echo number_format($upgradecost); ?> to upgrade it to <?php echo $next ;?>.<br>
<input type="submit" name="upgrade" value="Upgrade">
</td>
</tr>
<?php
        }
?>
</table>
<?php
      }
?>
</form>
<?php
    if($userlevel >= 5) {
?>
<form method="post" action="">
<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
<tr>
<td class="header" colspan="2" align="center">Change Family Name</td>
</tr>
<tr>
<td width="90%" align="center">Family ID:<br><input style="border:1px solid black;" type="text" name="famid"><br></td>
</tr>
<tr>
<td align="center">New family Name:<br><input type="text" style="border:1px solid black;" name="newfamname"><br><br>
<input type="submit" value="Change" name="change">	  </td>
</tr>
</table>
</form>
<br><br>
<?php
      }
    if($userlevel >= 15) {
?>
<form method="post" action="">
<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
<tr>
<td class="header" colspan="2" align="center">Drop Family</td>
</tr>
<tr>
<td width="90%" align="center"><br><center><select name="famnamedrop">
<?php
      include "includes/db_connect.php";
      $sql="SELECT * FROM family ORDER by id";
      $result=mysql_query($sql);
      while($rows=mysql_fetch_array($result)) { // Start looping table row
?>
<option><?php echo $rows['name']; ?></option>
<?php
        }
?>
</select>
<br><br>
<input type="submit" value="Drop Family" name="dropfamily"></center>
</td>
</tr>
</table>
</form>
<?php
      }
?>
<br><br></td>
<TD width="150" valign="top">
<?php include("rightmenu.php");?>
</TD>
</TR>
</table>
<?php
    }
  }
?>
</center>
</body>
</html>

 

Same error basically

Same error basically

 

And I'll keep giving the same reply until you format your code in such a way that it is actually readable.

 

That doesn't help me.  That last script was a direct copy from someone else who rewrote it so I don't get where you're coming from  :wtf:

Parse error: syntax error, unexpected $end in /home/klrbal/public_html/Mafia-test/tempfam.php on line 393

 

That is because the following IF statement (line 73) opens a { but there isn't a matching close for it anywhere:-

 

  if($_POST['inviteuser'] && strip_tags($_POST['inviteusername'])) {

 

I suspect you need an extra one just before line 91.

 

All the best

 

Keith

Personally I think 4 spaces is ideal, and generally the norm' to use. Most editors should have the functionality to replace tab with x number of spaces so you don't have to hit the space bar 4 times. 2 I think still looks a little cluttered and unclear in certain areas.

 

Halo* you didn't really do much of a job indenting the code if I'm honest. What's happening here for example...

 

      if($finalcash <0) {
        echo "You do not have enough cash!";
        } elseif($finalcash >=0) {
        $num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE id >1"));
   if($num_true >= 5) {
     echo "There are already 5 Crew Slots!";
     } else {
          $num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE name='$familyname'"));
     if($num_true >= 1) {
            echo "There is already a Family with that name!";
       } else {
            function change($msg) {
         $post = $msg;
         $post = str_replace("'", "`", $post);
         return $post;
         }

Hi

 

Reformatted using tabs for indentation (my preference). Not indented the HTML (would take too long now).

 

Also added the missing close curley brace.

 

<?php
session_start();

if(!(isset($_SESSION["real_name"]))) 
{
//echo "I'm not logged in";
header('Location: index.php');
} 
else 
{
echo "";
}
?>
<html>
<head>
<title>Mafia Syndicate BETA .::. Families</title>
<link REL="stylesheet" TYPE="text/css" HREF="main.css">
<script language=javascript src=Menus.js></script>
</head>

<body background="wallpaper.jpg">
<center>
<table border="0" cellspacing="0" cellpadding="0" align="center" width="95%" class="cat">
<TR>
<TD width="150" background="tdbg3.jpg" bgcolor="#222222" valign="top"><?php include("leftmenu.php");?></TD>
<td width="100%" valign="top"><br>
<?php
$fetch=mysql_fetch_object(mysql_query("SELECT * FROM crews WHERE name='$crew' LIMIT 1"));

////CREATE CREW/////
if($_POST['createfamily'] && $_POST['familyname']) 
{
$familyname == $_POST['familyname'];
if($rankpoints <= 140109) 
{
	echo "You must be Underboss before you can make a crew!";
} 
else 
{
	if($crewlevel==0) 
	{
		$finalcash = $cash - 500000000000 ;
		if($finalcash <0) 
		{
			echo "You do not have enough cash!";
		} 
		elseif($finalcash >=0) 
		{
			$num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE id >1"));
			if($num_true >= 5) 
			{
				echo "There are already 5 Crew Slots!";
			} 
			else 
			{
				$num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE name='$familyname'"));
				if($num_true >= 1) 
				{
					echo "There is already a Family with that name!";
				} 
				else 
				{
					function change($msg) 
					{
						$post = $msg;
						$post = str_replace("'", "`", $post);
						return $post;
					}
					$new=change($crewname);
					mysql_query("INSERT INTO `family` ( `id` , `owner` , `name` , `bank` , `quote` , `news` , `slot` ) VALUES ('', '$username', '$new', '0', 'No Quote!', 'You have no family news8)', '50')");
					mysql_query("UPDATE users SET famlevel='9' WHERE username='$username'");
					mysql_query("UPDATE users SET cash='$finalcash', family='$new'  WHERE username='$username'");
					mysql_query("INSERT INTO `logs` ( `id` , `who` , `action` , `date` , `ip` ) VALUES ('', '$username', 'Bought a Family called <b>$new</b>!', '$date', '$realip')");
					echo "You have created the Family <b>$new!</b>";
				}
			}
		}
	}
}
}

if($_POST['cancelapply']) 
{
mysql_query("DELETE FROM famreq WHERE username='$username'");
echo "You have cancelled your application!";
}


/////END OF CREATE CREW!!!/////

if(famlevel >= 2);
if($_POST['inviteuser'] && strip_tags($_POST['inviteusername'])) 
{
$sql2="SELECT * from famreq WHERE username='$username'";
$result2=mysql_query($sql2);
$num_true=mysql_num_rows($result2);
if($num_true >= 1) 
{
	echo "You have already pending Family request!";
} 
elseif($num_true <=1) 
{
	$crewnamejoin = $_POST['inviteusername'];
	$crewnamejoin = strip_tags($inviteusername);
	$sql="SELECT * FROM users WHERE username='$username'";
	$result=mysql_query($sql);
	if($_POST['acceptinvite']) 
	{
		$sql="SELECT * from famreq WHERE family='$famid'";
		$result=mysql_query($sql);
		mysql_query("INSERT INTO `famreq` ( `id` , `famid` , `username` , `status` , `f` ) VALUES ('', '$invitedusername', '$username', '$status', '$f' )");
		echo "You have requested $invitedusername to join your family!";
	}
}
}
if($_POST['leave'] && $famlevel >=2 && $famlevel <7)
{
if($famlevel <= 0) 
{
	echo "You are not in a Family!";
} 
else 
{
	if($famlevel >= 4) 
	{
		echo "You can not leave your family!";
		if($_POST['change'] && strip_tags($_POST['newfamname']) && strip_tags($_POST['famid']) && $userlevel >=10) 
		{
			$newcrewname = $_POST['newfamname'];
			$newcrewname = strip_tags($newfamname);
			$crewid = $_POST['famid'];
			$crewid = strip_tags($famid);
			$sql="SELECT * from family WHERE id='$famid'";
			$result=mysql_query($sql);
			while($rows=mysql_fetch_array($result)) 
			{ // Start looping table row
				$oname = $rows['name'];
			}
			$num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE name='$newfamname'"));
			if($num_true >= 1) 
			{
			echo "There is already a family with that name!";
			} 
			else 
			{
				function change($msg) 
				{
					$post = $msg;
					$post = str_replace("'", "`", $post);
					return $post;
				}
				$newfamname=change($newfamame);
				mysql_query("UPDATE users SET famname='$newfamname' WHERE famname='$oname'");
				mysql_query("UPDATE famreq SET famid='$newfamname' WHERE famid='$oname'");
				mysql_query("UPDATE forum_answer SET place='$newfamname' WHERE place='$oname'");
				mysql_query("UPDATE forum_question SET place='$newfamname' WHERE place='$oname'");
				mysql_query("UPDATE family_donations SET fam='$newfamname' WHERE famname='$oname'");
				mysql_query("UPDATE family SET famname='$newfamname' WHERE id='$crewid'");
				mysql_query("UPDATE BG SET crew='$newfamname' WHERE crew='$oname'");
				echo "You changed the family $oname to $newfamname!";
			}
		}
		if($_POST['dropfam'] && strip_tags($_POST['famnamedrop']) && $userlevel >=15) 
		{
			$crewnamedrop = $_POST['famnamedrop'];
			$crewnamedrop = strip_tags($famnamedrop);
			mysql_query("DELETE FROM crews WHERE name='$crewnamedrop'");
			mysql_query("UPDATE users SET crewlevel='0', crew='None' WHERE crew='$crewnamedrop'");
			mysql_query("DELETE FROM crewapply WHERE crew='$crewnamedrop'");
			mysql_query("DELETE FROM forum_answer WHERE place='$crewnamedrop'");
			mysql_query("DELETE FROM forum_question WHERE place='$crewnamedrop'");
			mysql_query("DELETE FROM crew_donations WHERE place='$crewnamedrop'");
			echo "You have droped <b>$crewnamedrop</b>!";
		}
		if($_POST['acceptbg']) 
		{
			mysql_query("UPDATE BG SET status='Accepted' WHERE bg='$username' AND status='Pending'");
			echo "You are now a bodyguard";
		}
		if($_POST['acceptbg2']) 
		{
			mysql_query("UPDATE BG SET status='Accepted' WHERE bg='$username' AND status='Pending'");
			echo "You are now a bodyguard!";
		}
		if($_POST['upgrade'] && $famlevel >=7 && $fetch->slot <500) 
		{
			if($fetch->slot ==75) 
			{
				$next=125; $upgradecost=10000000000;
			} 
			elseif($fetch->slot ==125) 
			{
				$next=200; $upgradecost=150000000000;
			} 
			elseif($fetch->slot ==200) 
			{
				$next=300; $upgradecost=20000000000;
			} 
			elseif($fetch->slot ==300) 
			{
				$next=500; $upgradecost=30000000000;
			}
			$newcash = $cash - $upgradecost;
			if($newcash <0) 
			{
				echo "You do not have enough cash to upgrade!";
			} 
			else 
			{
				mysql_query("UPDATE family SET slot='$next' WHERE name='$name' AND owner='$username'");
				mysql_query("UPDATE users SET cash=cash-'$upgradecost' WHERE username='$username' AND family='$famname'");
				echo "Your Family size is now <b>$next</b>!";
			}
		}
		?>
		<table border="1" class="sub2" align="center" cellspacing="0" cellpadding="1" bordercolor=black width=81%>
		<tr>
		<td align="center" colspan="5" class="header">Crews</td>
		</tr>
		<?php
		include "includes/db_connect.php";
		$sql="SELECT * FROM family ORDER by id ASC";
		$result=mysql_query($sql);
		while($rows=mysql_fetch_array($result)) 
		{ // Start looping table row
			$name=$rows['owner'];
			$famname=$rows['id'];
			$famname2=$rows['name'];
			$sql2="SELECT * from users WHERE family='$famname2'";
			$result2=mysql_query($sql2);
			$num=mysql_num_rows($result2);
			?>
			<tr>
			<td width="70%"><a href="viewcrewprofile.php?viewcrew=<?php echo $famname ?>"><?php echo $rows['name']; ?></a></td>
			<td width="20%"><a href="viewprofile.php?viewuser=<?php echo $name ?>"><?php echo $rows['owner']; ?></a></td>
			<td width="10%"><?php echo "$num"; ?></td>
			</tr>
			<?php
		}
		?>
		<tr>
		<td colspan="5" align="right">
		<?php
		$num_true=mysql_num_rows(mysql_query("SELECT * FROM family WHERE id >1"));
		echo "$num_true";
		?>
		/5 Families
		</td>
		</tr>
		</table>
		<br><br>
		<td>
		<?php
		$sql2="SELECT * from famreq WHERE famid='$famid' AND status='Pending'";
		$result2=mysql_query($sql2);
		$num_true=mysql_num_rows($result2);
		echo "$num_true";
		?>
		</td>
		<td align="center"><input type="submit" name="acceptreq" value="Accept"></td>
		<tr>
		<td class="header" colspan="2" align="center">Create Crew </td>
		</tr>
		<tr>
		<td><p><font color="blue"><b>Making a family will Cost $500,000,000,000.  You must be ranked Underboss + to make a Family.</b></font></p></td>
		</tr>
		<tr>
		<td width="92%" bgcolor="#3c3025" border="0"><center>Crew Name:<br><input type="text" style="border:1px solid black;" name="familyname"><br><br><input type="submit" value="Create Family" name="createfamily"></center></td>
		</tr>
		<?php
		$num_true=mysql_num_rows(mysql_query("SELECT * FROM famreq WHERE username='$username'"));
		if($num_true == 1) 
		{
			?>
			<tr>
			<td class="header" colspan="2" align="center">Pending Application</td>
			</tr>
			<?php
			include "includes/db_connect.php";
			$sql="SELECT * FROM famreq WHERE username='$username'";
			$result=mysql_query($sql);
			while($rows=mysql_fetch_array($result)) 
			{ // Start looping table row
				?>
				<tr>
				<td colspan="2" align="center">You have requested <b><?php echo $username; ?></b><br><br><input type="submit" value="Cancel Application" name="cancelapply"></td>
				</tr>
				<?php
			}
		}
		?>
		</table></form>
		<?php
	}
	?>
	<br>

	<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
	<?php
	$num_true=mysql_num_rows(mysql_query("SELECT * FROM BG WHERE bg='$username' AND status='Pending' AND crew=''"));
	if($num_true >= 1)
	{
		?>
		<tr>
		</tr>
		<?php
		$sql="SELECT * FROM BG WHERE bg='$username' AND crew=''";
		$result=mysql_query($sql);
		while($rows=mysql_fetch_array($result)) 
		{ // Start looping table row
			?>
			<tr>
			</tr>
			<?php
		}
	}
	?>
	</table>
	<br>
	<?php
	if($famlevel >= 0) 
	{
		?>
		<form method="post" action="">
		<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
		<?php
		$num_true=mysql_num_rows(mysql_query("SELECT * FROM BG WHERE bg='$username' AND status='Pending'"));
		if($num_true >= 1) 
		{
			?>
			<tr>
			<td class="header" colspan="2" align="center">Bodyguard Invitation</td>
			</tr>
			<?php
			$sql="SELECT * FROM BG WHERE bg='$username'";
			$result=mysql_query($sql);
			while($rows=mysql_fetch_array($result)) 
			{ // Start looping table row
				?>
				<tr>
				<td colspan="2" align="center">You have been invited to be a bodyguard!<br><input type="submit" value="Accept" name="acceptbg"></td>
				</tr>
				<?php
			}
		}
		?>
		</table>
		<br>
		<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
		<tr>
		<td class="header" colspan="2" align="center">Leave Crew</td>
		</tr>
		<tr>
		<td colspan="2" align="center"><font color="red"><b>Note: Leaving crew can result in you losing up to 85% health</b></font><br><br><input type="submit" value="Leave Crew" name="leave"></td>
		</tr>
		<?php
		if($crewlevel >=7 && $fetch->slot <200) 
		{
			?>
			<tr>
			<td class="header" colspan="2" align="center">Upgrade Crew Size</td>
			</tr>
			<tr>
			<td align="center">
			<?php
			if($fetch->slot ==50) 
			{
			$next=75; $upgradecost=100000000;
			}
			if($fetch->slot ==75) 
			{
				$next=125; $upgradecost=1250000000;
			} 
			elseif($fetch->slot ==125) 
			{
				$next=200; $upgradecost=1500000000;
			} 
			elseif($fetch->slot ==200) 
			{
				$next=300; $upgradecost=3000000000;
			} 
			elseif($fetch->slot ==300) 
			{
				$next=500; $upgradecost=5000000000;
			}
			?>
			Your Families current size is <b><?php echo $fetch->slot ; ?></b>, it will cost $<?php echo number_format($upgradecost); ?> to upgrade it to <?php echo $next ;?>.<br>
			<input type="submit" name="upgrade" value="Upgrade">
			</td>
			</tr>
			<?php
		}
		?>
		</table>
		<?php
	}
	?>
	</form>
	<?php
	if($userlevel >= 5) 
	{
		?>
		<form method="post" action="">
		<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
		<tr>
		<td class="header" colspan="2" align="center">Change Family Name</td>
		</tr>
		<tr>
		<td width="90%" align="center">Family ID:<br><input style="border:1px solid black;" type="text" name="famid"><br></td>
		</tr>
		<tr>
		<td align="center">New family Name:<br><input type="text" style="border:1px solid black;" name="newfamname"><br><br>
		<input type="submit" value="Change" name="change">	  </td>
		</tr>
		</table>
		</form>
		<br><br>
		<?php
	}
	if($userlevel >= 15) 
	{
		?>
		<form method="post" action="">
		<table border="1" cellspacing="0" cellpadding="2" bordercolor="black" align="center" width="30%" class="sub2">
		<tr>
		<td class="header" colspan="2" align="center">Drop Family</td>
		</tr>
		<tr>
		<td width="90%" align="center"><br><center><select name="famnamedrop">
		<?php
		include "includes/db_connect.php";
		$sql="SELECT * FROM family ORDER by id";
		$result=mysql_query($sql);
		while($rows=mysql_fetch_array($result)) 
		{ // Start looping table row
			?>
			<option><?php echo $rows['name']; ?></option>
			<?php
		}
		?>
		</select>
		<br><br>
		<input type="submit" value="Drop Family" name="dropfamily"></center>
		</td>
		</tr>
		</table>
		</form>
		<?php
	}
	?>
	<br><br></td>
	<TD width="150" valign="top">
	<?php include("rightmenu.php");?>
	</TD>
	</TR>
	</table>
	<?php
}
}
?>
</center>
</body>
</html>

 

All the best

 

Keith

This thread is more than a year old. Please don't revive it unless you have something important to add.

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

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.