All pastes #2101949 Raw Edit

Unnamed

public php v1 · immutable
#2101949 ·published 2012-01-10 17:09 UTC
rendered paste body
<?phpsession_start();include "db.php";include "functions.php";include "jailcheck.php";script("kill.php");$username = $_SESSION['username'];require("macroblocker.php");if ($username == 'TownTimesEditor') {    echo "GTFO";    exit();}function duration($sec, $padHours = true) {    $hms = "";    $hours = intval(intval($sec) / 3600);     $hms .= ($padHours) ? str_pad($hours, 2, "0", STR_PAD_LEFT). ':' : $hours. ':';    $minutes = intval(($sec / 60) % 60);     $hms .= str_pad($minutes, 2, "0", STR_PAD_LEFT). ':';    $seconds = intval($sec % 60);     $hms .= str_pad($seconds, 2, "0", STR_PAD_LEFT);    return $hms;}$allowSNKill = false;$christmas = mysql_query("SELECT * FROM `christmas` WHERE `username`='{$username}'");if (mysql_num_rows($christmas) > 0) {    $christmas = mysql_fetch_object($christmas);    if ($christmas->hasbusted == 'yes' && $christmas->hascompleted == 'no') {        $allowSNKill = true;    }}$hasHearse = mysql_num_rows(mysql_query("SELECT * FROM `veh` WHERE `owner`='$username' AND `cartype`='Funeral Hearse'"));if ($hasHearse > 0) { $hasHearse = true; } else { $hasHearse = false; }//$hasHearse = false;function keyGen($ret = 0) {    if ($ret == 0) {        return keyGen('4');    }    else {        while ($ret > 0) {            $r = rand(1,2);            if ($r == 1) { $x .= chr(rand(65,90)); }            else { $x .= rand(0,9); }            $ret = $ret - 1;        }        return $x;    }}function targetBullets($rank) {    if ($rank == "Package Boy") { return 600; }    if ($rank == "Crook") { return 990; }    if ($rank == "Thief") { return 3300; }    if ($rank == "Mobstar") { return 9600; }    if ($rank == "Soldier") { return 18000; }    if ($rank == "Local Boss") { return 25000; }    if ($rank == "Boss") { return 37250; }    if ($rank == "Godfather") { return 48500; }    if ($rank == "Don") { return 55500; }}function relKS($rank) {    if ($rank == "Package Boy") { return 0.40; }    if ($rank == "Crook") { return 1.10; }    if ($rank == "Thief") { return 1.30; }    if ($rank == "Mobstar") { return 2.00; }    if ($rank == "Soldier") { return 6.40; }    if ($rank == "Local Boss") { return 12.00; }    if ($rank == "Boss") { return 15.00; }    if ($rank == "Godfather") { return 18.00; }    if ($rank == "Don") { return 20.00; }}function attackerAddSub($rank) {    if ($rank == "Package Boy") { return 24.35; }    if ($rank == "Crook") { return 20.00; }    if ($rank == "Thief") { return 11.00; }    if ($rank == "Mobstar") { return 4.00; }    if ($rank == "Soldier") { return 2.25; }    if ($rank == "Local Boss") { return 1.05; }    if ($rank == "Boss") { return 0.94; }    if ($rank == "Godfather") { return 0.90; }    if ($rank == "Don") { return 0.85; }}/* Oldfunction attackerAddSub($rank) {    if ($rank == "Package Boy") { return 25.12; }    if ($rank == "Crook") { return 21.56; }    if ($rank == "Thief") { return 16.00; }    if ($rank == "Mobstar") { return 9.00; }    if ($rank == "Soldier") { return 4.00; }    if ($rank == "Local Boss") { return 1.05; }    if ($rank == "Boss") { return 0.94; }    if ($rank == "Godfather") { return 0.90; }    if ($rank == "Don") { return 0.85; }}*/function targetAddSub($rank) {    if ($rank == "Package Boy") { return 0.71; }    if ($rank == "Crook") { return 0.74; }    if ($rank == "Thief") { return 0.76; }    if ($rank == "Mobstar") { return 0.86; }    if ($rank == "Soldier") { return 0.90; }    if ($rank == "Local Boss") { return 0.99; }    if ($rank == "Boss") { return 1.06; }    if ($rank == "Godfather") { return 1.12; }    if ($rank == "Don") { return 1.21; }}function weaponAddSub($x) {    if ($x == "Barrett .50 Cal") { return 0.70; }    if ($x == "XG5 Eggshooter") { return 0.75; }    if ($x == "M134 Minigun") { return 0.80; }    if ($x == "M16A4") { return 0.84; }    if ($x == "XM8 Rifle") { return 0.87; }    if ($x == "M4A1 Carbine") { return 0.92; }    if ($x == "Vulcan M-11-9") { return 0.95; }    if ($x == "Desert Eagle .50") { return 0.97; }    if ($x == "Glock 39") { return 1.00; }    if ($x == "None") { return 1.07; }}function protectionAddSub($x) {    if ($x == "Witness Protection") { return 1.35; }    if ($x == "Bunker") { return 1.22; }    if ($x == "House") { return 1.12; }    if ($x == "A Body Mimic") { return 1.07; }    if ($x == "Personal Guard") { return 1.04; }    if ($x == "Body Vest") { return 0.99; }    if ($x == "Clothes") { return 0.97; }    if ($x == "None") { return 0.95; }}function ksConvert($ks) {    $ks = $ks - 1;    $opposite = array('100', '99', '98', '97', '96', '95', '94', '93', '92', '91', '90', '89', '88', '87', '86', '85', '84', '83', '82', '81', '80', '79', '78', '77', '76', '75', '74', '73', '72', '71', '70', '69', '68', '67', '66', '65', '64', '63', '62', '61', '60', '59', '58', '57', '56', '55', '54', '53', '52', '51', '50', '49', '48', '47', '46', '45', '44', '43', '42', '41', '40', '39', '38', '37', '36', '35', '34', '33', '32', '31', '30', '29', '28', '27', '26', '25', '24', '23', '22', '21', '20', '19', '18', '17', '16', '15', '14', '13', '12', '11', '10', '9', '8', '7', '6', '5', '4', '3', '2', '1');    return $opposite[$ks];}function prc($num_amount, $num_total) {$count1 = $num_amount / $num_total;$count2 = $count1 * 100;$count = (int)$count2;return $count;}function killFormula($rank, $killskill, $gun, $trank, $protection) {    $killskill = round($killskill);    $target = targetBullets($trank);    $attackeras = attackerAddSub($rank);    $targetas = targetAddSub($trank);    $weaponas = weaponAddSub($gun);    $protectionas = protectionAddSub($protection);    $ks = $killskill;    $random = rand(-25,25);    $sensitivity = 100;    $relKS = relKS($trank);    $formula = (int)((($target * $targetas * $attackeras * $weaponas * $protectionas * ((1 + ($sensitivity / 200)) / 2)) + $random) - (($ks * 1.10) * $relKS));    return round($formula);}/*if ($username == 'ViperHeight') {    $r = 0;    while ($r < 9) {        $array = array("Package Boy", "Crook", "Thief", "Mobstar", "Soldier", "Local Boss", "Boss", "Godfather", "Don");        $x = 0;        while ($x < 9) {            $currank = $array[$r];            $killskill = 100;            $weapon = "M134 Minigun";            $trank = $array[$x];            $protection = "Bunker";            $formula = killFormula($currank, $killskill, $weapon, $trank, $protection);            echo "<b>{$currank}</b> to <b>{$trank}</b> = {$formula} bullets<br>";            $x++;        }        $r++;    }    exit();}*/function wsLimit($ks) {    global $happyHour;    $ks = round($ks);    if ($ks < 20) { $ws = 5; }    elseif ($ks < 40) { $ws = 4; }    elseif ($ks < 60) { $ws = 3; }    elseif ($ks < 80) { $ws = 2; }    elseif ($ks <= 100) { $ws = 1; }    if ($happyHour) { $ws = 0; }    return $ws;}function ptime($timestamp, $num_times = 3) {    $times = array(31536000 => 'year', 2592000 => 'month',  604800 => 'week', 86400 => 'day', 3600 => 'hour', 60 => 'minute', 1 => 'second');    $now = time();    $secs = $timestamp - $now;    $count = 0;    $time = '';    foreach ($times AS $key => $value)    {        if ($secs >= $key)        {            $s = '';            $time .= floor($secs / $key);            $count++;            $secs = $secs % $key;                       if ($count > $num_times - 1 || $secs == 0)                break;            else                $time .= ':';        }    }    return $time;}if ($_POST['bc'] && ($username == "Cloud" || $username == "ViperHeight")) {    $attacker = trim($_POST['bc_attacker']);    $victim = trim($_POST['bc_victim']);    $bullets = trim($_POST['bc_bullets']);    $aSQL = mysql_fetch_object(mysql_query("SELECT * FROM `users` WHERE `username`='$attacker'"));    $aSQL2 = mysql_fetch_object(mysql_query("SELECT * FROM `info` WHERE `username`='$attacker'"));    $vSQL = mysql_fetch_object(mysql_query("SELECT * FROM `users` WHERE `username`='$victim'"));    echo "killFormula($aSQL->rank, $aSQL2->killexp, $aSQL->weapon, $vSQL->rank, $vSQL->protection);";    $formula = killFormula($aSQL->rank, $aSQL2->killexp, $aSQL->weapon, $vSQL->rank, $vSQL->protection);    $vSQL->health = 100;    if ($vSQL->health != 100) {        if ($vSQL->health >= 10) {            $conX = '0.' . $vSQL->health;            $conX = (float)$conX;            $formula = $formula * $conX;        }        else {            $conX = '0.0' . $vSQL->health;            $conX = (float)$conX;            $formula = $formula * $conX;        }    }    $formula = round($formula);    $damage = prc($bullets, $formula);    $damage = (int)$damage;    if (!empty($bullets)) {        $damage = $vSQL->health - prc($bullets, $formula);        $formula = round($formula);    }    $notice = "        <table class=\"thinline\" width=\"55%\">            <tr>                <td class=\"topic\" colspan=\"2\">Admin Bullet Calculator</td>            </tr>            <tr class=\"off\">                <td align=\"right\" width=\"40%\"><b>Attacker Rank:</b>&nbsp;</td>                <td width=\"60%\">&nbsp;{$aSQL->rank}</td>            </tr>            <tr>                <td align=\"right\" width=\"40%\"><b>Attacker KXP:</b>&nbsp;</td>                <td width=\"60%\">&nbsp;{$aSQL2->killexp}</td>            </tr>            <tr class=\"off\">                <td align=\"right\" width=\"40%\"><b>Attacker Weapon:</b>&nbsp;</td>                <td width=\"60%\">&nbsp;{$aSQL->weapon}</td>            </tr>            <tr>                <td align=\"right\" width=\"40%\"><b>Victim Rank:</b>&nbsp;</td>                <td width=\"60%\">&nbsp;{$vSQL->rank}</td>            </tr>            <tr class=\"off\">                <td align=\"right\" width=\"40%\"><b>Victim Protection:</b>&nbsp;</td>                <td width=\"60%\">&nbsp;{$vSQL->protection}</td>            </tr>            <tr>                <td align=\"right\" width=\"40%\"><b>Bullets Required:</b>&nbsp;</td>                <td width=\"60%\">&nbsp;{$formula}</td>            </tr>            <tr class=\"off\">                <td align=\"right\" width=\"40%\"><b>Victim Health</b>&nbsp;</td>                <td width=\"60%\">&nbsp;{$vSQL->health}</td>            </tr>";    if (!empty($bullets)) {        $notice .= "            <tr>                <td align=\"right\" width=\"40%\"><b>Left With:</b>&nbsp;</td>                <td width=\"60%\">&nbsp;{$damage} health</td>            </tr>";    }    $notice .= "</table>";}if ($_POST['k_trans']) {    // TRANSFER SEARCH    $name = trim($_POST['k_victim']);    $sendto = trim($_POST['k_sendto']);    if (!ereg("^[0-9a-zA-Z-]+$", $name)) {        $notice = "Invalid search username.";    }    else {        if (!ereg("^[0-9a-zA-Z-]+$", $sendto) || strtolower($sendto) == strtolower($username) || strtolower($sendto) == 'deathtome') {            $notice = "Invalid receiver username.";        }        else {            $dbTarget = mysql_query("SELECT `username`, `rank`, `location`, `userlevel` FROM `users` WHERE `username`='$sendto' AND `status`='Alive' AND `userlevel`='0'");            if (mysql_num_rows($dbTarget) == 0) {                $notice = "Receiver was either not found, a member of staff, dead or banned.";            }            else {                $isFriend = mysql_num_rows(mysql_query("SELECT * FROM `bandf` WHERE `username`='$sendto' AND `friend`='$username' AND `type`='Friend'"));                if ($isFriend != 0) {                    $recSearches = mysql_num_rows(mysql_query("SELECT * FROM `search` WHERE `target`='$name' AND `username`='$sendto'"));                    if ($recSearches != 0) {                        $notice = "Receiver already has a search running for that user!";                    }                    else {                        $recSearches1 = mysql_num_rows(mysql_query("SELECT * FROM `search` WHERE `username`='$sendto'"));                        if ($recSearches1 > 50) {                             $notice = "Receiver has too many searches running!";                        }                        else {                            mysql_query("UPDATE `search` SET `username`='$sendto' WHERE `username`='$username' AND `target`='$name'");                            $notice = "Transfer successful. Search has changed hands.";                        }                    }                }                else {                    $notice = "You are not their friend!";                }            }        }    }}if ($_POST['s_search']) {    // SEARCH    $name = trim($_POST['s_name']);    $slocation = trim($_POST['s_location']);    $type = trim($_POST['s_type']);    if (!ereg("^[0-9a-zA-Z-]+$", $name) || strtolower($name) == strtolower($username)) {        $notice = "Invalid search username.";    }    else {        if (!in_array($slocation, array("all", "America", "England", "South-Africa", "Brazil", "China", "Japan"))) {            $notice = "Invalid search location.";        }        else {            if (!in_array($type, array('Slow', 'Regular', 'Fast', 'Turbo', 'Express', 'Manhunt'))) {                $notice = "Invalid search type.";            }            else {                $dbTarget = mysql_query("SELECT `username`, `rank`, `location`, `userlevel` FROM `users` WHERE `username`='$name' AND `status`='Alive'");                if (mysql_num_rows($dbTarget) == 0) {                    $notice = "Player was either not found, dead or banned.";                }                else {                    $dbTarget = mysql_fetch_object($dbTarget);                    $name = $dbTarget->username;                    if ($dbTarget->userlevel != 0) {                        $notice = "You cannot search for members of staff!";                    }                    else {                        $cost = array('Slow' => '25000', 'Regular' => '75000', 'Fast' => '300000', 'Turbo' => '645000', 'Express' => '995000', 'Manhunt' => 'P');                        $totalCost = $cost[$type];                        if ($totalCost == 'P') {                            $totalCost = 5;                            if ($zlxPoints < $totalCost) {                                $notice = "You do not have enough points to fund that investigation!";                            }                        }                        else {                            if ($npMoney < $totalCost) {                                $notice = "You do not have enough money to fund that investigation!";                            }                        }                        if (mysql_num_rows(mysql_query("SELECT * FROM `search` WHERE `target`='$name' AND `username`='$username'")) != 0) {                            $notice = "You can only have one search per person running!";                        }                        else {                            if ($currank != 'Don' && $currank != 'Godfather' && $type == 'Manhunt') {                                $notice = "You must be Godfather to call in a Manhunt!";                            }                            if (!$notice) {                                if ($type == 'Slow') { $startPoint = 14400; }                                if ($type == 'Regular') { $startPoint = 10800; }                                if ($type == 'Fast') { $startPoint = 7200; }                                if ($type == 'Turbo') { $startPoint = 3600; }                                if ($type == 'Express') { $startPoint = 2700; }                                if ($type == 'Manhunt') { $startPoint = 1800; }                                $ett = time() + $startPoint;                                $airportOwner = mysql_fetch_object(mysql_query("SELECT `owner` FROM `airport` WHERE `location`='" . $dbTarget->location . "'"));                                $airportOwner = $airportOwner->owner;                                if ($airportOwner == $username) {                                    $ett = time() - 1;                                }                                $sid = keyGen();                                                                if (strtolower($name) != 'killbot' && strtolower($name) != 'deathtome') {                                    if ($type != 'Manhunt') { mysql_query("UPDATE `users` SET `money`=money - '$totalCost' WHERE `username`='$username'"); }                                    else { mysql_query("UPDATE `users` SET `points`=points - '$totalCost' WHERE `username`='$username'"); }                                }                                elseif (strtolower($name) == 'deathtome') {                                    $ett = time() + 1800;                                    $type = 'Manhunt';                                }                                if ($slocation == 'all') { mysql_query("INSERT INTO search (username, location, found, timeleft, target, sid, speed) VALUES('$username', 'Everywhere', '0', '$ett', '$name', '$sid', '$type')") or die(mysql_error()); }                                else { mysql_query("INSERT INTO search (username, location, found, timeleft, target, sid, speed) VALUES('$username', '$slocation', '0', '$ett', '$name', '$sid', '$type')") or die(mysql_error()); }                                $notice = "You have begun the search for <a href=\"profile.php?viewuser={$name}\">{$name}</a>.";                                $msgContents = "I have begun searching for [fpro={$name}]{$name}[/fpro]. As always, I will let you know when I find out where {$name} is hiding.";                                /*$date = "".gmdate("Y-m-d H:i:s", time())."";                                mysql_select_db("downtown_mail");                                mysql_query("INSERT INTO `pm` (`username`, `from`, `msg`, `date`) VALUES ('$username','PrivateInvestigator','$msgContents','$date')");                                mysql_select_db("downtown_users");*/                            }                        }                    }                }            }        }    }}if ($_POST['k_kill'] && $_POST['k_target'] == 'sn' && $allowSNKill == true && 1 == 2) {    $bullets = $_POST['k_bullets'];    if ($npBullets < 500) {        $notice = "You don't have that many bullets!";    }    else {        if ($location != 'Brazil') {            $notice = "You are not in Brazil! You must be in Brazil to shoot SaintNick!";        }        else {            if ($bullets < 500) {                $notice = "That won't kill Santa!";            }            else {                $date = "".gmdate("Y-m-d H:i:s", time())."";                if ($christmas->secondattempt == 'no') { mysql_query("UPDATE `users` SET `bullets`=bullets + 9500, `money`=money + '25000000' WHERE `username`='{$username}'"); }                $time = time();                $time2 = $time - $christmas->started;                $duration = duration($time2);                mysql_query("UPDATE `christmas` SET `hascompleted`='yes', `end`='{$time}', `time`='{$time2}' WHERE `username`='{$username}'");                mysql_select_db("downtown_mail");$msg = "You killed SaintNick.";                mysql_query("INSERT INTO `pm` (`id`, `username`, `from`, `msg`, `read`, `date`) VALUES ('', '$username', 'DownTownMafia', '$msg', '0', '$date')");$msg = "No hard feelings, sweetheart. My employer is no longer... with us so I\'ll be cancelling the hit. Time for me to disappear.";                mysql_query("INSERT INTO `pm` (`id`, `username`, `from`, `msg`, `read`, `date`) VALUES ('', '$username', 'Natasha', '$msg', '0', '$date')");$msg = "Well, {$username}...What an eventful few hours this has been. We find out our currently employed Santa is a big-time drug merchant and now he winds up dead.We thank you for informing us of [fpro=SaintNick]SaintNick[/fpro]\'s dirty side and we think we can hire another just in time for Christmas.In exchange for your assistance, I present you with your reward;Money: \$25,000,000Bullets: 10,000[b]The Christmas mission is now complete. You completed the mission in {$duration} time![/b]";                mysql_query("INSERT INTO `pm` (`id`, `username`, `from`, `msg`, `read`, `date`) VALUES ('', '$username', 'SPManagement', '$msg', '0', '$date')");                mysql_select_db("downtown_users");                $notice = "You killed SaintNick with {$bullets} bullets!";                $allowSNKill = false;            }        }    }}if ($_POST['k_kill'] && $_POST['k_target'] != 'sn') {    $killskill = mysql_fetch_object(mysql_query("SELECT `killexp` FROM `info` WHERE `username`='$username'")) or die('Fatal error. Cannot continue. <b>EID:</b> 1');    $killskill = $killskill->killexp;    $weapon = mysql_fetch_object(mysql_query("SELECT `weapon`, `bullets`, `crew`, `protection` FROM `users` WHERE `username`='$username'")) or die('Fatal error. Cannot continue. <b>EID:</b> 2');    $curprot = $weapon->protection;    $kBullets = $weapon->bullets;    $crew1 = $weapon->crew;    $weapon = $weapon->weapon;    $target = $_POST['k_target'];    $bullets = $_POST['k_bullets'];    $message = htmlentities(mysql_real_escape_string($_POST['k_message']));    if (!ereg("^[0-9a-zA-Z-]+$", $target)) {        $notice = "Invalid target username.";    }    else {        $searchSQL = mysql_query("SELECT * FROM `search` WHERE `username`='$username' AND `target`='$target' AND `found`='2'") or die('Fatal error. Cannot continue. <b>EID:</b> 3');        if (mysql_num_rows($searchSQL) == 0) {            $notice = "No completed search was found for that username.";        }        else {            if (mysql_num_rows(mysql_query("SELECT * FROM `hitlist` WHERE `target`='$target'")) != 0) {                $hitlistMoney = mysql_fetch_object(mysql_query("SELECT SUM(amount) AS total FROM `hitlist` WHERE `target`='$target'"));                $hitlistMoney = $hitlistMoney->total;            }            else {                $hitlistMoney = 0;            }            if (mysql_num_rows(mysql_query("SELECT * FROM `hitlist` WHERE `target`='$username'")) != 0) {                $hitlistMoney2 = mysql_fetch_object(mysql_query("SELECT SUM(amount) AS total FROM `hitlist` WHERE `target`='$username'"));                $hitlistMoney2 = $hitlistMoney2->total;            }            else {                $hitlistMoney2 = 0;            }            $searchSQL = mysql_fetch_object($searchSQL);            $selfSQL = mysql_fetch_object(mysql_query("SELECT `username`, `money`, `crew`, `status`, `health`, `weapon`, `rank`, `location`, `protection`, `lastshot`, `userlevel`, `bullets`, `backfire`, `joined`, `will` FROM `users` WHERE `username`='$username'")) or die('Fatal error. Cannot continue.');            $targetSQL = mysql_fetch_object(mysql_query("SELECT `username`, `money`, `crew`, `status`, `health`, `weapon`, `rank`, `location`, `protection`, `lastshot`, `userlevel`, `bullets`, `backfire`, `joined`, `will`, `tombstone` FROM `users` WHERE `username`='$target'")) or die('Fatal error. Cannot continue. <b>EID:</b> 4');            $target = $targetSQL->username;            $targetSQL2 = mysql_fetch_object(mysql_query("SELECT `killexp` FROM `info` WHERE `username`='$target'")) or die('Fatal error. Cannot continue. <b>EID:</b> 4');            $crew2 = $targetSQL->crew;            $selfSQL2 = mysql_fetch_object(mysql_query("SELECT `killexp` FROM `info` WHERE `username`='$username'")) or die('Fatal error. Cannot continue. <b>EID:</b> 4');            $randomSQL = mysql_fetch_object(mysql_query("SELECT `crew` FROM `users` WHERE `username`='$username'")) or die('Fatal error. Cannot continue. <b>EID:</b> 4');            $crew = $randomSQL->crew;            $backfire = $targetSQL->backfire;            $crewSQL = mysql_fetch_object(mysql_query("SELECT * FROM `crews` WHERE `crewname`='$crew2'"));            $crewSuccessor = $crewSQL->succ;            $crewOwner = $crewSQL->owner;            $crewRHM = $crewSQL->rhm;            $crewLHM = $crewSQL->lhm;            $crewSQL2 = mysql_fetch_object(mysql_query("SELECT * FROM `crews` WHERE `crewname`='$crew'"));            $crewSuccessor2 = $crewSQL2->succ;            $crewOwner2 = $crewSQL2->owner;            $crewRHM2 = $crewSQ2L->rhm;            $crewLHM2 = $crewSQL2->lhm;            $joined1 = $targetSQL->joined;            $joined2 = $selfSQL->joined;            $will = $targetSQL->will;            $will2 = $selfSQL->will;            $date = "".gmdate("Y-m-d H:i:s", time())."";            $kPlus = 1;            /*if ($targetSQL->userlevel > 1 && mysql_num_rows(mysql_query("SELECT * FROM `temp_staffkill` WHERE `killer`='$username' AND `staffmember`='$target'")) > 0) {                echo "Srsly, gtfo.";                exit();            }*/            if (strtolower($target) == 'killbot' || $targetSQL->userlevel > 1) {                $targetSQL->health = 100;                $targetSQL->money = 0;                $hitlistMoney = 0;                $kPlus = 0;            }            if ($targetSQL->location != $searchSQL->foundat) {                $notice = "The player is not in that location anymore!";            }            else {                if ($vLastKill > time()) {                    $notice = "You are still recovering from your last kill!";                }                else {                    if ($targetSQL->lastshot > time() && strtolower($target) != 'killbot') {                        $notice = "They are still recovering!";                    }                    else {                        if ($targetSQL->status != 'Alive') {                            $notice = "Either that person is already dead or is banned.";                        }                        else {                            if ($targetSQL->userlevel != '0' || strtolower($targetSQL->name) == 'downtownmafia' || $targetSQL->location != $location) {                                $notice = "You are not in the appropriate country.";                            }                            else {                                if (!is_numeric($bullets) || $bullets < 100 || $bullets > 5000000) {                                    $notice = "Invalid amount of bullets. You must shoot at least 100 bullets.";                                }                                else {                                    if (strlen($message) > 350) {                                        $notice = "Your message exceeded the maximum allowed limit (300 characters).";                                    }                                    else {                                        if ($bullets > $kBullets) {                                            $notice = "You don't have that many bullets!";                                        }                                        else {                                            $killMessage = htmlspecialchars($message);                                            $formula = killFormula($currank, $killskill, $weapon, $targetSQL->rank, $targetSQL->protection);                                            $formula = (int)$formula;                                            if ($targetSQL->health != 100) {                                                if ($targetSQL->health >= 10) {                                                    $conX = '0.' . $targetSQL->health;                                                    $conX = (float)$conX;                                                    $formula = $formula * $conX;                                                }                                                else {                                                    $conX = '0.0' . $targetSQL->health;                                                    $conX = (float)$conX;                                                    $formula = $formula * $conX;                                                }                                            }                                            $formula = round($formula);                                            /* TOMBSTONE/HEARSE */                                            if ($targetSQL->tombstone > time() || $hasHearse) {                                                $formula = $formula * 0.80;                                            }                                            /* END TOMBSTONE/HEARSE */                                            $damage = prc($bullets, $formula);                                            $damage = (int)$damage;                                            $lastKill = time() + 3600;                                            $lastShot = time() + (3600*2);                                            $timeLeft = time() - (60*10);                                            if ($targetSQL->rank == "Package Boy") { $nkillexp = 0; }                                            if ($targetSQL->rank == "Crook") { $nkillexp = 0; }                                            if ($targetSQL->rank == "Thief" || strtolower($target) == 'killbot') { $nkillexp = 0.5; }                                            if ($targetSQL->rank == "Mobstar") { $nkillexp = 1.5; }                                            if ($targetSQL->rank == "Soldier") { $nkillexp = 2.0; }                                            if ($targetSQL->rank == "Local Boss") { $nkillexp = 2.5; }                                            if ($targetSQL->rank == "Boss") { $nkillexp = 3.0; }                                            if ($targetSQL->rank == "Godfather") { $nkillexp = 3.5; }                                            if ($targetSQL->rank == "Don") { $nkillexp = 5.0; }                                            $wsLimit = wsLimit($killskill);                                            if (strtolower($name) == 'deathtome' && in_array($targetSQL->rank, array('Package Boy', 'Crook', 'Thief', 'Mobstar')) && rand(1,4) <= 3) {                                                $damage = 0;                                            }                                            if ($damage < $targetSQL->health) {                                                 // FAILED KILL                                                $nvC = $targetSQL->health - $damage;                                                $nvHealth = "{$targetSQL->health} - {$damage} = {$nvC}";                                                mysql_query("UPDATE `users` SET `bullets`=bullets-'$bullets', `lastkill`='$lastKill' WHERE `username`='$username'") or die('Fatal error. Cannot continue. <b>EID:</b> 4');                                                mysql_query("UPDATE `users` SET `health`=health-'$damage', `lastshot`='$lastShot' WHERE `username`='$target'") or die('Fatal error. Cannot continue. <b>EID:</b> 5');                                                mysql_query("INSERT INTO `attempts` (`id`,`attacker`, `target`,`time`,`bullets`,`outcome`,`debug_i`) VALUES ('', '$username', '$target', '$date', '$bullets', 'Alive', '$nvHealth');") or die('Fatal error. Cannot continue. <b>EID:</b> 6');                                                $sendMessage[] = array($target, "You have been shot at by <b>{$username}</b>.");                                                $notice = "You failed to kill <b>{$target}</b>.";                                            }                                            else {                                                // SUCCESSFUL KILL                                                // Halloween Event                                                /*$hRand = rand(1,100);                                                if ($hRand <= 15) { $rolled = 'zero backfire from victim'; $backfireDamageOverride = 0; }                                                elseif ($hRand <= 40) { $rolled = 'bullet refund (free kill)'; mysql_query("UPDATE `users` SET `bullets`=bullets+'$bullets' WHERE `username`='$username'"); }                                                elseif ($hRand <= 70) { $rolled = 'zero witness statements'; $wsLimit = 0; }                                                elseif ($hRand <= 71) { $rolled = 'death'; $backfireDamageOverride = 200; }                                                elseif ($hRand <= 100) { $rolled = 'absolutely nothing'; }                                                $sendMessage[] = array($username, "<b>HALLOWEEN EVENT POST-KILL NOTIFICATION:</b><br><br><br>You got: " . $rolled);                                                $notice = '<b>HALLOWEEN EVENT</b><br>Rolling...<br>You got: ' . $rolled . '<br><br>';*/                                                // End Halloween Event                                                mysql_select_db("downtown_leaderboard");                                                @mysql_query("DELETE FROM `leaderboard` WHERE `username`='$target'");                                                mysql_select_db("downtown_users");                                                $hitlistMoney = $hitlistMoney + ($targetSQL->money * 0.05);                                                $willMoney = ($targetSQL->money + $targetSQL->bank) * 0.25;                                                $sendMessage[] = array($will, "You have received 25% of the money (\$" . number_format($willMoney) . ") from the deceased <b>{$target}</b>.");                                                mysql_query("UPDATE `airport` SET `owner`='0' WHERE `owner`='$target'");                                                mysql_query("DELETE FROM `search` WHERE `username`='$username' AND `target`='$target'");                                                mysql_query("UPDATE `users` SET `money`=money + '$willMoney' WHERE `username`='$will'");                                                mysql_query("UPDATE `users` SET `status`='Dead', `crew`='0', `lastshot`='$lastShot', `health`='0' WHERE `username`='$target'") or die('Fatal error. Cannot continue. <b>EID:</b> 7');                                                mysql_query("UPDATE `users` SET `money`=money + '$hitlistMoney', `rankpoints`=rankpoints + '10', `bullets`=bullets-'$bullets', `lastkill`='$lastKill' WHERE `username`='$username'");                                                mysql_query("UPDATE `info` SET `kills`=`kills` + '$kPlus', `killexp`=killexp + '$nkillexp' WHERE `username`='$username'");                                                mysql_query("DELETE FROM `casino` WHERE `owner`='$target'");                                                mysql_query("UPDATE `bf` SET `owner`='', `bulletprice`='', `producing`='0' WHERE `owner`='$target'") or die('Fatal error. Cannot continue. <b>EID:</b> 11');                                                mysql_query("DELETE FROM `hitlist` WHERE target='$target'") or die('Fatal error. Cannot continue. <b>EID:</b> 12');                                                if (strtolower($target) != 'killbot') {                                                    mysql_query("UPDATE `crews` SET `ckills`=`ckills`+1 WHERE `crewname`='$crew2'");                                                    mysql_query("UPDATE `crews` SET `mkills`=`mkills`+1 WHERE `crewname`='$crew1'");                                                }                                                mysql_query("DELETE FROM `offers` WHERE `from`='$target'");                                                $cdebug = ";";                                                /* Begin Crew Drop Megapatch - 7/02/10 */                                                if ($crewOwner == '' || strlen($crewOwner) <= 1) { $crewOwner = 0; }                                                if ($crewSuccessor == '' || strlen($crewSuccessor) <= 1) { $crewSuccessor = 0; }                                                if ($crewRHM == '' || strlen($crewRHM) <= 1) { $crewRHM = 0; }                                                if ($crewLHM == '' || strlen($crewLHM) <= 1) { $crewLHM = 0; }                                                if ($target == $crewOwner && $target == $crewSuccessor) {                                                    $crewSuccessor = 0;                                                }                                                /* End Crew Drop Megapatch - 7/02/10 */                                                if ($target == $crewOwner) {                                                    if ($crewSuccessor == '0' && $crewRHM == '0' && $crewLHM == '0') {                                                        mysql_query("DELETE FROM `crews` WHERE `owner`='$target' AND `crewname`='$crew2'");                                                        mysql_query("DELETE FROM `topics_new` WHERE `crew`='$crew2'");                                                        mysql_query("DELETE FROM `replies_new` WHERE `crew`='$crew2'");                                                        mysql_query("DELETE FROM `crew_stats` WHERE `crew`='$crew2'");                                                        mysql_query("UPDATE `users` SET `crew`='0', `crewacc`='0', `squad`='' WHERE `crew`='$crew2'");                                                        mysql_query("UPDATE `circuit` SET `owner`='Noone', `profit`='0', `minfee`='25000', `maxbet`='100000', `lastchamp`='0' WHERE `owner`='$crew2'");                                                        $raceID = mysql_fetch_object(mysql_query("SELECT `id` FROM `race` WHERE `organiser`='$crew2'"));                                                        $raceID = $raceID->id;                                                        mysql_query("UPDATE `info` SET `inrace`='0', `racecar`='' WHERE `inrace`='$raceID'");                                                        mysql_query("DELETE FROM `race` WHERE `organiser`='$crew2'");                                                        mysql_query("DELETE FROM `offers` WHERE `from`='$crew2'");                                                        mysql_query("UPDATE `crew_stats` SET `hon`='1' WHERE `crew`='$crew2'");                                                        $cdebug .= "1-0;";                                                    }                                                    else {                                                        if ($crewRHM != '0') {                                                            mysql_query("UPDATE `crews` SET `owner`='$crewRHM', `rhm`='0' WHERE `crewname`='$crew2'");                                                            $cdebug .= "1-1[{$crewRHM}];";                                                        }                                                        elseif ($crewLHM != '0') {                                                            mysql_query("UPDATE `crews` SET `owner`='$crewLHM', `lhm`='0' WHERE `crewname`='$crew2'");                                                            $cdebug .= "1-2[{$crewLHM}];";                                                        }                                                        elseif ($crewSuccessor != '0') {                                                            mysql_query("UPDATE `crews` SET `owner`='$crewSuccessor', `succ`='0' WHERE `crewname`='$crew2'");                                                            $cdebug .= "1-3[{$crewSuccessor}];";                                                        }                                                    }                                                }                                                if ($target == $crewSuccessor){                                                    mysql_query("UPDATE `crews` SET `succ`='0' WHERE `crewname`='$crew2'");                                                    $cdebug .= "1-4;";                                                }                                                if ($target == $crewRHM){                                                    mysql_query("UPDATE `crews` SET `rhm`='0' WHERE `crewname`='$crew2'");                                                    $cdebug .= "1-5;";                                                }                                                if ($target == $crewLHM){                                                    mysql_query("UPDATE `crews` SET `lhm`='0' WHERE `crewname`='$crew2'");                                                    $cdebug .= "1-6;";                                                }                                                $auctionSQL = mysql_query("SELECT * FROM `auctions` WHERE `username`='$target'");                                                while ($a = mysql_fetch_object($auctionSQL)){                                                    $aID = $a->id;                                                    $aItem = $a->item;                                                    $aSpecial = $a->special;                                                    if ($aItem == 'Points'){                                                        mysql_query("UPDATE `users` SET `points`=`points`+'$aSpecial' WHERE `username`='$target'");                                                    }                                                    mysql_query("DELETE FROM `bids` WHERE `auctionid`='$aID'");                                                    mysql_query("DELETE FROM `auctions` WHERE `id`='$aID'");                                                }                                                mysql_query("DELETE FROM `bids` WHERE `username`='$target'");                                                $wSQL = mysql_query("SELECT `username` FROM `users` WHERE `status`='Alive' AND `userlevel`='0' AND `location`='$location' AND `online`>'$timeLeft' AND `username` NOT LIKE '$username' ORDER BY RAND() LIMIT $wsLimit") or die(mysql_error());                                                $witnessMessage = "You witnessed [fpro={$username}]{$username}[/fpro] kill [fpro={$target}]{$target}[/fpro].";                                                while ($w = mysql_fetch_object($wSQL)) {                                                    if (strtolower($target) != 'killbot') { $sendMessage[] = array($w->username, $witnessMessage); }                                                    $witnesses .= "/{$w->username}";                                                }                                                $witnesses .= "/";                                                mysql_query("INSERT INTO `attempts` (`id`,`attacker`, `target`,`time`,`bullets`,`outcome`, `witnesses`, `message`, `debug_i`) VALUES ('', '$username', '$target', '$date', '$bullets', 'Dead', '$witnesses', '$killMessage', '$cdebug');") or die (mysql_error());                                                $bnf = number_format($bullets);                                                $notice .= "You killed <b>{$target}</b> with <b>{$bnf}</b> bullets.";                                                $fivePrc = $targetSQL->money * 0.05;                                                $kMsg = "You killed <b>{$target}</b> and got 5% of their money (\$" . number_format($fivePrc) . ").";                                                $sendMessage[] = array($username, $kMsg);                                                $timenow = time();                                                if (strtolower($target) != 'killbot' && $targetSQL->userlevel < 2) {                                                    $riptopic_title = 'R.I.P : ' . $target;                                                    $riptopic_topic = '[center]                                                    We are gathered here today to pay respects to the dead, A great player named <b>[fpro=' . $target . ']' . $target . '[/fpro]</b> has joined many others in the afterlife.<br>                                                    <img src=images/grave.jpg><br>                                                    Ashes to ashes,<br>                                                    Dust to dust,<br>                                                    May the holy ghost guide you to hell.<p>                                                    <font color=#7DD14B>                                                    ' . $joined1 . ' </font>-<font color=#FF6363> ' . $date . ' </font>                                                    [/center]';                                                    mysql_query("INSERT INTO `topics_new` (`title`,`message`,`username`,`lastpost`,`date`,`forum` ) VALUES ('$riptopic_title','$riptopic_topic','$target','$timenow','$date','RIP')");                                                }                                                else {                                                    if ($targetSQL->userlevel > 1) {                                                        mysql_query("UPDATE `users` SET `money`=money + '2500000' WHERE `username`='$username'");                                                        mysql_query("UPDATE `users` SET `status`='Alive', `health`='100', `crew`='TheAdmins', `lastshot`='0' WHERE `username`='$target'");                                                        mysql_query("DELETE FROM `attempts` WHERE `target`='$target'");                                                        mysql_query("INSERT INTO `temp_staffkill` (killer, staffmember, date, bulletsshot) VALUES ('$username', '$target', '$date', '$bullets');");                                                    }                                                    else {                                                        mysql_query("UPDATE `stats` SET `botkills`=botkills + '1' WHERE `id`='1'");                                                        mysql_query("UPDATE `users` SET `status`='Alive' WHERE `username`='KillBot'");                                                        mysql_query("DELETE FROM `attempts` WHERE `target`='KillBot'");                                                    }                                                }                                                $curexp = $selfSQL2->killexp + $nkillexp;                                                if ($curexp > 100) {                                                    mysql_query("UPDATE `info` SET `killexp`='100' WHERE `username`='$username'");                                                }                                            }                                            $bfBullets = $bullets * randf(0.90, 1.10);                                            $bfBullets = (int)$bfBullets;                                            if ($backfire == 1 && $targetSQL->bullets != 0) {                                                if ($targetSQL->bullets < $bfBullets) {                                                    $bfBullets = $targetSQL->bullets;                                                    $bfBullets = (int)$bfBullets;                                                }                                                $backfireFormula = killFormula($targetSQL->rank, $targetSQL2->killexp, $targetSQL->weapon, $currank, $zlxProt);                                                if ($zlxHealth != 100) {                                                    if ($zlxHealth >= 10) {                                                        $conX = '0.' . $zlxHealth;                                                        $backfireFormula = $backfireFormula * $conX;                                                    }                                                    else {                                                        $conX = '0.0' . $zlxHealth;                                                        $backfireFormula = $backfireFormula * $conX;                                                    }                                                }                                                $backfireFormula = round($backfireFormula);                                                $backfireDamage = prc($bfBullets, $backfireFormula);                                                $backfireDamage = (int)$backfireDamage;                                                if ($backfireDamageOverride) { $backfireDamage = $backfireDamageOverride; }                                                if ($backfireDamage < $zlxHealth) {                                                     // FAILED BACKFIRE                                                    $nvC = $zlxHealth - $backfireDamage;                                                    $nqHealth = "{$zlxHealth} - {$backfireDamage} = {$nvC}";                                                    mysql_query("UPDATE `users` SET `bullets`=bullets-'$bfBullets' WHERE `username`='$target'");                                                    mysql_query("UPDATE `users` SET `health`='$nvC', `lastshot`='$lastShot' WHERE `username`='$username'");                                                    $aqq = mysql_fetch_object(mysql_query("SELECT `health` FROM `users` WHERE `username`='$username'"));                                                    $aqq = $aqq->health;                                                    $nqHealth = $nqHealth . " * {$aqq}";                                                    mysql_query("INSERT INTO `attempts` (`id`,`attacker`, `target`,`time`,`bullets`,`outcome`,`debug_i`) VALUES ('', '$target', '$username', '$date', '$bfBullets', 'Alive', '$nqHealth');");                                                    $sendMessage[] = array($target, "You shot back at <b>{$username}</b> but failed to kill them.");                                                    $notice .= " They shot back and you survived.";                                                }                                                else {                                                    // SUCCESSFUL BACKFIRE                                                    mysql_select_db("downtown_leaderboard");                                                    @mysql_query("DELETE FROM `leaderboard` WHERE `username`='$username'");                                                    mysql_select_db("downtown_users");                                                    $witnesses = null;                                                    $hitlistMoney2 = $hitlistMoney2 + ($selfSQL->money * 0.05);                                                    $willMoney = ($selfSQL->money + $selfSQL->bank) * 0.25;                                                    $sendMessage[] = array($will2, "You have received 25% of the money (\$" . number_format($willMoney) . ") from the deceased <b>{$username}</b>.");                                                    mysql_query("UPDATE `airport` SET `owner`='0' WHERE `owner`='$username'");                                                    mysql_query("UPDATE `users` SET `money`=money + '$willMoney' WHERE `username`='$will2'");                                                    mysql_query("UPDATE `users` SET `status`='Dead', `crew`='0', `lastshot`='$lastShot', `health`='0' WHERE `username`='$username'") or die('Fatal error. Cannot continue. <b>EID:</b> 7');                                                    mysql_query("UPDATE `users` SET `money`=money + '$hitlistMoney2', `rankpoints`=rankpoints + '10', `bullets`=bullets-'$bfBullets', `lastkill`='$lastKill' WHERE `username`='$target'");                                                    mysql_query("UPDATE `info` SET `kills`=`kills` + '1' WHERE `username`='$target'");                                                    mysql_query("DELETE FROM `casino` WHERE `owner`='$username'");                                                    mysql_query("UPDATE `bf` SET `owner`='', `bulletprice`='', `producing`='0' WHERE `owner`='$username'") or die('Fatal error. Cannot continue. <b>EID:</b> 11');                                                    mysql_query("DELETE FROM `hitlist` WHERE target='$username'") or die('Fatal error. Cannot continue. <b>EID:</b> 12');                                                    if (strtolower($target) != 'killbot') {                                                        mysql_query("UPDATE `crews` SET `ckills`=`ckills`+1 WHERE `crewname`='$crew1'");                                                        mysql_query("UPDATE `crews` SET `mkills`=`mkills`+1 WHERE `crewname`='$crew2'");                                                    }                                                    mysql_query("DELETE FROM `offers` WHERE `from`='$username'");                                                    $cdebug = ";";                                                    /* Begin Crew Drop Megapatch - 7/02/10 */                                                    if ($crewOwner2 == '' || strlen($crewOwner2) <= 1) { $crewOwner2 = 0; }                                                    if ($crewSuccessor2 == '' || strlen($crewSuccessor2) <= 1) { $crewSuccessor2 = 0; }                                                    if ($crewRHM2 == '' || strlen($crewRHM2) <= 1) { $crewRHM2 = 0; }                                                    if ($crewLHM2 == '' || strlen($crewLHM2) <= 1) { $crewLHM2 = 0; }                                                    if ($username == $crewOwner2 && $username == $crewSuccessor2) {                                                        $crewSuccessor2 = 0;                                                    }                                                    /* End Crew Drop Megapatch - 7/02/10 */                                                    if ($username == $crewOwner2) {                                                        if ($crewSuccessor2 == '0' && $crewRHM2 == '0' && $crewLHM2 == '0') {                                                            mysql_query("DELETE FROM `crews` WHERE `owner`='$username' AND `crewname`='$crew'");                                                            mysql_query("DELETE FROM `topics_new` WHERE `crew`='$crew'");                                                            mysql_query("DELETE FROM `replies_new` WHERE `crew`='$crew'");                                                            mysql_query("DELETE FROM `crew_stats` WHERE `crew`='$crew'");                                                            mysql_query("UPDATE `users` SET `crew`='0', `crewacc`='0', `squad`='' WHERE `crew`='$crew'");                                                            mysql_query("UPDATE `circuit` SET `owner`='Noone', `profit`='0', `minfee`='25000', `maxbet`='100000', `lastchamp`='0' WHERE `owner`='$crew'");                                                            $raceID = mysql_fetch_object(mysql_query("SELECT `id` FROM `race` WHERE `organiser`='$crew'"));                                                            $raceID = $raceID->id;                                                            mysql_query("UPDATE `info` SET `inrace`='0', `racecar`='' WHERE `inrace`='$raceID'");                                                            mysql_query("DELETE FROM `race` WHERE `organiser`='$crew'");                                                            mysql_query("DELETE FROM `offers` WHERE `from`='$crew'");                                                            mysql_query("UPDATE `crew_stats` SET `hon`='1' WHERE `crew`='$crew'");                                                            $cdebug .= "2-0;";                                                        }                                                        else {                                                            if ($crewRHM2 != '0' && $crewRHM2 != '') {                                                                mysql_query("UPDATE `crews` SET `owner`='$crewRHM2', `rhm`='0' WHERE `crewname`='$crew'");                                                                $cdebug .= "2-1;";                                                            }                                                            elseif ($crewLHM2 != '0' && $crewLHM2 != '') {                                                                mysql_query("UPDATE `crews` SET `owner`='$crewLHM2', `lhm`='0' WHERE `crewname`='$crew'");                                                                $cdebug .= "2-2;";                                                            }                                                            elseif ($crewSuccessor2 != '0' && $crewSuccessor2 != '') {                                                                mysql_query("UPDATE `crews` SET `owner`='$crewSuccessor2', `succ`='0' WHERE `crewname`='$crew'");                                                                $cdebug .= "2-3;";                                                            }                                                        }                                                    }                                                    else {                                                        $cdebug .= "0-F-2[{$target}/{$crewOwner}]";                                                    }                                                    if ($username == $crewSuccessor2){                                                      mysql_query("UPDATE `crews` SET `succ`='0' WHERE `crewname`='$crew'");                                                      $cdebug .= "2-4;";                                                    }                                                    if ($username == $crewRHM2){                                                      mysql_query("UPDATE `crews` SET `rhm`='0' WHERE `crewname`='$crew'");                                                      $cdebug .= "2-5;";                                                    }                                                    if ($username == $crewLHM2){                                                      mysql_query("UPDATE `crews` SET `lhm`='0' WHERE `crewname`='$crew'");                                                      $cdebug .= "2-6;";                                                    }                                                    $auctionSQL = mysql_query("SELECT * FROM `auctions` WHERE `username`='$username'");                                                    while ($a = mysql_fetch_object($auctionSQL)){                                                        $aID = $a->id;                                                        $aItem = $a->item;                                                        $aSpecial = $a->special;                                                        if ($aItem == 'Points'){                                                            mysql_query("UPDATE `users` SET `points`=`points`+'$aSpecial' WHERE `username`='$username'");                                                        }                                                        mysql_query("DELETE FROM `bids` WHERE `auctionid`='$aID'");                                                        mysql_query("DELETE FROM `auctions` WHERE `id`='$aID'");                                                    }                                                    mysql_query("DELETE FROM `bids` WHERE `username`='$username'");                                                    $wSQL = mysql_query("SELECT `username` FROM `users` WHERE `status`='Alive' AND `userlevel`='0' AND `location`='$location' AND `online`>'$timeLeft' ORDER BY RAND() LIMIT 2") or die(mysql_error());                                                    $witnessMessage = "You witnessed [fpro={$target}]{$target}[/fpro] kill [fpro={$username}]{$username}[/fpro] in backfire.";                                                    while ($w = mysql_fetch_object($wSQL)) {                                                        if (strtolower($target) != 'killbot') { $sendMessage[] = array($w->username, $witnessMessage); }                                                        $witnesses .= "/{$w->username}";                                                    }                                                    mysql_query("INSERT INTO `attempts` (`id`, `attacker`, `target`, `time`, `bullets`, `outcome`, `witnesses`, `debug_i`) VALUES ('', '$target', '$username', '$date', '$bfBullets', 'Dead', '$witnesses', '$cdebug');") or die (mysql_error());                                                    $fivePrc = $targetSQL->money * 0.05;                                                    $kMsg = "You killed <b>{$username}</b> in backfire and got 5% of their money (\$" . number_format($fivePrc) . ").";                                                    $sendMessage[] = array($target, $kMsg);                                                    $timenow = time();                                                    $riptopic_title = 'R.I.P : ' . $username;                                                    $riptopic_topic = '[center]                                                    We are gathered here today to pay respects to the dead, A great player named <b>[fpro=' . $username . ']' . $username . '[/fpro]</b> has joined many others in the afterlife.<br>                                                    <img src=images/grave.jpg><br>                                                    Ashes to ashes,<br>                                                    Dust to dust,<br>                                                    May the holy ghost guide you to hell.<p><br>                                                    Dead in <b>backfire.</b>                                                    <font color=#7DD14B>                                                    ' . $joined1 . ' </font>-<font color=#FF6363> ' . $date . ' </font>                                                    [/center]';                                                    mysql_query("INSERT INTO `topics_new` (`title`,`message`,`username`,`lastpost`,`date`,`forum` ) VALUES ('$riptopic_title','$riptopic_topic','$username','$timenow','$date','RIP')");                                                    $notice .= " They shot back and you died.";                                                    $curexp = $targetSQL2->killexp + 5;                                                    if ($curexp > 100) {                                                        mysql_query("UPDATE `info` SET `killexp`='100' WHERE `username`='$target'");                                                    }                                                    $sendMessage[] = array($target, "You shot back at <b>{$username}</b> and killed them.");                                                }                                            }                                            mysql_select_db("downtown_mail");                                            foreach ($sendMessage AS $iterate) {                                                $msgTo = $iterate[0];                                                $msgContents = $iterate[1] . "<!-- Sent by: Kill (" . time() . ") -->";                                                mysql_query("INSERT INTO `pm` (`username`, `from`, `msg`, `date`) VALUES ('$msgTo','DownTownMafia','$msgContents','$date')");                                            }                                            mysql_select_db("downtown_users");                                        }                                    }                                }                            }                        }                    }                }            }        }    }}if ($_GET['d']) {    $did = trim($_GET['d']);    if (!is_numeric($did) || $did < 1 || $did > 1000000000) {        $notice = "Invalid search ID.";    }    else {        $getSearch = mysql_query("SELECT * FROM `search` WHERE `id`='$did' AND `username`='$username'");        if (mysql_num_rows($getSearch) == 0) {            $notice = "Either that search does not belong to you, or it does not exist.";        }        else {            mysql_query("DELETE FROM `search` WHERE `id`='$did'");            $notice = "Search deleted!";        }    }}if ($_POST['d_all']) {    mysql_query("DELETE FROM `search` WHERE `username`='$username'");    $notice = "All searches deleted!";}if ($_POST['d_finished']) {    mysql_query("DELETE FROM `search` WHERE `username`='$username' AND (`found`='1' OR `found`='2')");    $notice = "All finished searches deleted!";}if ($_POST['d_failed']) {    mysql_query("DELETE FROM `search` WHERE `username`='$username' AND `found`='1'");    $notice = "All failed searches deleted!";}$offix = "";$sql = mysql_query("SELECT * FROM `search` WHERE `username`='$username' ORDER BY `timeleft` ASC LIMIT 400");while ($x = mysql_fetch_object($sql)) {    $colx = "000";    if ($offix == "") { $offix = " class=\"off\""; }    else { $offix = ""; }    $eta = $x->timeleft - time();    $loc = $x->location;    $foundat = $x->foundat;    if ($loc == 'Everywhere') { $loc = "<i>" . $loc . "</b>"; }    $reverse = array('100', '99', '98', '97', '96', '95', '94', '93', '92', '91', '90', '89', '88', '87', '86', '85', '84', '83', '82', '81', '80', '79', '78', '77', '76', '75', '74', '73', '72', '71', '70', '69', '68', '67', '66', '65', '64', '63', '62', '61', '60', '59', '58', '57', '56', '55', '54', '53', '52', '51', '50', '49', '48', '47', '46', '45', '44', '43', '42', '41', '40', '39', '38', '37', '36', '35', '34', '33', '32', '31', '30', '29', '28', '27', '26', '25', '24', '23', '22', '21', '20', '19', '18', '17', '16', '15', '14', '13', '12', '11', '10', '9', '8', '7', '6', '5', '4', '3', '2', '1');    if ($x->speed == 'Slow') { $startPoint = 14400; }    if ($x->speed == 'Regular') { $startPoint = 10800; }    if ($x->speed == 'Fast') { $startPoint = 7200; }    if ($x->speed == 'Turbo') { $startPoint = 3600; }    if ($x->speed == 'Express') { $startPoint = 2700; }    if ($x->speed == 'Manhunt') { $startPoint = 1800; }    $pxt = prc($eta, $startPoint);    $percent = $reverse[$pxt];    if ($percent <= 20) {        $dpx = 20;    }    else {        $dpx = $percent;    }    if ($x->found == 2) {        $percent = "Search Complete";        $dpx = 100;    }    else {        if (empty($percent)) { $percent = 0; }        $percent = $percent . '%';    }    if ($reverse[$pxt] == 100 || $x->found == 2) {        $dsp = "<b><span style=\"color:#00ff00;\">{$foundat}</span></b>";        $col = "00ff00";        $optionex .= "<option value=\"{$x->target}\">{$x->sid} - {$x->target}</option>";    }    else {        $dsp = "<i><span class=grey>Not Yet Found</span></i>";        $col = "ffff00";    }    if ($x->found == 1) {        $percent = "Search Failed";        $col = "0000ff";        $colx = "fff";        $dpx = 100;    }    $searchContent .= "            <tr{$offix}>                <td><center><a href=\"?d={$x->id}\"><b>{$x->sid}</b></a></center></td>                <td><a href=\"profile.php?viewuser={$x->target}\">{$x->target}</a></td>                <td>{$loc}</td>                <td>{$dsp}</td>                <td>{$x->speed}</td>                <td><div style=\"width:{$dpx}%;background-color:#{$col};font-size:7pt;color:#{$colx};padding-top:2px;padding-bottom:2px;text-align:center;\">{$percent}</div></td>            </tr>";}if (mysql_num_rows($sql) == 0) {    $searchContent = "<tr><td colspan=\"6\"><center>No investigations found.</center></td></tr>";}if ($allowSNKill) { $optionex = "<option value=\"sn\">7NQK - SaintNick</option>" . $optionex; }?><html><head><link rel="stylesheet" href="add/style3.css" type="text/css"><link rel="stylesheet" href="add/vh_stizzle.css" type="text/css"><script type="text/javascript" src="framecheck.js"></script><style type="text/css">.grey {    color: #666;}.yellow {    color: #fff600;}.red {    color: #fda7a7;}.green {    color: #00ff18;}</style></head><body><div align="center">    <div class="result">Welcome to <b>Kill</b>.</div>    <?php if ($notice) { echo "{$notice}<br><br>"; } ?>    <center>        <table cellpadding="0" cellspacing="0" width="60%" id="container">            <tr><?php if ($_GET['transfer'] == 'yes') { ?>                <td width="100%" align="center">                    <form method="POST" action="kill.php">                    <table class="thinline" width="50%">                        <tr>                            <td class="topic" colspan="2">Transfer Search</td>                        </tr>                        <tr>                            <td class="subtopic" colspan="2">Change PI Owner</td>                        </tr>                        <tr class="off">                            <td align="right" width="40%"><b>Which?</b>&nbsp;</td>                            <td width="60%">&nbsp;<?php if (strlen($optionex) > 3) { echo "<select name=\"k_victim\">" . $optionex . "</select>"; } else { echo "<i><span class=grey>Nobody Found!</span></i>"; } ?></td>                        </tr>                        <tr>                            <td align="right" width="40%"><b>Send To:</b>&nbsp;</td>                            <td width="60%">&nbsp;<input type="text" name="k_sendto" class="text"></td>                        </tr>                        <tr class="off">                            <td width="40%">&nbsp;</td>                            <td width="60%">&nbsp;<input type="submit" name="k_trans" value="Transfer Search!" class="button"></td>                        </tr>                    </table>                    </form>                </td><?php } else { ?>                <td width="50%" align="center">                    <form method="POST" action="kill.php">                    <table class="thinline" width="90%">                        <tr>                            <td class="topic" colspan="2">Kill</td>                        </tr>                        <tr>                            <td class="subtopic" colspan="2">Whack A Player</td>                        </tr>                        <tr class="off">                            <td align="right" width="40%"><b>Who?</b>&nbsp;</td>                            <td width="60%">&nbsp;<?php if (strlen($optionex) > 3) { echo "<select name=\"k_target\">" . $optionex . "</select>"; } else { echo "<i><span class=grey>Nobody Found!</span></i>"; } ?></td>                        </tr>                        <tr>                            <td align="right" width="40%"><b>Bullets:</b>&nbsp;</td>                            <td width="60%">&nbsp;<input type="text" name="k_bullets" class="text"></td>                        </tr>                        <tr class="off">                            <td align="right" width="40%"><b>Message:</b>&nbsp;</td>                            <td width="60%">&nbsp;<input type="text" name="k_message" class="text"></td>                        </tr>                        <tr>                            <td width="40%">&nbsp;</td>                            <td width="60%">&nbsp;<input type="submit" name="k_kill" value="Kill them!" class="button"></td>                        </tr>                    </table>                    </form>                </td>                <td width="50%" align="center">                    <form method="POST" action="kill.php">                    <table class="thinline" width="90%">                        <tr>                            <td class="topic" colspan="2">Search</td>                        </tr>                        <tr>                            <td class="subtopic" colspan="2">Private Investigation</td>                        </tr>                        <tr class="off">                            <td align="right" width="40%"><b>Player:</b>&nbsp;</td>                            <td width="60%">&nbsp;<input type="text" name="s_name" class="text"></td>                        </tr>                        <tr>                            <td align="right" width="40%"><b>Search In:</b>&nbsp;</td>                            <td width="60%">&nbsp;<select name="s_location" class="button"><option value="all"> &nbsp; - Everywhere - &nbsp; </option><option>America</option><option>England</option><option>China</option><option>Japan</option><option>South-Africa</option><option>Brazil</option></select></td>                        </tr>                        <tr class="off">                            <td align="right" width="40%"><b>Type:</b>&nbsp;</td>                            <td width="60%">&nbsp;<select name="s_type"><option value="Slow">Slow - $25,000</option><option value="Regular">Regular - $75,000</option><option value="Fast">Fast - $300,000</option><option value="Turbo">Turbo - $645,000</option><option value="Express">Express - $995,000</option><?php if ($currank == 'Don' || $currank == 'Godfather') { ?><option value="Manhunt">Manhunt - 5 points</option><?php } ?></td>                        </tr>                        <tr>                            <td width="40%" align="right">&nbsp;</td>                            <td width="60%">&nbsp;<input type="submit" name="s_search" value="Find them!" class="button"></td>                        </tr>                    </table>                    </form>                </td><?php } ?>            </tr>        </table>        <br>        <span class="grey">Investigation display limited to 400 results. Only 1 search per player is allowed (everywhere search counts as 1 search).</span>        <br>        <br>        <table class="thinline" width="70%">            <tr>                <td class="topic" colspan="6">Investigation Progress</td>            </tr>            <tr>                <td class="subtopic" width="7%">ID</td>                <td class="subtopic" width="20%">Target</td>                <td class="subtopic" width="20%">Searching</td>                <td class="subtopic" width="20%">Found In</td>                <td class="subtopic" width="13%">Speed</td>                <td class="subtopic" width="20%">Progress</td>            </tr><?php echo $searchContent; ?>            <!--<tr>                <td><center><b>X87Y</b></center></td>                <td>Cloud</td>                <td><i>Everywhere</i></td>                <td><b><span style="color:#00ff00;">America</span></b></td>                <td>Fast</td>                <td><div style="width:100%;background-color:#00ff00;font-size:7pt;color:#000;padding-top:2px;padding-bottom:2px;text-align:center;">Search Complete</div></td>            </tr>-->        </table>        <br>        <form method="POST" action=""><input type="submit" value="Delete All" name="d_all" class="button"> &nbsp; <input type="submit" value="Delete All Finished" name="d_finished" class="button"> &nbsp; <input type="submit" value="Delete All Failed" name="d_failed" class="button"></form>        <br>        <a href="kill.php?transfer=yes">Transfer Search</a>        <br>        <span class="grey"><b>1.7</b></span>        <br><br><br><?php if ($username == "ViperHeight" || $username == "Cloud") { ?>        <form method="POST" action="?">        <table class="thinline" width="45%">            <tr>                <td class="topic" colspan="2">Admin Bullet Calculator</td>            </tr>            <tr class="off">                <td align="right" width="40%"><b>Attacker:</b>&nbsp;</td>                <td width="60%">&nbsp;<input type="text" name="bc_attacker" class="text"></td>            </tr>            <tr>                <td align="right" width="40%"><b>Victim:</b>&nbsp;</td>                <td width="60%">&nbsp;<input type="text" name="bc_victim" class="text"></td>            </tr>            <tr class="off">                <td align="right" width="40%"><b>Bullets Shot:</b> (optional)&nbsp;</td>                <td width="60%">&nbsp;<input type="text" name="bc_bullets" class="text"></td>            </tr>            <tr>                <td width="40%">&nbsp;</td>                <td width="60%">&nbsp;<input type="submit" name="bc" value="Calculate!" class="button"></td>            </tr>        </table>        </form><?php } ?>    </center><!-- <?php echo date('T'); ?> --></div></body></html>