johay
01-30-2007, 05:32 PM
Sorry about the title, i really Couldn't think of anything. :o
First of all, the MMORPG, is a mafia style game. where you kill etc...
My problem is:
When you shoot any amount it just kills the victim and the heath is like 1+ if that makes any sense.. :o
My kill script is:
<?
session_start();
include_once "includes/db_connect.php";
include_once"includes/functions.php";
logincheck();
include_once "includes/jail_check.php";
$page="kill.php";
$username=$_SESSION['username'];
$fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'"));
$searches=mysql_query("SELECT * FROM search WHERE username='$username'");
while($a =mysql_fetch_object($searches)){
$target_find=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$a->target'"));
if ($a->time < time() && $a->status == "0"){
$time=time();
$safe=mysql_num_rows(mysql_query("SELECT * FROM safe WHERE username='$a->target' AND time > '$time'"));
if ($safe == "0" && $a->location == $target_find->location){
mysql_query("UPDATE search SET status='2' WHERE id='$a->id'");
}else{
mysql_query("UPDATE search SET status='1' WHERE id='$a->id'");
}
}}
if(strip_tags($_GET['d'])){
mysql_query("DELETE FROM search WHERE username='$username'");
echo "All searches deleted";
}
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['send_button']) && strip_tags($_POST['send_id']) && strip_tags($_POST['send_to'])){
$send_id=strip_tags($_POST['send_id']);
$send_to=strip_tags($_POST['send_to']);
$ha=mysql_num_rows(mysql_query("SELECT * FROM users WHERE username='$send_to'"));
if ($ha == "0"){
echo "No such user.";
}elseif ($ha != "0"){
$yours=mysql_num_rows(mysql_query("SELECT * FROM search WHERE id='$send_id' AND username='$username' AND status='2'"));
if ($yours == "0"){
echo "The search ID you entered does not belong to you or it is nor ready to be sent.";
}elseif ($yours != "0"){
if ($fetch->money < "10000"){
echo "You dont have enough money to send this search!";
}elseif ($fetch->money >= "10000"){
mysql_query("UPDATE search SET username='$send_to' WHERE id='$send_id'");
mysql_query("UPDATE users SET money=money-10000 WHERE username='$send_to'");
echo "Search has been sent.";
}}}}
if (strip_tags($_POST['kill_button']) && strip_tags($_POST['kill_username']) && strip_tags($_POST['kill_bullets'])){
$kill_bullets=intval(strip_tags($_POST['kill_bullets']));
$kill_username=strip_tags($_POST['kill_username']);
$target=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$kill_username'"));
if ($kill_bullets == 0 || !$kill_bullets || ereg('[^0-9]',$kill_bullets)){
print "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_username'"));
if ($user_true == "0"){
echo"This user does not excist";
}elseif ($user_true != "0"){
if ($kill_bullets > $fetch->bullets){
echo "You dont have that amount of bullets.";
}elseif($kill_bullets <= $fetch->bullets){
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='$target->username' AND status='2' AND username='$username' && location ='$target->location'");
$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, Unlucky Mate.";
}elseif ($check_found != "0"){
if ($target->last_attempted > time()){
echo "Dont Shoot A Man While He IS Down.";
}elseif($target->last_shot <= time()){
if ($fetch->last_kill > time()){
echo "You are still recovering from your last kill.";
}elseif ($fetch->last_kill <= time()){
if (strtolower($username) == strtolower($kill_username)){
echo "You cannot kill youself, if you want to do that then go to suicide!";
}elseif(strtolower($username) != strtolower($kill_username)){
if ($fetch->weapon == "None"){
echo "How do you expect to kill someone without no weapon?!?";
}elseif($fetch->weapon != "None"){
if ($fetch->location != $target->location){
echo "You need to be in the same location as this user.";
}elseif ($fetch->location == $target->location){
if($target->protection == "Safehouse"){ $target_protection = 100; }
elseif($target->protection == "House"){ $target_protection = 30; }
elseif($target->protection == "Armoured Car"){ $target_protection = 15; }
elseif($target->protection == "Body Guard"){ $target_protection = 12; }
elseif($target->protection == "Doberman"){ $target_protection = 6; }
elseif($target->protection == "None"){ $target_protection = 1; }
if($fetch->weapon == "Sig Sauer P229"){ $your_gun_power = "2"; $gunpower = $kill_bullets*1000; }
elseif($fetch->weapon == "Jackhammer automatic shotgun"){ $your_gun_power = "3"; $gunpower = $kill_bullets*1000; }
elseif($fetch->weapon == "Heckler und Koch MP-5k"){ $your_gun_power = "4"; $gunpower = $kill_bullets*1000; }
elseif($fetch->weapon == "FN SCAR"){ $your_gun_power = "5"; $gunpower = $kill_bullets*1000; }
elseif($fetch->weapon == "Browning M2HB"){ $your_gun_power = "8"; $gunpower = $kill_bullets*1000; }
$power = ($your_gun_power*$fetch->rankpoints) + ($fetch->rankpoints*$fetch->rankpoints);
$power = $power*$gunpower;
$power = round($power/2);
$defense = ($target->health*$target->rankpoints) + ($target_protection*$target->rankpoints);
$defense = $defense*$target->rankpoints;
$defense = round($defense/62);
if($defense<1000){$defense=1000;}
$time=gmdate('Y-m-d h:i:s');
//print"<br>$defense - $power<br>";
$new_bullets=$fetch->bullets - $kill_bullets;
if($power > $defense ){
$now=time()+3600;
$last=time()+(3600*2);
$hit_money=mysql_fetch_object(mysql_query("SELECT SUM(amount)AS jackpot FROM hitlist WHERE target='$target->username'"));
$your_money=$fetch->money + $hit_money->jackpot;
echo "Wow Impressive, You Just Wasted <a href='profile.php?viewuser=$kill_username'>$kill_username</a> Lets Hope No One Grasses You Up.<br><br>";
mysql_query("UPDATE users SET status='Dead' WHERE username='$kill_username'");
mysql_query("UPDATE user_info SET kill_skill=kill_skill+1 WHERE username='$username'");
mysql_query("UPDATE users SET bullets='$new_bullets',last_kill='$now',money='$your_money' WHERE username='$username'");
mysql_query("DELETE FROM hitlist WHERE target='$target->username'");
mysql_query("INSERT INTO `attempts` (`id`, `username`, `target`, `outcome`, `date`) VALUES ('', '$username', '$target->username', 'Dead', '$time')");
/////GIVE WITNESS STATEMENT/////
$rand=rand(1,10);
$i=0;
while($i < $rand){
$set= mysql_query("SELECT * FROM users WHERE username != '$username' AND location='$fetch->location' ORDER BY id DESC LIMIT 10");
while($dns=mysql_fetch_object($set)){
mysql_query("INSERT INTO `inbox` ( `id` , `to` , `from` , `message` , `date` , `read` , `saved` , `event_id` , `witness` , `witness_per` )
VALUES (
'', '$dns->username', '$dns->username', 'You witnessed $username kill $target->username with $kill_bullets bullets!', '$date', '0', '0', '0', '1', '$target->username'
)");
$i++;
}}
}else { echo "He survived<br><br>"; }
$new_health_target=$target->health;
$it=$kill_bullets / 2;
$test=$kill_bullets / $it;
$new_health_target = $target->health - $test;
$now=time()+3600;
$last=time()+3600;
mysql_query("UPDATE user_info SET kill_attempts=kill_attempts+1 WHERE username='$username'");
$new_bullets=$fetch->bullets - $kill_bullets;
mysql_query("UPDATE users SET health='$new_health_target', last_attempted='$last' WHERE username='$target->username'");
mysql_query("UPDATE users SET last_kill='$now', bullets='$new_bullets' WHERE username='$username'");
mysql_query("INSERT INTO `attempts` (`id`, `username`, `target`, `outcome`, `date`) VALUES ('', '$username', '$target->username', 'Survived', '$time')");
}
}}}}}}}}}}
/////////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 **** ADDED UP.
/////tHEN DECIDE WETHER OR NOT TO KILL THEM.
if (strip_tags($_POST['hunt_button']) && strip_tags($_POST['hunt_username'])){
$hunt_item=strip_tags($_POST['hunt_item']);
$hunt_username=strip_tags($_POST['hunt_username']);
$hunt_time=intval(strip_tags($_POST['hunt_time']));
if ($hunt_time != "0"){
if ($hunt_time == 0 || !$hunt_time || ereg('[^0-9]',$hunt_time)){
print "Invalid time.";
}elseif ($hunt_time != 0 || $hunt_time || !ereg('[^0-9]',$hunt_time)){
if ($hunt_item !=""){
$above_me=mysql_query("SELECT * FROM items WHERE item='$hunt_item' AND owner='$username'");
$item=mysql_fetch_object($above_me);
if (mysql_num_rows($above_me) == "0"){
echo "This is not your item!";
exit();
}elseif(mysql_num_rows($above_me) != "0"){
if ($item->item == "Yellow Pages"){
$price=4000*$hunt_time;
}elseif ($item->item == "Tracking Device"){
$price=3000*$hunt_time;
}else{
$price=5000*$hunt_time;
}}}
if (strip_tags($_POST['Eng'])){
$check_eng="1";
}
if (strip_tags($_POST['Jap'])){
$check_jap="1";
}
if (strip_tags($_POST['Col'])){
$check_col="1";
}
if (strip_tags($_POST['Usa'])){
$check_usa="1";
}
if (strip_tags($_POST['Sa'])){
$check_sa="1";
}
if (strip_tags($_POST['Mex'])){
$check_mex="1";
}
if (strip_tags($_POST['Rus'])){
$check_rus="1";
}
if (strip_tags($_POST['It'])){
$check_it="1";
}
if (strip_tags($_POST['Cu'])){
$check_cu="1";
}
if (strip_tags($_POST['Ma'])){
$check_ma="1";
}
$init=$check_eng+$check_jap+$check_France+$check_usa+$check_China+$check_Canada;
$total_price=$price * $init;
if ($total_price > $fetch->money){
echo "You dont have enough money!";
}elseif ($total_price <= $fetch->money){
$total_time=time()+(3600*$hunt_time);
if ($check_eng){
mysql_query("INSERT INTO `search` (`id`, `username`, `target`, `time`, `status`,`location`) VALUES ('', '$username', '$hunt_username', '$total_time', '0','England')");
$ponse=1;
}
if ($check_jap){
mysql_query("INSERT INTO `search` (`id`, `username`, `target`, `time`, `status`,`location`) VALUES ('', '$username', '$hunt_username', '$total_time', '0','Japan')");
$ponse=1;
}
if ($check_col){
mysql_query("INSERT INTO `search` (`id`, `username`, `target`, `time`, `status`,`location`) VALUES ('', '$username', '$hunt_username', '$total_time', '0','Colombia')");
$ponse=1;
}
if ($check_usa){
mysql_query("INSERT INTO `search` (`id`, `username`, `target`, `time`, `status`,`location`) VALUES ('', '$username', '$hunt_username', '$total_time', '0','Usa')");
$ponse=1;
}
if ($check_sa){
mysql_query("INSERT INTO `search` (`id`, `username`, `target`, `time`, `status`,`location`) VALUES ('', '$username', '$hunt_username', '$total_time', '0','South Africa')");
$ponse=1;
}
if ($check_mex){
mysql_query("INSERT INTO `search` (`id`, `username`, `target`, `time`, `status`,`location`) VALUES ('', '$username', '$hunt_username', '$total_time', '0','Mexico')");
$ponse=1;
}
if ($check_rus){
mysql_query("INSERT INTO `search` (`id`, `username`, `target`, `time`, `status`,`location`) VALUES ('', '$username', '$hunt_username', '$total_time', '0','Russia')");
$ponse=1;
}
if ($check_it){
mysql_query("INSERT INTO `search` (`id`, `username`, `target`, `time`, `status`,`location`) VALUES ('', '$username', '$hunt_username', '$total_time', '0','Italy')");
$ponse=1;
}
if ($check_cu){
mysql_query("INSERT INTO `search` (`id`, `username`, `target`, `time`, `status`,`location`) VALUES ('', '$username', '$hunt_username', '$total_time', '0','Cuba')");
$ponse=1;
}
if ($check_ma){
mysql_query("INSERT INTO `search` (`id`, `username`, `target`, `time`, `status`,`location`) VALUES ('', '$username', '$hunt_username', '$total_time', '0','Madagscar')");
$ponse=1;
}
if ($ponse == "1"){
$new_money=$fetch->money - $total_price;
mysql_query("UPDATE users SET money='$new_money' WHERE username='$username'");
echo "Searches are now out.";
}
}
}
}}
?>
<link href="includes/in.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {
color: #FFFFFF;
font-weight: bold;
}
-->
</style>
<form name="form1" method="post" action="">
<table width="76%" border="0" align="center" cellpadding="0" cellspacing="3">
<tr>
<td>
<table width="100%" border="1" align="center" cellpadding="2" cellspacing="0" class=thinline bordercolor=black>
<tr>
<td colspan="2" background="includes/grad.jpg"><center>
<span class="style1">Kill </span>
</center></td>
</tr>
<tr>
<td width="50%">Name:</td>
<td width="50%"><input name="kill_username" type="text" id="kill_username3"></td>
</tr>
<tr>
<td>Bullets:</td>
<td><input name="kill_bullets" type="text" id="kill_bullets3"></td>
</tr>
<tr>
<td> </td>
<td>
<div align="left">
<input name="kill_button" type="submit" id="kill_button3" value="Shoot" />
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="1" align="center" cellpadding="2" cellspacing="0" class=thinline bordercolor=black>
<tr>
<td colspan="2" background="includes/grad.jpg"><center>
<span class="style1">Search </span>
</center>
</td>
</tr>
<tr>
<td width="50%">Name:</td>
<td width="50%"><input name="hunt_username" type="text" id="hunt_username2"></td>
</tr>
<tr>
<td>Hours:</td>
<td><input name="hunt_time" type="text" id="hunt_time2"></td>
</tr>
<tr>
<td><p>Country:</p> </td>
<td><p align="left">
<input name="Eng" type="checkbox" value="1">
England
<input name="Jap" type="checkbox" value="2">
Japan</p>
<p align="left">
<input name="Col" type="checkbox" value="3">
Colombia
<input name="Usa" type="checkbox" value="4">
Usa </p>
<p align="left">
<input name="Sa" type="checkbox" value="5">
South Africa
<input name="Mex" type="checkbox" value="6">
Mexico<br>
</p></td>
</tr>
<tr>
<td> </td>
<td>
<div align="left">
<input name="hunt_button" type="submit" id="hunt_button23" value="Search" />
</div></td>
</tr>
</table> </td>
</tr>
<tr>
<td><table width="100%" border="1" align="center" cellpadding="2" cellspacing="0" class=thinline bordercolor=black>
<tr>
<td width="100%" background="includes/grad.jpg"><center>
Searches Out(<a href=?d=yes>Delete all</a>) </center></td>
</tr>
<SCRIPT>
<!--
function input(Item) {
document.getElementById('send_id').value = Item;
}
//-->
</SCRIPT>
<?php $my=mysql_query("SELECT * FROM search WHERE username='$username'");
$humm=mysql_num_rows($my);
if ($humm == "0"){
echo "<tr>
<td height=5 colspan=4><center>No searches</center></td>
</tr>";
}
while($i=mysql_fetch_object($my)){
echo "<tr>";
echo " <td width=30% height=10><a href='profile.php?viewuser=$i->target'>$i->target</a></td>";
echo " <td width=31%>"; if ($i->status == "0"){ echo "".maketime($i->time).""; }elseif ($i->status == "1"){ echo "Not found"; }else{ echo "<a Onclick=input($i->id) href=#send>Found</a>"; } echo "</td>";
echo "<td>$i->location</td>";
echo "<td><a href='?dl=$i->id'>Delete</a></td>";
echo " </tr>";
}
?>
</table></td>
</tr>
</table>
<p> </p>
</form>
If you could tell me where the problem occurs that would be great.
First of all, the MMORPG, is a mafia style game. where you kill etc...
My problem is:
When you shoot any amount it just kills the victim and the heath is like 1+ if that makes any sense.. :o
My kill script is:
<?
session_start();
include_once "includes/db_connect.php";
include_once"includes/functions.php";
logincheck();
include_once "includes/jail_check.php";
$page="kill.php";
$username=$_SESSION['username'];
$fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'"));
$searches=mysql_query("SELECT * FROM search WHERE username='$username'");
while($a =mysql_fetch_object($searches)){
$target_find=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$a->target'"));
if ($a->time < time() && $a->status == "0"){
$time=time();
$safe=mysql_num_rows(mysql_query("SELECT * FROM safe WHERE username='$a->target' AND time > '$time'"));
if ($safe == "0" && $a->location == $target_find->location){
mysql_query("UPDATE search SET status='2' WHERE id='$a->id'");
}else{
mysql_query("UPDATE search SET status='1' WHERE id='$a->id'");
}
}}
if(strip_tags($_GET['d'])){
mysql_query("DELETE FROM search WHERE username='$username'");
echo "All searches deleted";
}
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['send_button']) && strip_tags($_POST['send_id']) && strip_tags($_POST['send_to'])){
$send_id=strip_tags($_POST['send_id']);
$send_to=strip_tags($_POST['send_to']);
$ha=mysql_num_rows(mysql_query("SELECT * FROM users WHERE username='$send_to'"));
if ($ha == "0"){
echo "No such user.";
}elseif ($ha != "0"){
$yours=mysql_num_rows(mysql_query("SELECT * FROM search WHERE id='$send_id' AND username='$username' AND status='2'"));
if ($yours == "0"){
echo "The search ID you entered does not belong to you or it is nor ready to be sent.";
}elseif ($yours != "0"){
if ($fetch->money < "10000"){
echo "You dont have enough money to send this search!";
}elseif ($fetch->money >= "10000"){
mysql_query("UPDATE search SET username='$send_to' WHERE id='$send_id'");
mysql_query("UPDATE users SET money=money-10000 WHERE username='$send_to'");
echo "Search has been sent.";
}}}}
if (strip_tags($_POST['kill_button']) && strip_tags($_POST['kill_username']) && strip_tags($_POST['kill_bullets'])){
$kill_bullets=intval(strip_tags($_POST['kill_bullets']));
$kill_username=strip_tags($_POST['kill_username']);
$target=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$kill_username'"));
if ($kill_bullets == 0 || !$kill_bullets || ereg('[^0-9]',$kill_bullets)){
print "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_username'"));
if ($user_true == "0"){
echo"This user does not excist";
}elseif ($user_true != "0"){
if ($kill_bullets > $fetch->bullets){
echo "You dont have that amount of bullets.";
}elseif($kill_bullets <= $fetch->bullets){
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='$target->username' AND status='2' AND username='$username' && location ='$target->location'");
$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, Unlucky Mate.";
}elseif ($check_found != "0"){
if ($target->last_attempted > time()){
echo "Dont Shoot A Man While He IS Down.";
}elseif($target->last_shot <= time()){
if ($fetch->last_kill > time()){
echo "You are still recovering from your last kill.";
}elseif ($fetch->last_kill <= time()){
if (strtolower($username) == strtolower($kill_username)){
echo "You cannot kill youself, if you want to do that then go to suicide!";
}elseif(strtolower($username) != strtolower($kill_username)){
if ($fetch->weapon == "None"){
echo "How do you expect to kill someone without no weapon?!?";
}elseif($fetch->weapon != "None"){
if ($fetch->location != $target->location){
echo "You need to be in the same location as this user.";
}elseif ($fetch->location == $target->location){
if($target->protection == "Safehouse"){ $target_protection = 100; }
elseif($target->protection == "House"){ $target_protection = 30; }
elseif($target->protection == "Armoured Car"){ $target_protection = 15; }
elseif($target->protection == "Body Guard"){ $target_protection = 12; }
elseif($target->protection == "Doberman"){ $target_protection = 6; }
elseif($target->protection == "None"){ $target_protection = 1; }
if($fetch->weapon == "Sig Sauer P229"){ $your_gun_power = "2"; $gunpower = $kill_bullets*1000; }
elseif($fetch->weapon == "Jackhammer automatic shotgun"){ $your_gun_power = "3"; $gunpower = $kill_bullets*1000; }
elseif($fetch->weapon == "Heckler und Koch MP-5k"){ $your_gun_power = "4"; $gunpower = $kill_bullets*1000; }
elseif($fetch->weapon == "FN SCAR"){ $your_gun_power = "5"; $gunpower = $kill_bullets*1000; }
elseif($fetch->weapon == "Browning M2HB"){ $your_gun_power = "8"; $gunpower = $kill_bullets*1000; }
$power = ($your_gun_power*$fetch->rankpoints) + ($fetch->rankpoints*$fetch->rankpoints);
$power = $power*$gunpower;
$power = round($power/2);
$defense = ($target->health*$target->rankpoints) + ($target_protection*$target->rankpoints);
$defense = $defense*$target->rankpoints;
$defense = round($defense/62);
if($defense<1000){$defense=1000;}
$time=gmdate('Y-m-d h:i:s');
//print"<br>$defense - $power<br>";
$new_bullets=$fetch->bullets - $kill_bullets;
if($power > $defense ){
$now=time()+3600;
$last=time()+(3600*2);
$hit_money=mysql_fetch_object(mysql_query("SELECT SUM(amount)AS jackpot FROM hitlist WHERE target='$target->username'"));
$your_money=$fetch->money + $hit_money->jackpot;
echo "Wow Impressive, You Just Wasted <a href='profile.php?viewuser=$kill_username'>$kill_username</a> Lets Hope No One Grasses You Up.<br><br>";
mysql_query("UPDATE users SET status='Dead' WHERE username='$kill_username'");
mysql_query("UPDATE user_info SET kill_skill=kill_skill+1 WHERE username='$username'");
mysql_query("UPDATE users SET bullets='$new_bullets',last_kill='$now',money='$your_money' WHERE username='$username'");
mysql_query("DELETE FROM hitlist WHERE target='$target->username'");
mysql_query("INSERT INTO `attempts` (`id`, `username`, `target`, `outcome`, `date`) VALUES ('', '$username', '$target->username', 'Dead', '$time')");
/////GIVE WITNESS STATEMENT/////
$rand=rand(1,10);
$i=0;
while($i < $rand){
$set= mysql_query("SELECT * FROM users WHERE username != '$username' AND location='$fetch->location' ORDER BY id DESC LIMIT 10");
while($dns=mysql_fetch_object($set)){
mysql_query("INSERT INTO `inbox` ( `id` , `to` , `from` , `message` , `date` , `read` , `saved` , `event_id` , `witness` , `witness_per` )
VALUES (
'', '$dns->username', '$dns->username', 'You witnessed $username kill $target->username with $kill_bullets bullets!', '$date', '0', '0', '0', '1', '$target->username'
)");
$i++;
}}
}else { echo "He survived<br><br>"; }
$new_health_target=$target->health;
$it=$kill_bullets / 2;
$test=$kill_bullets / $it;
$new_health_target = $target->health - $test;
$now=time()+3600;
$last=time()+3600;
mysql_query("UPDATE user_info SET kill_attempts=kill_attempts+1 WHERE username='$username'");
$new_bullets=$fetch->bullets - $kill_bullets;
mysql_query("UPDATE users SET health='$new_health_target', last_attempted='$last' WHERE username='$target->username'");
mysql_query("UPDATE users SET last_kill='$now', bullets='$new_bullets' WHERE username='$username'");
mysql_query("INSERT INTO `attempts` (`id`, `username`, `target`, `outcome`, `date`) VALUES ('', '$username', '$target->username', 'Survived', '$time')");
}
}}}}}}}}}}
/////////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 **** ADDED UP.
/////tHEN DECIDE WETHER OR NOT TO KILL THEM.
if (strip_tags($_POST['hunt_button']) && strip_tags($_POST['hunt_username'])){
$hunt_item=strip_tags($_POST['hunt_item']);
$hunt_username=strip_tags($_POST['hunt_username']);
$hunt_time=intval(strip_tags($_POST['hunt_time']));
if ($hunt_time != "0"){
if ($hunt_time == 0 || !$hunt_time || ereg('[^0-9]',$hunt_time)){
print "Invalid time.";
}elseif ($hunt_time != 0 || $hunt_time || !ereg('[^0-9]',$hunt_time)){
if ($hunt_item !=""){
$above_me=mysql_query("SELECT * FROM items WHERE item='$hunt_item' AND owner='$username'");
$item=mysql_fetch_object($above_me);
if (mysql_num_rows($above_me) == "0"){
echo "This is not your item!";
exit();
}elseif(mysql_num_rows($above_me) != "0"){
if ($item->item == "Yellow Pages"){
$price=4000*$hunt_time;
}elseif ($item->item == "Tracking Device"){
$price=3000*$hunt_time;
}else{
$price=5000*$hunt_time;
}}}
if (strip_tags($_POST['Eng'])){
$check_eng="1";
}
if (strip_tags($_POST['Jap'])){
$check_jap="1";
}
if (strip_tags($_POST['Col'])){
$check_col="1";
}
if (strip_tags($_POST['Usa'])){
$check_usa="1";
}
if (strip_tags($_POST['Sa'])){
$check_sa="1";
}
if (strip_tags($_POST['Mex'])){
$check_mex="1";
}
if (strip_tags($_POST['Rus'])){
$check_rus="1";
}
if (strip_tags($_POST['It'])){
$check_it="1";
}
if (strip_tags($_POST['Cu'])){
$check_cu="1";
}
if (strip_tags($_POST['Ma'])){
$check_ma="1";
}
$init=$check_eng+$check_jap+$check_France+$check_usa+$check_China+$check_Canada;
$total_price=$price * $init;
if ($total_price > $fetch->money){
echo "You dont have enough money!";
}elseif ($total_price <= $fetch->money){
$total_time=time()+(3600*$hunt_time);
if ($check_eng){
mysql_query("INSERT INTO `search` (`id`, `username`, `target`, `time`, `status`,`location`) VALUES ('', '$username', '$hunt_username', '$total_time', '0','England')");
$ponse=1;
}
if ($check_jap){
mysql_query("INSERT INTO `search` (`id`, `username`, `target`, `time`, `status`,`location`) VALUES ('', '$username', '$hunt_username', '$total_time', '0','Japan')");
$ponse=1;
}
if ($check_col){
mysql_query("INSERT INTO `search` (`id`, `username`, `target`, `time`, `status`,`location`) VALUES ('', '$username', '$hunt_username', '$total_time', '0','Colombia')");
$ponse=1;
}
if ($check_usa){
mysql_query("INSERT INTO `search` (`id`, `username`, `target`, `time`, `status`,`location`) VALUES ('', '$username', '$hunt_username', '$total_time', '0','Usa')");
$ponse=1;
}
if ($check_sa){
mysql_query("INSERT INTO `search` (`id`, `username`, `target`, `time`, `status`,`location`) VALUES ('', '$username', '$hunt_username', '$total_time', '0','South Africa')");
$ponse=1;
}
if ($check_mex){
mysql_query("INSERT INTO `search` (`id`, `username`, `target`, `time`, `status`,`location`) VALUES ('', '$username', '$hunt_username', '$total_time', '0','Mexico')");
$ponse=1;
}
if ($check_rus){
mysql_query("INSERT INTO `search` (`id`, `username`, `target`, `time`, `status`,`location`) VALUES ('', '$username', '$hunt_username', '$total_time', '0','Russia')");
$ponse=1;
}
if ($check_it){
mysql_query("INSERT INTO `search` (`id`, `username`, `target`, `time`, `status`,`location`) VALUES ('', '$username', '$hunt_username', '$total_time', '0','Italy')");
$ponse=1;
}
if ($check_cu){
mysql_query("INSERT INTO `search` (`id`, `username`, `target`, `time`, `status`,`location`) VALUES ('', '$username', '$hunt_username', '$total_time', '0','Cuba')");
$ponse=1;
}
if ($check_ma){
mysql_query("INSERT INTO `search` (`id`, `username`, `target`, `time`, `status`,`location`) VALUES ('', '$username', '$hunt_username', '$total_time', '0','Madagscar')");
$ponse=1;
}
if ($ponse == "1"){
$new_money=$fetch->money - $total_price;
mysql_query("UPDATE users SET money='$new_money' WHERE username='$username'");
echo "Searches are now out.";
}
}
}
}}
?>
<link href="includes/in.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {
color: #FFFFFF;
font-weight: bold;
}
-->
</style>
<form name="form1" method="post" action="">
<table width="76%" border="0" align="center" cellpadding="0" cellspacing="3">
<tr>
<td>
<table width="100%" border="1" align="center" cellpadding="2" cellspacing="0" class=thinline bordercolor=black>
<tr>
<td colspan="2" background="includes/grad.jpg"><center>
<span class="style1">Kill </span>
</center></td>
</tr>
<tr>
<td width="50%">Name:</td>
<td width="50%"><input name="kill_username" type="text" id="kill_username3"></td>
</tr>
<tr>
<td>Bullets:</td>
<td><input name="kill_bullets" type="text" id="kill_bullets3"></td>
</tr>
<tr>
<td> </td>
<td>
<div align="left">
<input name="kill_button" type="submit" id="kill_button3" value="Shoot" />
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="1" align="center" cellpadding="2" cellspacing="0" class=thinline bordercolor=black>
<tr>
<td colspan="2" background="includes/grad.jpg"><center>
<span class="style1">Search </span>
</center>
</td>
</tr>
<tr>
<td width="50%">Name:</td>
<td width="50%"><input name="hunt_username" type="text" id="hunt_username2"></td>
</tr>
<tr>
<td>Hours:</td>
<td><input name="hunt_time" type="text" id="hunt_time2"></td>
</tr>
<tr>
<td><p>Country:</p> </td>
<td><p align="left">
<input name="Eng" type="checkbox" value="1">
England
<input name="Jap" type="checkbox" value="2">
Japan</p>
<p align="left">
<input name="Col" type="checkbox" value="3">
Colombia
<input name="Usa" type="checkbox" value="4">
Usa </p>
<p align="left">
<input name="Sa" type="checkbox" value="5">
South Africa
<input name="Mex" type="checkbox" value="6">
Mexico<br>
</p></td>
</tr>
<tr>
<td> </td>
<td>
<div align="left">
<input name="hunt_button" type="submit" id="hunt_button23" value="Search" />
</div></td>
</tr>
</table> </td>
</tr>
<tr>
<td><table width="100%" border="1" align="center" cellpadding="2" cellspacing="0" class=thinline bordercolor=black>
<tr>
<td width="100%" background="includes/grad.jpg"><center>
Searches Out(<a href=?d=yes>Delete all</a>) </center></td>
</tr>
<SCRIPT>
<!--
function input(Item) {
document.getElementById('send_id').value = Item;
}
//-->
</SCRIPT>
<?php $my=mysql_query("SELECT * FROM search WHERE username='$username'");
$humm=mysql_num_rows($my);
if ($humm == "0"){
echo "<tr>
<td height=5 colspan=4><center>No searches</center></td>
</tr>";
}
while($i=mysql_fetch_object($my)){
echo "<tr>";
echo " <td width=30% height=10><a href='profile.php?viewuser=$i->target'>$i->target</a></td>";
echo " <td width=31%>"; if ($i->status == "0"){ echo "".maketime($i->time).""; }elseif ($i->status == "1"){ echo "Not found"; }else{ echo "<a Onclick=input($i->id) href=#send>Found</a>"; } echo "</td>";
echo "<td>$i->location</td>";
echo "<td><a href='?dl=$i->id'>Delete</a></td>";
echo " </tr>";
}
?>
</table></td>
</tr>
</table>
<p> </p>
</form>
If you could tell me where the problem occurs that would be great.