Jump to content

Heed Help On This Error


welshy123

Recommended Posts

Hello Guys And Girls I Just Need A Little Help On This Error.. Its Comes Up When Load My Website In Browser..

 

Parse error: syntax error, unexpected T_STRING in /home/mafiamur/public_html/index.php on line 25

 

Here Is The Link To My Website SO U Can Look For Your Self http://www.mafia-murderz.co.uk

 

You Will Make A Man Verry Happy If This Can Be Solved..

 

Thanks

 

Welshy123

Link to comment
https://forums.phpfreaks.com/topic/176424-heed-help-on-this-error/
Share on other sites

<?php

session_start();

include_once("includes/db_connect.php");

if (strip_tags($_GET['logout']) == "yes"){

session_destroy();

}elseif (isset($_SESSION['real_name'])){

header("Location: Updates.php");

exit();

}

 

 

if ($_POST['Submit'] && strip_tags($_POST['username']) && strip_tags($_POST['password'])){

$username = $_POST['username'];

$password = $_POST['password'];

$username = strip_tags($username);

$password = strip_tags($password);

$ip = $REMOTE_ADDR;

 

 

$date = gmdate('Y-m-d h:i:s');

 

 

///check INFO

$sql = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password' LIMIT 1");

$login_check = mysql num rows($sql);

$inf = mysql fetch object($sql);

 

if ($login_check > "0"){

if ($inf->status == "Dead"){

include_once"dead.php";

exit();

 

$timenow=time();

$online = time() - 300; //the current time minus 300 seconds

$select = mysql_query("SELECT * FROM users WHERE onlinetime2 >='$online' AND online='Online' ORDER by id ASC");

$num = mysql_num_rows($select);

$numfor=number_format($num);

 

}

        session_register('username');

        $_SESSION['real_name'] = $inf->username;

$_SESSION["userlevel"] = $inf->userlevel;

$_SESSION["crewlevel"] = $inf->crewlevel;

 

 

$realip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ?

$_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];     

 

  $time2 = time();   

     

        $timestamp = time()+60;

 

mysql_query("UPDATE users SET online='Online', onlinetime2='$time2' WHERE username='$username'");

       

mysql_query("INSERT INTO `logs` ( `id` , `who` , `action` , `date` , `ip` ) VALUES ('', '$username', 'Logged In!', '$date', '$realip')");

 

        header("Location: News.php");

 

} else {

    $message= "You could not be logged in.<br />";

 

}}

?>

 

<html>

  <head>

  <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">

<link REL="SHORTCUT ICON" type="image/ico" HREF="icon here">

  <meta name="author" content="Bigharry">

  <title>Mafia-Assassins</title>

  <link href="site_css.css" rel="stylesheet" type="text/css">

<script src="clienthint.js"></script>

  </head>

 

<body bgcolor="black" OnLoad="document.login.mail.focus();">

<div align="center">

 

  <strong><font color='red' face='verdana' size='1'> <br>

  <br>

  </font></strong>

  <table width="965" border="0" cellspacing="0" cellpadding="0">

    <tr>

      <td valign="bottom">

      <table width="965" border="0" cellspacing="0" cellpadding="0">

  <tr>

 

    <td width="349" valign="bottom">

<table width="349" border="0" cellspacing="0" cellpadding="0">

        <tr>

          <td width="23"><div align="center"><img src="banner.jpg" width="966" height="168"></div></td>

         

        </tr>

      </table>

    </td>

   

   

  </tr>

</table></td>

    </tr>

 

    <tr>

      <td>

        <table width="965" border="0" cellspacing="0" cellpadding="0">

          <tr>

            <td width="200" valign="top" class="home-side">

            <br>

<br> 

<div class="brown"><center>Major Updates</center></div>

<div align="left" class="mafia-game">

<li>Refferal System has been fixed and updated.<br><br>

 

<li>The game layout has been slightly updated.<br><br>

<li>A blackjack casino is being made.<br><br>

</div>

 

 

 

 

<div align="left" class="mafia-game">

</div></td>

            <td valign="top">

              <table border="0" cellspacing="0" cellpadding="0" width="565" height="302" class="home-pic1">

                <tr>

 

                  <td height="270" valign="top">

                    <table width="100%" border="0" cellpadding="0" cellspacing="0">

                      <tr>

                        <td height="168" valign="top"> <br>

                          <p class="home-text"><br>

                            <br>

                            <a href="Register2.php"><strong></strong></a>

                            <font size="-2"></font></p>

                          <strong><font color='red' face='verdana' size='1'>     </font></strong></td>

 

  </tr>

  <tr>

                        <td valign="bottom">

 

<table width="100%" border="0" cellspacing="0" cellpadding="0">

  <tr>

    <td>

 

<form id="form1" name="form1" method="post" action="index.php">

 

 

 

<div style="padding: 10px 0 0 400px;">

 

                      <input name="username" type="text" class="input-home" id="username" size="15" maxlength="35">

 

<br>

<br>

                      <input name="password" type="password" id="password2" class="input-home" size="15" maxlength="35">

<br>

                      <input type="submit" name="Submit" value="Login">

</div>

 

</form> </td>

 

  </tr>

</table></td>

  </tr>

 

</table>

<br>

<br>

<br>

<br>

<br>

<center>

<body style="margin: 0px" bgcolor="black" vlink="black" alink="black">

 

</body></center>

</td></tr></table>         

 

 

            <td width="200" valign="top" class="home-side">

 

           

<div class="mafia-game">

<br>

 

<div class="brown">Need help playing?</div><br>

  We have added a guide to help new users to the game or users that are new to the mafia life.<br>

 

  <strong><br>

  </strong><br>

    </div></td>

          </tr><div align="center" class="style"><a href="lost_pass.php">Lost Password </a><label> :: </label><a href="Register2.php"> Register </a><label> :: </label><a href="tos.php"> Terms of Service </a>

 

<br>

<br>

<br>

<font color="lime"><b>Mafia-Assassins is Open.</b></font></div></center>

        </table>

 

 

 

     

 

 

     

        </td>

    </tr>

    <tr>

      <td>

 

 

</script></body>

</html>

Il take a look at the coding, give me a few minutes.

Next time please post it in these tags:

 

[code=php:0]

<?php
session_start();
include_once("includes/db_connect.php");
if (strip_tags($_GET['logout']) == "yes"){
session_destroy();
}elseif (isset($_SESSION['real_name'])){
header("Location: Updates.php");
exit();
}


if ($_POST['Submit'] && strip_tags($_POST['username']) && strip_tags($_POST['password'])){
$username = $_POST['username'];
$password = $_POST['password'];
$username = strip_tags($username);
$password = strip_tags($password);
$ip = $REMOTE_ADDR;


$date = gmdate('Y-m-d h:i:s');


///check INFO
$sql = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password' LIMIT 1");
$login_check = mysql num rows($sql);
$inf = mysql fetch object($sql);

if ($login_check > "0"){
if ($inf->status == "Dead"){
include_once"dead.php";
exit();

$timenow=time();
$online = time() - 300; //the current time minus 300 seconds
$select = mysql_query("SELECT * FROM users WHERE onlinetime2 >='$online' AND online='Online' ORDER by id ASC");
$num = mysql_num_rows($select);
$numfor=number_format($num);

}
        session_register('username');
        $_SESSION['real_name'] = $inf->username;
      $_SESSION["userlevel"] = $inf->userlevel;
      $_SESSION["crewlevel"] = $inf->crewlevel;


$realip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ?
$_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];       

   $time2 = time();   
       
         $timestamp = time()+60;
      
mysql_query("UPDATE users SET online='Online', onlinetime2='$time2' WHERE username='$username'");
       
mysql_query("INSERT INTO `logs` ( `id` , `who` , `action` , `date` , `ip` ) VALUES ('', '$username', 'Logged In!', '$date', '$realip')");

        header("Location: News.php");
   
} else {
    $message= "You could not be logged in.<br />";

}}
?>

<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<link REL="SHORTCUT ICON" type="image/ico" HREF="icon here">
  <meta name="author" content="Bigharry">
  <title>Mafia-Assassins</title>
  <link href="site_css.css" rel="stylesheet" type="text/css">
<script src="clienthint.js"></script>
  </head>

<body bgcolor="black" OnLoad="document.login.mail.focus();">
<div align="center">

  <strong><font color='red' face='verdana' size='1'> <br>
  <br>
  </font></strong>
  <table width="965" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td valign="bottom">
      <table width="965" border="0" cellspacing="0" cellpadding="0">
  <tr>

    <td width="349" valign="bottom">
<table width="349" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="23"><div align="center"><img src="banner.jpg" width="966" height="168"></div></td>
         
        </tr>
      </table>
    </td>
   
   
  </tr>
</table></td>
    </tr>

    <tr>
      <td>
        <table width="965" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="200" valign="top" class="home-side">
             <br>
<br> 
<div class="brown"><center>Major Updates</center></div>
<div align="left" class="mafia-game">
<li>Refferal System has been fixed and updated.<br><br>

<li>The game layout has been slightly updated.<br><br>
<li>A blackjack casino is being made.<br><br>
</div>




<div align="left" class="mafia-game">
</div></td>
            <td valign="top">
              <table border="0" cellspacing="0" cellpadding="0" width="565" height="302" class="home-pic1">
                <tr>

                  <td height="270" valign="top">
                    <table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <tr>
                        <td height="168" valign="top"> <br>
                          <p class="home-text"><br>
                            <br>
                            <a href="Register2.php"><strong></strong></a>
                             <font size="-2"></font></p>
                          <strong><font color='red' face='verdana' size='1'>     </font></strong></td>

  </tr>
  <tr>
                        <td valign="bottom">
                  
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>

<form id="form1" name="form1" method="post" action="index.php">



<div style="padding: 10px 0 0 400px;">

                       <input name="username" type="text" class="input-home" id="username" size="15" maxlength="35">

<br>
<br>
                       <input name="password" type="password" id="password2" class="input-home" size="15" maxlength="35">
<br>
                       <input type="submit" name="Submit" value="Login">
</div>

       </form>       </td>

  </tr>
</table></td>
  </tr>

</table>
<br>
<br>
<br>
<br>
<br>
<center>
<body style="margin: 0px" bgcolor="black" vlink="black" alink="black">

</body></center>
</td></tr></table>         


            <td width="200" valign="top" class="home-side">

           
<div class="mafia-game">
<br>

<div class="brown">Need help playing?</div><br>
           We have added a guide to help new users to the game or users that are new to the mafia life.<br>
         
           <strong><br>
           </strong><br>
    </div></td>
          </tr><div align="center" class="style"><a href="lost_pass.php">Lost Password </a><label> :: </label><a href="Register2.php"> Register </a><label> :: </label><a href="tos.php"> Terms of Service </a>

<br>
<br>
<br>
<font color="lime"><b>Mafia-Assassins is Open.</b></font></div></center>
        </table>



       


     
        </td>
    </tr>
    <tr>
      <td>


</script></body>
</html>

[/code]

 

Fixed:

Changed this:

$login_check = mysql num rows($sql);
$inf = mysql fetch object($sql);

to

$login_check = mysql_num_rows($sql);
$inf = mysql_fetch_object($sql);

You basically forgot the underlines _

 

 

Fully fixed code:

<?php
session_start();
include_once("includes/db_connect.php");
if (strip_tags($_GET['logout']) == "yes"){
session_destroy();
}elseif (isset($_SESSION['real_name'])){
header("Location: Updates.php");
exit();
}
if ($_POST['Submit'] && strip_tags($_POST['username']) && strip_tags($_POST['password'])){
$username = $_POST['username'];
$password = $_POST['password'];
$username = strip_tags($username);
$password = strip_tags($password);
$ip = $REMOTE_ADDR;
$date = gmdate('Y-m-d h:i:s');
///check INFO
$sql = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password' LIMIT 1");
$login_check = mysql_num_rows($sql);
$inf = mysql_fetch_object($sql);
if ($login_check > "0"){
if ($inf->status == "Dead")
{
include_once"dead.php";
exit();
$timenow=time();
$online = time() - 300; //the current time minus 300 seconds
$select = mysql_query("SELECT * FROM users WHERE onlinetime2 >='$online' AND online='Online' ORDER by id ASC");
$num = mysql_num_rows($select);
$numfor=number_format($num);
}
        session_register('username');
        $_SESSION['real_name'] = $inf->username;
      $_SESSION["userlevel"] = $inf->userlevel;
      $_SESSION["crewlevel"] = $inf->crewlevel;
$realip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ?
$_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];       

   $time2 = time();   
       
         $timestamp = time()+60;
      
mysql_query("UPDATE users SET online='Online', onlinetime2='$time2' WHERE username='$username'");
       
mysql_query("INSERT INTO `logs` ( `id` , `who` , `action` , `date` , `ip` ) VALUES ('', '$username', 'Logged In!', '$date', '$realip')");

        header("Location: News.php");
   
} else {
    $message= "You could not be logged in.<br />";

}}
?>

<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<link REL="SHORTCUT ICON" type="image/ico" HREF="icon here">
  <meta name="author" content="Bigharry">
  <title>Mafia-Assassins</title>
  <link href="site_css.css" rel="stylesheet" type="text/css">
<script src="clienthint.js"></script>
  </head>

<body bgcolor="black" OnLoad="document.login.mail.focus();">
<div align="center">

  <strong><font color='red' face='verdana' size='1'> <br>
  <br>
  </font></strong>
  <table width="965" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td valign="bottom">
      <table width="965" border="0" cellspacing="0" cellpadding="0">
  <tr>

    <td width="349" valign="bottom">
<table width="349" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="23"><div align="center"><img src="banner.jpg" width="966" height="168"></div></td>
         
        </tr>
      </table>
    </td>
   
   
  </tr>
</table></td>
    </tr>

    <tr>
      <td>
        <table width="965" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="200" valign="top" class="home-side">
             <br>
<br> 
<div class="brown"><center>Major Updates</center></div>
<div align="left" class="mafia-game">
<li>Refferal System has been fixed and updated.<br><br>

<li>The game layout has been slightly updated.<br><br>
<li>A blackjack casino is being made.<br><br>
</div>




<div align="left" class="mafia-game">
</div></td>
            <td valign="top">
              <table border="0" cellspacing="0" cellpadding="0" width="565" height="302" class="home-pic1">
                <tr>

                  <td height="270" valign="top">
                    <table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <tr>
                        <td height="168" valign="top"> <br>
                          <p class="home-text"><br>
                            <br>
                            <a href="Register2.php"><strong></strong></a>
                             <font size="-2"></font></p>
                          <strong><font color='red' face='verdana' size='1'>     </font></strong></td>

  </tr>
  <tr>
                        <td valign="bottom">
                  
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>

<form id="form1" name="form1" method="post" action="index.php">



<div style="padding: 10px 0 0 400px;">

                       <input name="username" type="text" class="input-home" id="username" size="15" maxlength="35">

<br>
<br>
                       <input name="password" type="password" id="password2" class="input-home" size="15" maxlength="35">
<br>
                       <input type="submit" name="Submit" value="Login">
</div>

       </form>       </td>

  </tr>
</table></td>
  </tr>

</table>
<br>
<br>
<br>
<br>
<br>
<center>
<body style="margin: 0px" bgcolor="black" vlink="black" alink="black">

</body></center>
</td></tr></table>         


            <td width="200" valign="top" class="home-side">

           
<div class="mafia-game">
<br>

<div class="brown">Need help playing?</div><br>
           We have added a guide to help new users to the game or users that are new to the mafia life.<br>
         
           <strong><br>
           </strong><br>
    </div></td>
          </tr><div align="center" class="style"><a href="lost_pass.php">Lost Password </a><label> :: </label><a href="Register2.php"> Register </a><label> :: </label><a href="tos.php"> Terms of Service </a>

<br>
<br>
<br>
<font color="lime"><b>Mafia-Assassins is Open.</b></font></div></center>
        </table>



       


     
        </td>
    </tr>
    <tr>
      <td>


</script></body>
</html>

 

No problems at all. :)

yeh thats sorted it thanks :D

 

im getting another error in the game part now lol. kill.php

Sorry Bout This M8 :D

 

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mafiamur/public_html/kill.php on line 62

 

 

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/mafiamur/public_html/kill.php on line 506

 

 

Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home/mafiamur/public_html/kill.php on line 512

 

 

<?
session_start();  

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


?>



<html>
<head>
<title>Mafia-Assassins :: Kill</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>	



<?	

include_once "includes/db_connect.php";
include_once"includes/functions.php";
include_once "includes/jail_check.php";
include_once "includes/hospital_check.php";

$username=$_SESSION['real_name'];

$select2 = mysql_query("SELECT * FROM jail WHERE username='$username'");
$num2 = mysql_num_rows($select2);

if ($num2 <=0){

$select2 = mysql_query("SELECT * FROM hospital WHERE username='$username'");
$num2 = mysql_num_rows($select2);

if ($num2 <=0){

$sql="SELECT * from search WHERE username='$username'";
$result=mysql_query($sql);

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

$timeleft = $rows['time'];
$target = $rows['target'];
$id = $rows['id'];
$status = $rows['status'];
$hours = $rows['hours'];


$time=time();
$safe=mysql_num_rows(mysql_query("SELECT * FROM safe WHERE username='$a->target' AND time > '$time'"));

$timecheck = $timeleft - time() ;

if ($timecheck <0 && $status < 2 && $hours < 4){
mysql_query("UPDATE search SET status='1' WHERE id='$id'");
}elseif($timecheck <0 && $hours >=4 || $userlevel >=15){

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

while($rows2=mysql_fetch_array($result2)){ // Start looping table row  

$target_country = $rows2['country'];
}

mysql_query("UPDATE search SET status='2', location='$target_country' WHERE id='$id'");

}

}


if(strip_tags($_GET['dl'])){
$check=mysql_num_rows(mysql_query("SELECT * FROM search WHERE id='$dl' AND username='$username'"));
if ($check !="0"){
mysql_query("DELETE FROM search WHERE id='$dl'");
echo "Search deleted!";
}}


if (strip_tags($_POST['kill']) && strip_tags($_POST['kill_name']) && strip_tags($_POST['kill_bullets'])){

$kill_name = $_POST['kill_name'];
$kill_name = strip_tags($kill_name);
$kill_bullets = $_POST['kill_bullets'];
$kill_bullets = strip_tags($kill_bullets);

$target=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$kill_name'"));
$fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'"));

if ($kill_bullets == 0 || !$kill_bullets || ereg('[^0-9]',$kill_bullets)){
echo "You cannot shoot that amount!";

}elseif ($kill_bullets != 0 || $kill_bullets || !ereg('[^0-9]',$kill_bullets)){

$user_true=mysql_num_rows(mysql_query("SELECT * FROM users WHERE username='$kill_name'"));

if ($user_true == "0"){
echo"This user does not excist!";
}elseif ($user_true != "0"){

if ($kill_bullets > $bullets){

echo "You dont have that amount of bullets!";

}elseif($kill_bullets <= $bullets){

if ($target->userlevel >=10 && $userlevel <15){

echo "You can not kill a staff member!";

}else{


if ($nextshoot >= time()){

echo "You have to wait until you can make your next kill!";

}else{

if (strtolower($target->username) == strtolower("ChrisStrydes") && $missionid == 2){

$rand = rand(8000,10000);
$rand2 = rand($rand,13000);
$rand3 = rand(10,55);

if ($kill_bullets >= $rand){

$newadd = rand(3000000,5333333);
$newadd2 = number_format($newadd);

mysql_query("UPDATE users SET `mission`=`mission`+'1', `cash`=`cash`+'$newadd', bullets=bullets-'$kill_bullets' WHERE username='$username'");
mysql_query("UPDATE users SET mail='1', bullets=bullets+'$rand2' WHERE username='$username'");
$rand2 = number_format($rand);

mysql_query("INSERT INTO `messages` ( `id` , `t` , `f` , `message` , `date` , `r` , `saved` ) VALUES (
'', '$username', '$username', 'You recieved <b>$$newadd2</b> and <b>$rand2</b> bullets from rescuing the president pt2, please check missions for your next mission!', '$date', '0', '0')");
mysql_query("INSERT INTO `logs` ( `id` , `who` , `action` , `date` , `ip` ) VALUES ('', '$username', 'Recieved $<b>$newadd2</b> from the second mission!', '$date, '$realip')");


echo "You shot at <b>ChrisStrydes</b>, He died from the shots!";
}else{

mysql_query("UPDATE users SET bullets=bullets-'$kill_bullets', health='$rand3' WHERE username='$username'");

echo "You shot at <b>ChrisStrydes</b>, He survived from the shots. He shot back at you!";

}

}else{

if ($target->missioncharc >=1){

echo "You can not kill a mission character!";

}else{

if ($target->status == "Dead" || $target->status == "Banned"){
echo "That user is already dead!";

}elseif ($target->status != "Dead" && $target->status != "Banned"){

$a_query = mysql_query("SELECT * FROM search WHERE target='$kill_name' AND status='2' AND username='$username'");
$check_found=mysql_num_rows($a_query);

if ($check_found == "0"){
echo "You have not found this user yet or they have traveled to another location!";

}else{

$a_query = mysql_query("SELECT * FROM BG WHERE username='$kill_name'");
$check_found=mysql_num_rows($a_query);

if ($check_found >= 1 && $target->bglevel >=1 || $check_found >= 1 && $target->nbglevel >=1){

$bg = mysql_query("SELECT * FROM BG WHERE status='Accepted' AND username='$kill_name' ORDER by id ASC LIMIT 1");
while ($i = mysql_fetch_object($bg)){

$bg1 = $i->bg;
}

echo "This user has a bodyguard called <b>$bg1</b>, you need to kill <b>$bg1</b> before you can kill <b>$kill_name</b>!";

}else{


if ($target->last_attempted > time()){
echo "This target is still recovering!";
}else{
if (strtolower($username) == strtolower($kill_name)){
echo "You cannot kill yourself!";
}elseif(strtolower($username) != strtolower($kill_name)){

if ($fetch->gun == "None"){ 
echo "How do you expect to kill someone without no weapon!";
}elseif($fetch->gun != "None"){ 
if ($fetch->country != $target->country){
echo "You need to be in the same country as this user.";
}elseif ($fetch->country == $target->country){

$target=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$kill_name'"));
$fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'"));

if ($rank == "Minor"){ $killerranking="1";}
elseif ($rank == "Wasteman"){ $killerranking="2";}
elseif ($rank == "Thug"){ $killerranking="3";}
elseif ($rank == "Badman"){ $killerranking="4";}
elseif ($rank == "Respectable Badman"){ $killerranking="5";}
elseif ($rank == "Assassin"){ $killerranking="6";}
elseif ($rank == "Respectable Assassin"){ $killerranking="7";}
elseif ($rank == "Boss"){ $killerranking="8";}
elseif ($rank == "Respectable Boss"){ $killerranking="9";}
elseif ($rank == "Godfather"){ $killerranking="10";}
elseif ($rank == "Legendary Godfather"){ $killerranking="11";}
elseif ($rank == "Don"){ $killerranking="12";}
elseif ($rank == "Respectable Don"){ $killerranking="13";}
elseif ($rank == "Global Threat"){ $killerranking="14";}
elseif ($rank == "Ultimate Assassinator"){ $killerranking="15";}

if ($target->rank  == "Minor"){$victimranking="1";}
elseif ($target->rank == "Wasteman"){$victimranking="2";}
elseif ($target->rank == "Thug"){$victimranking="3";}
elseif ($target->rank == "Badman"){$victimranking="4";}
elseif ($target->rank == "Respectable Badman"){$victimranking="5";}
elseif ($target->rank == "Assassin"){$victimranking="6";}
elseif ($target->rank == "Respectable Assassin"){$victimranking="7";}
elseif ($target->rank == "Boss"){$victimranking="8";}
elseif ($target->rank == "Respectable Boss"){$victimranking="9";}
elseif ($target->rank == "Godfather"){$victimranking="10";}
elseif ($target->rank == "Legendary Godfather"){$victimranking="11";}
elseif ($target->rank == "Don"){$victimranking="12";}
elseif ($target->rank == "Respectable Don"){$victimranking="13";}
elseif ($target->rank == "Global Threat"){$victimranking="14";}
elseif ($target->rank == "Ultimate Assassinator"){$victimranking="15";}


$killerrank = $killerranking+1;
$victemrank1 = $victimranking+1;
$victemrank = $victemrank1*2;
$killergun = $fetch->gunid+1;
$victemprotection1 = $target->protectionid+1;
$victemprotection = $victemprotection1/2;
$killerstat = $killerrank*$killergun;
$victemstat = $victemrank*$victemprotection;
$bothstat = $victemstat/$killerstat;
$killneeded = $bothstat*174;
$percentdamage = round($kill_bullets/$killneeded);
$cashadd=rand(5,19);
$percent = $target->bullets * $cashadd; 
$percentadd = $percent / 100 ;
$add =3600*3;
$last=time()+$add;

$time=gmdate('Y-m-d h:i:s'); 

//print"<br>$defense - $power<br>";

$new_bullets=$fetch->bullets - $kill_bullets;
if($target->health<=$percentdamage){ 
$now=time()+3600;
$date = gmdate('Y-m-d h:i:s');
$last=time()+(3600*2);
$kill_bullets2=number_format($kill_bullets);
$hit_money=mysql_fetch_object(mysql_query("SELECT SUM(amount)AS jackpot FROM hitlist WHERE target='$target->username'"));

$your_money=$fetch->cash + $hit_money->jackpot;
echo "You shot at <b>$kill_name</b> he died from the shots, you received $cashadd% of this user's bullets!"; 

mysql_query("DELETE FROM BG WHERE bg='$target->username'");
mysql_query("UPDATE users SET status='Dead', last_attempted='$last', killer='Got Killed by <b>$username</b> with $kill_bullets2 bullets!' WHERE username='$kill_name' LIMIT 1");
mysql_query("UPDATE users SET bullets=bullets-'$kill_bullets', cash=cash+'$hit_money->jackpot',`totalkills`=`totalkills`+'1', `bullets`=`bullets`+'$percentadd' WHERE username='$username' AND bullets >= '$kill_bullets' LIMIT 1");
mysql_query("DELETE FROM hitlist WHERE target='$target->username'");
mysql_query("INSERT INTO `attempts` (`id`, `username`, `target`, `outcome`, `date`) VALUES ('', '$username', '$target->username', 'Dead', '$date')");
mysql_query("INSERT INTO `logs` ( `id` , `who` , `action` , `date` , `ip` ) VALUES ('', '$username', 'Killed <b>$target->username</b> with $kill_bullets2 bullets and received $percentadd bullets!', '$date, '$realip')");

$select = mysql_query("SELECT * FROM crews WHERE owner='$kill_name'");
$num = mysql_num_rows($select);

if ($num > 0){

$rhm = mysql_query("SELECT * FROM users WHERE crew ='$target->crew' AND status='Alive' AND userlevel <5 ORDER by rankpoints DESC LIMIT 1");
while ($i = mysql_fetch_object($rhm)){

$rhm1 = $i->username;
}
$rhmnum = mysql_num_rows($rhm);

if ($rhmnum==0){

mysql_query("DELETE FROM crews WHERE owner='$kill_name'");
mysql_query("UPDATE users SET crewlevel='0', crew='None' WHERE crew='$target->crew'");
}else{
mysql_query("UPDATE crews SET owner='$rhm1' WHERE name='$target->crew' LIMIT 1");
mysql_query("UPDATE users SET crewlevel='9' WHERE username='$rhm1' LIMIT 1");
mysql_query("UPDATE users SET crewlevel='2' WHERE username='$kill_name' LIMIT 1");

}}
/////GIVE WITNESS STATEMENT/////

$witnessessent = 0;
while($witnessessent<={
$maxid = mysql_fetch_array(mysql_query("SELECT id FROM users WHERE health>0 AND online='Online' ORDER BY id DESC LIMIT 1"));
$randomuserid = rand(1,$maxid["id"]);
$tempvar1 =  mysql_query("SELECT username,id FROM users WHERE id='$randomuserid' LIMIT 1");
while($tempvar2 = mysql_fetch_array($tempvar1)){
$gettingname = $tempvar2["username"];
$touserid = $tempvar2["id"];
if($gettingname!=$username){

mysql_query("INSERT INTO `messages` ( `id` , `t` , `f` , `message` , `date` , `r` , `saved` ) VALUES (
'', '$gettingname', '$gettingname', 'You witnessed <b>$username</b> kill <b>$target->username</b>!', '$date', '0', '0')");

$witnessessent++;
}
}
}


///FAILED////
}else { echo "You shot at $kill_name he survived from the shots!"; 
$new_health_target=$target->health;
$it=$kill_bullets / 2;
$test= rand(5,50);
$new_health_target = $target->health - $test;
$ttt = 3600 * 5 ;
$failednext= time() + $ttt;
$now=time()+3600;
$add =3600*3;
$last=time()+$add;
$new_bullets=$fetch->bullets - $kill_bullets;
mysql_query("UPDATE users SET health=health-'$percentdamage', last_attempted='$last' WHERE username='$target->username'");
mysql_query("UPDATE users SET bullets=bullets-'$kill_bullets', nextshoot='$failednext' WHERE username='$username'");
mysql_query("INSERT INTO `attempts` (`id`, `username`, `target`, `outcome`, `date`) VALUES ('', '$username', '$target->username', 'Survived', '$date')");

}}

}}}}}}}}}}

}}

///Mission check///
}}
////


/////////CLASSING NEEDS TO GO IN THE BRACKET ABOVE



/////BASICALLY WHAT I NEED TO DO IS CLASS EACH WEAPON FOR A CERTIAN AMOUNT OF POINTS ADD THEM ALL UP THEN COMPARE THEM TO THE USERS DEFENCE SHIT ADDED UP.
/////tHEN DECIDE WETHER OR NOT TO KILL THEM.


if (strip_tags($_POST['find']) && strip_tags($_POST['find_name']) && strip_tags($_POST['find_time'])){

$find_name = $_POST['find_name'];
$find_name = strip_tags($find_name);
$find_time = $_POST['find_time'];
$find_time = strip_tags($find_time);

$target=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$find_name'"));


if ($find_time == 0 || !$find_time || ereg('[^0-9]',$find_time)){

echo "Invalid time!";

}elseif ($find_time != 0 || $find_time || !ereg('[^0-9]',$find_time)){


if (strtolower($find_name) == strtolower($username))
{

echo "You can not search for yourself!!";
}else{


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

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

$sendercash= $rows['cash'];
$level= $rows['userlevel'];
$clevel= $rows['crewlevel'];

}
if ($level >=10 && $userlevel <15){


echo "You can not search for a staff member!";

}else{

$num_true=mysql_num_rows($result);
if ($num_true == 0){
echo "No such user!"; 
}elseif ($num_true != 0){

$sql2="SELECT * from search WHERE target='$find_name' AND username='$username'";
$result2=mysql_query($sql2);

$num_true=mysql_num_rows($result2);
if ($num_true >= 1){
echo "You are already searching for this user!"; 
}elseif ($num_true <= 1){

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

$num_true2=mysql_num_rows($result2);

if ($num_true2 >= 3){
echo "You can not have more than 3 searches out!"; 
}else{

if ($target->missioncharc >=1 && $target->username!="ChrisStrydes"){

echo "You can not search for a mission character!";

}else{

$total_time=time()+(3600*$find_time);

mysql_query("INSERT INTO `search` (`id`, `username`, `target`, `time`, `status`, `location`, `hours`) VALUES ('', '$username', '$find_name', '$total_time', '0', '', '$find_time')");


echo "Searches are now out!";



}}}}}}}

///MISSION CHECK!
}
?>
      <br>
      <form action="" method="post">
<table border="1" class="sub2" align="center" cellspacing="0" cellpadding="2" bordercolor=black width=50%>
<tr>
<td align="center" colspan="5" class="header">Kill</td>
</tr>
<tr> 
<td width="25%">Name:</td>
<td width="75%">
<center><input name="kill_name" type="text" id="kill_name3" style="border:1px solid black;" size="20"></center></td>
</tr>
<tr> 
<td>Bullets:</td>
<td>
<center><input name="kill_bullets" type="text" id="kill_bullets3" style="border:1px solid black;" size="20"></center></td>
</tr>
<tr> 
<td align="center" colspan="5"><input name="kill" type="submit" id="kill_button3" value="Shoot" /></td>
</tr>
</table>
<br>
<br>
<table border="1" class="sub2" align="center" cellspacing="0" cellpadding="2" bordercolor=black width=50%>
<tr>
<td align="center" colspan="5" class="header">Search</td>
</tr>
<tr> 
<td width="25%" align="center">Find:</td>
<td align="center"><input name="find_name" type="text" id="find_name2" style="border:1px solid black;" size="20"></td>
</tr>
<tr> 
<td width="25%" align="center">Hours:</td>
<td align="center"><input name="find_time" type="text" id="find_time2" style="border:1px solid black;" size="20"></td>
</tr>
<tr> 
<td> </td>
<td align="right">
<input name="find" type="submit" id="hunt_button23" value="Search" /></td>
          </tr>
</table>
</form>
<br><br>
<table border="1" class="sub2" align="center" cellspacing="0" cellpadding="2" bordercolor=black width=50%>
<tr>
<td align="center" colspan="5" class="header">Searches Out</td>
</tr>
          <?php $my=mysql_query("SELECT * FROM search WHERE username='$username'");
	 $humm=mysql_num_rows($my);
	 if ($humm == "0"){
	 echo "<tr> 
            <td colspan=5><center>You currently have no searches!</center></td>
          </tr>";
	  }
	 while($i=mysql_fetch_object($my)){

echo "<tr>";
echo " <td width=20% height=10><a href='viewprofile.php?viewuser=$i->target'>$i->target</a></td>";
echo " <td width=60%>"; if ($i->status == "0"){ echo "".maketime($i->time).""; }elseif ($i->status == "1"){ echo "Not found"; }elseif ($i->status == "2"){ echo "The detective found $i->target in $i->location!"; } echo "</td>";
echo "<td width=20%><a href='?dl=$i->id'>Delete</a></td>";
echo "  </tr>";

	  }
	  ?>
</table>


<? 
//Hospital/Jail check

}} 

?>



</td>



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

</TR>


</table>

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

 

 

 

Try this:

 

<?
session_start(); 

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


?>



<html>
<head>
<title>Mafia-Assassins :: Kill</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>   

   
   
   <?   
   
include_once "includes/db_connect.php";
include_once"includes/functions.php";
include_once "includes/jail_check.php";
include_once "includes/hospital_check.php";

$username=$_SESSION['real_name'];

$select2 = mysql_query("SELECT * FROM jail WHERE username='$username'");
$num2 = mysql_num_rows($select2);

if ($num2 <=0){

$select2 = mysql_query("SELECT * FROM hospital WHERE username='$username'");
$num2 = mysql_num_rows($select2);

if ($num2 <=0){

$sql="SELECT * from search WHERE username='$username'";
$result=mysql_query($sql);

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

$timeleft = $rows['time'];
$target = $rows['target'];
$id = $rows['id'];
$status = $rows['status'];
$hours = $rows['hours'];


$time=time();
$safe=mysql_num_rows(mysql_query("SELECT * FROM safe WHERE username='$a->target' AND time > '$time'"));

$timecheck = $timeleft - time() ;

if ($timecheck <0 && $status < 2 && $hours < 4){
mysql_query("UPDATE search SET status='1' WHERE id='$id'");
}elseif($timecheck <0 && $hours >=4 || $userlevel >=15){

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

while($rows2=mysql_fetch_array($result2)){ // Start looping table row 

$target_country = $rows2['country'];
}

mysql_query("UPDATE search SET status='2', location='$target_country' WHERE id='$id'");

}

}


if(strip_tags($_GET['dl'])){
$check=mysql_num_rows(mysql_query("SELECT * FROM search WHERE id='$dl' AND username='$username'"));
if ($check !="0"){
mysql_query("DELETE FROM search WHERE id='$dl'");
echo "Search deleted!";
}}


if (strip_tags($_POST['kill']) && strip_tags($_POST['kill_name']) && strip_tags($_POST['kill_bullets'])){

$kill_name = $_POST['kill_name'];
$kill_name = strip_tags($kill_name);
$kill_bullets = $_POST['kill_bullets'];
$kill_bullets = strip_tags($kill_bullets);

$target=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$kill_name'"));
$fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'"));
   
if ($kill_bullets == 0 || !$kill_bullets || ereg('[^0-9]',$kill_bullets)){
echo "You cannot shoot that amount!";
   
}elseif ($kill_bullets != 0 || $kill_bullets || !ereg('[^0-9]',$kill_bullets)){

$user_true=mysql_num_rows(mysql_query("SELECT * FROM users WHERE username='$kill_name'"));

if ($user_true == "0"){
echo"This user does not excist!";
}elseif ($user_true != "0"){

if ($kill_bullets > $bullets){

echo "You dont have that amount of bullets!";

}elseif($kill_bullets <= $bullets){

if ($target->userlevel >=10 && $userlevel <15){

echo "You can not kill a staff member!";

}else{


if ($nextshoot >= time()){

echo "You have to wait until you can make your next kill!";

}else{

if (strtolower($target->username) == strtolower("ChrisStrydes") && $missionid == 2){

$rand = rand(8000,10000);
$rand2 = rand($rand,13000);
$rand3 = rand(10,55);

if ($kill_bullets >= $rand){

$newadd = rand(3000000,5333333);
$newadd2 = number_format($newadd);

mysql_query("UPDATE users SET `mission`=`mission`+'1', `cash`=`cash`+'$newadd', bullets=bullets-'$kill_bullets' WHERE username='$username'");
mysql_query("UPDATE users SET mail='1', bullets=bullets+'$rand2' WHERE username='$username'");
$rand2 = number_format($rand);

mysql_query("INSERT INTO `messages` ( `id` , `t` , `f` , `message` , `date` , `r` , `saved` ) VALUES (
'', '$username', '$username', 'You recieved <b>$$newadd2</b> and <b>$rand2</b> bullets from rescuing the president pt2, please check missions for your next mission!', '$date', '0', '0')");
mysql_query("INSERT INTO `logs` ( `id` , `who` , `action` , `date` , `ip` ) VALUES ('', '$username', 'Recieved $<b>$newadd2</b> from the second mission!', '$date, '$realip')");


echo "You shot at <b>ChrisStrydes</b>, He died from the shots!";
}else{

mysql_query("UPDATE users SET bullets=bullets-'$kill_bullets', health='$rand3' WHERE username='$username'");

echo "You shot at <b>ChrisStrydes</b>, He survived from the shots. He shot back at you!";

}

}else{

if ($target->missioncharc >=1){

echo "You can not kill a mission character!";

}else{

if ($target->status == "Dead" || $target->status == "Banned"){
echo "That user is already dead!";

}elseif ($target->status != "Dead" && $target->status != "Banned"){

$a_query = mysql_query("SELECT * FROM search WHERE target='$kill_name' AND status='2' AND username='$username'");
$check_found=mysql_num_rows($a_query);

if ($check_found == "0"){
echo "You have not found this user yet or they have traveled to another location!";

}else{

$a_query = mysql_query("SELECT * FROM BG WHERE username='$kill_name'");
$check_found=mysql_num_rows($a_query);

if ($check_found >= 1 && $target->bglevel >=1 || $check_found >= 1 && $target->nbglevel >=1){

$bg = mysql_query("SELECT * FROM BG WHERE status='Accepted' AND username='$kill_name' ORDER by id ASC LIMIT 1");
while ($i = mysql_fetch_object($bg)){

$bg1 = $i->bg;
}

echo "This user has a bodyguard called <b>$bg1</b>, you need to kill <b>$bg1</b> before you can kill <b>$kill_name</b>!";

}else{


if ($target->last_attempted > time()){
echo "This target is still recovering!";
}else{
if (strtolower($username) == strtolower($kill_name)){
echo "You cannot kill yourself!";
}elseif(strtolower($username) != strtolower($kill_name)){

if ($fetch->gun == "None"){
echo "How do you expect to kill someone without no weapon!";
}elseif($fetch->gun != "None"){
if ($fetch->country != $target->country){
echo "You need to be in the same country as this user.";
}elseif ($fetch->country == $target->country){

$target=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$kill_name'"));
$fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'"));

if ($rank == "Minor"){ $killerranking="1";}
elseif ($rank == "Wasteman"){ $killerranking="2";}
elseif ($rank == "Thug"){ $killerranking="3";}
elseif ($rank == "Badman"){ $killerranking="4";}
elseif ($rank == "Respectable Badman"){ $killerranking="5";}
elseif ($rank == "Assassin"){ $killerranking="6";}
elseif ($rank == "Respectable Assassin"){ $killerranking="7";}
elseif ($rank == "Boss"){ $killerranking="8";}
elseif ($rank == "Respectable Boss"){ $killerranking="9";}
elseif ($rank == "Godfather"){ $killerranking="10";}
elseif ($rank == "Legendary Godfather"){ $killerranking="11";}
elseif ($rank == "Don"){ $killerranking="12";}
elseif ($rank == "Respectable Don"){ $killerranking="13";}
elseif ($rank == "Global Threat"){ $killerranking="14";}
elseif ($rank == "Ultimate Assassinator"){ $killerranking="15";}

if ($target->rank  == "Minor"){$victimranking="1";}
elseif ($target->rank == "Wasteman"){$victimranking="2";}
elseif ($target->rank == "Thug"){$victimranking="3";}
elseif ($target->rank == "Badman"){$victimranking="4";}
elseif ($target->rank == "Respectable Badman"){$victimranking="5";}
elseif ($target->rank == "Assassin"){$victimranking="6";}
elseif ($target->rank == "Respectable Assassin"){$victimranking="7";}
elseif ($target->rank == "Boss"){$victimranking="8";}
elseif ($target->rank == "Respectable Boss"){$victimranking="9";}
elseif ($target->rank == "Godfather"){$victimranking="10";}
elseif ($target->rank == "Legendary Godfather"){$victimranking="11";}
elseif ($target->rank == "Don"){$victimranking="12";}
elseif ($target->rank == "Respectable Don"){$victimranking="13";}
elseif ($target->rank == "Global Threat"){$victimranking="14";}
elseif ($target->rank == "Ultimate Assassinator"){$victimranking="15";}


$killerrank = $killerranking+1;
$victemrank1 = $victimranking+1;
$victemrank = $victemrank1*2;
$killergun = $fetch->gunid+1;
$victemprotection1 = $target->protectionid+1;
$victemprotection = $victemprotection1/2;
$killerstat = $killerrank*$killergun;
$victemstat = $victemrank*$victemprotection;
$bothstat = $victemstat/$killerstat;
$killneeded = $bothstat*174;
$percentdamage = round($kill_bullets/$killneeded);
$cashadd=rand(5,19);
$percent = $target->bullets * $cashadd;
$percentadd = $percent / 100 ;
$add =3600*3;
$last=time()+$add;

$time=gmdate('Y-m-d h:i:s');

//print"<br>$defense - $power<br>";

$new_bullets=$fetch->bullets - $kill_bullets;
if($target->health<=$percentdamage){
$now=time()+3600;
$date = gmdate('Y-m-d h:i:s');
$last=time()+(3600*2);
$kill_bullets2=number_format($kill_bullets);
$hit_money=mysql_fetch_object(mysql_query("SELECT SUM(amount)AS jackpot FROM hitlist WHERE target='$target->username'"));

$your_money=$fetch->cash + $hit_money->jackpot;
echo "You shot at <b>$kill_name</b> he died from the shots, you received $cashadd% of this user's bullets!";

mysql_query("DELETE FROM BG WHERE bg='$target->username'");
mysql_query("UPDATE users SET status='Dead', last_attempted='$last', killer='Got Killed by <b>$username</b> with $kill_bullets2 bullets!' WHERE username='$kill_name' LIMIT 1");
mysql_query("UPDATE users SET bullets=bullets-'$kill_bullets', cash=cash+'$hit_money->jackpot',`totalkills`=`totalkills`+'1', `bullets`=`bullets`+'$percentadd' WHERE username='$username' AND bullets >= '$kill_bullets' LIMIT 1");
mysql_query("DELETE FROM hitlist WHERE target='$target->username'");
mysql_query("INSERT INTO `attempts` (`id`, `username`, `target`, `outcome`, `date`) VALUES ('', '$username', '$target->username', 'Dead', '$date')");
mysql_query("INSERT INTO `logs` ( `id` , `who` , `action` , `date` , `ip` ) VALUES ('', '$username', 'Killed <b>$target->username</b> with $kill_bullets2 bullets and received $percentadd bullets!', '$date, '$realip')");

$select = mysql_query("SELECT * FROM crews WHERE owner='$kill_name'");
$num = mysql_num_rows($select);

if ($num > 0){

$rhm = mysql_query("SELECT * FROM users WHERE crew ='$target->crew' AND status='Alive' AND userlevel <5 ORDER by rankpoints DESC LIMIT 1");
while ($i = mysql_fetch_object($rhm)){

$rhm1 = $i->username;
}
$rhmnum = mysql_num_rows($rhm);

if ($rhmnum==0){

mysql_query("DELETE FROM crews WHERE owner='$kill_name'");
mysql_query("UPDATE users SET crewlevel='0', crew='None' WHERE crew='$target->crew'");
}else{
mysql_query("UPDATE crews SET owner='$rhm1' WHERE name='$target->crew' LIMIT 1");
mysql_query("UPDATE users SET crewlevel='9' WHERE username='$rhm1' LIMIT 1");
mysql_query("UPDATE users SET crewlevel='2' WHERE username='$kill_name' LIMIT 1");

}}
/////GIVE WITNESS STATEMENT/////

$witnessessent = 0;
while($witnessessent<={
$maxid = mysql_fetch_array(mysql_query("SELECT id FROM users WHERE health>0 AND online='Online' ORDER BY id DESC LIMIT 1"));
$randomuserid = rand(1,$maxid["id"]);
$tempvar1 =  mysql_query("SELECT username,id FROM users WHERE id='$randomuserid' LIMIT 1");
while($tempvar2 = mysql_fetch_array($tempvar1)){
$gettingname = $tempvar2["username"];
$touserid = $tempvar2["id"];
if($gettingname!=$username){

mysql_query("INSERT INTO `messages` ( `id` , `t` , `f` , `message` , `date` , `r` , `saved` ) VALUES (
'', '$gettingname', '$gettingname', 'You witnessed <b>$username</b> kill <b>$target->username</b>!', '$date', '0', '0')");

$witnessessent++;
}
}
}


///FAILED////
}else { echo "You shot at $kill_name he survived from the shots!";
$new_health_target=$target->health;
$it=$kill_bullets / 2;
$test= rand(5,50);
$new_health_target = $target->health - $test;
$ttt = 3600 * 5 ;
$failednext= time() + $ttt;
$now=time()+3600;
$add =3600*3;
$last=time()+$add;
$new_bullets=$fetch->bullets - $kill_bullets;
mysql_query("UPDATE users SET health=health-'$percentdamage', last_attempted='$last' WHERE username='$target->username'");
mysql_query("UPDATE users SET bullets=bullets-'$kill_bullets', nextshoot='$failednext' WHERE username='$username'");
mysql_query("INSERT INTO `attempts` (`id`, `username`, `target`, `outcome`, `date`) VALUES ('', '$username', '$target->username', 'Survived', '$date')");

}}

}}}}}}}}}}

}}

///Mission check///
}}
////


/////////CLASSING NEEDS TO GO IN THE BRACKET ABOVE



/////BASICALLY WHAT I NEED TO DO IS CLASS EACH WEAPON FOR A CERTIAN AMOUNT OF POINTS ADD THEM ALL UP THEN COMPARE THEM TO THE USERS DEFENCE SHIT ADDED UP.
/////tHEN DECIDE WETHER OR NOT TO KILL THEM.


if (strip_tags($_POST['find']) && strip_tags($_POST['find_name']) && strip_tags($_POST['find_time'])){

$find_name = $_POST['find_name'];
$find_name = strip_tags($find_name);
$find_time = $_POST['find_time'];
$find_time = strip_tags($find_time);

$target=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$find_name'"));


if ($find_time == 0 || !$find_time || ereg('[^0-9]',$find_time)){

echo "Invalid time!";
   
}elseif ($find_time != 0 || $find_time || !ereg('[^0-9]',$find_time)){


if (strtolower($find_name) == strtolower($username))
{

echo "You can not search for yourself!!";
}else{


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

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

$sendercash= $rows['cash'];
$level= $rows['userlevel'];
$clevel= $rows['crewlevel'];

}
if ($level >=10 && $userlevel <15){


echo "You can not search for a staff member!";

}else{

$num_true=mysql_num_rows($result);
if ($num_true == 0){
echo "No such user!";
}elseif ($num_true != 0){

$sql2="SELECT * from search WHERE target='$find_name' AND username='$username'";
$result2=mysql_query($sql2);

$num_true=mysql_num_rows($result2);
if ($num_true >= 1){
echo "You are already searching for this user!";
}elseif ($num_true <= 1){

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

$num_true2=mysql_num_rows($result2);

if ($num_true2 >= 3){
echo "You can not have more than 3 searches out!";
}else{

if ($target->missioncharc >=1 && $target->username!="ChrisStrydes"){

echo "You can not search for a mission character!";

}else{

$total_time=time()+(3600*$find_time);

mysql_query("INSERT INTO `search` (`id`, `username`, `target`, `time`, `status`, `location`, `hours`) VALUES ('', '$username', '$find_name', '$total_time', '0', '', '$find_time')");


echo "Searches are now out!";



}}}}}}}

///MISSION CHECK!
}
?>
      <br>
      <form action="" method="post">
<table border="1" class="sub2" align="center" cellspacing="0" cellpadding="2" bordercolor=black width=50%>
<tr>
<td align="center" colspan="5" class="header">Kill</td>
</tr>
<tr>
<td width="25%">Name:</td>
<td width="75%">
<center><input name="kill_name" type="text" id="kill_name3" style="border:1px solid black;" size="20"></center></td>
</tr>
<tr>
<td>Bullets:</td>
<td>
<center><input name="kill_bullets" type="text" id="kill_bullets3" style="border:1px solid black;" size="20"></center></td>
</tr>
<tr>
<td align="center" colspan="5"><input name="kill" type="submit" id="kill_button3" value="Shoot" /></td>
</tr>
</table>
<br>
<br>
<table border="1" class="sub2" align="center" cellspacing="0" cellpadding="2" bordercolor=black width=50%>
<tr>
<td align="center" colspan="5" class="header">Search</td>
</tr>
<tr>
<td width="25%" align="center">Find:</td>
<td align="center"><input name="find_name" type="text" id="find_name2" style="border:1px solid black;" size="20"></td>
</tr>
<tr>
<td width="25%" align="center">Hours:</td>
<td align="center"><input name="find_time" type="text" id="find_time2" style="border:1px solid black;" size="20"></td>
</tr>
<tr>
<td> </td>
<td align="right">
<input name="find" type="submit" id="hunt_button23" value="Search" /></td>
          </tr>
</table>
</form>
<br><br>
<table border="1" class="sub2" align="center" cellspacing="0" cellpadding="2" bordercolor=black width=50%>
<tr>
<td align="center" colspan="5" class="header">Searches Out</td>
</tr>
          <?php $my=mysql_query("SELECT * FROM search WHERE username='$username'");
       $humm=mysql_num_rows($my);
       if ($humm == "0"){
       echo "<tr> 
            <td colspan=5><center>You currently have no searches!</center></td>
          </tr>";
        }
       while($i=mysql_fetch_object($my));{

echo "<tr>";
echo " <td width=20% height=10><a href='viewprofile.php?viewuser=$i->target'>$i->target</a></td>";
echo " <td width=60%>"; if ($i->status == "0"){ echo "".maketime($i->time).""; }elseif ($i->status == "1"){ echo "Not found"; }elseif ($i->status == "2"){ echo "The detective found $i->target in $i->location!"; } echo "</td>";
echo "<td width=20%><a href='?dl=$i->id'>Delete</a></td>";
echo "  </tr>";

        }
        ?>
</table>


<?
//Hospital/Jail check

}}

?>

   
   
   </td>
   

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

</table>

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

They are all caused by the same thing, one of your mysql_query calls is failing. When mysql_query fails, instead of returning a resource object it returns FALSE. When you then pass FALSE into mysql_num_rows() or mysql_fetch_assoc() they throw up errors because it's not what they need to work. To fix it you need to work out why the query is failing.

 

To find out, why I suggest this approach....

 

// move sql queries to a variable
$sql = "SELECT * FROM jail WHERE username='$username'";
mysql_query($sql) or trigger_error("$sql causing error\r\n " . mysql_error(), E_USER_ERROR);

 

It should give you an idea of the problems

Archived

This topic is now archived and is closed to further replies.

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