11-12-2010, 08:50 PM
Comme vous verrez il n'y a pas de requete tel quel pour la recherche de la ville ..
Sinon bien je suis dans les patates mdr
je vais montrer la page complete comme sa vous pouvez voir plus a profondi
Désoler mais moi et l'orthographe ses 2 pas très douer coté orthographe
Sinon bien je suis dans les patates mdr
je vais montrer la page complete comme sa vous pouvez voir plus a profondi
Désoler mais moi et l'orthographe ses 2 pas très douer coté orthographe
<?php
include("lib.php");
define("PAGENAME", "Ville");
$player = check_user($secret_key, $db);
$img = "<img src=images/ville_logo.PNG border=0 align=absmiddle><br /><br />";
if ($player->cache == 0 && $player->prison == 0) {
switch($_GET['act'])
{
case "attack":
if (!$_GET['username']) //No username entered
{
header("Location: battle1.php");
break;
}
//Otherwise, get player data:
$query = $db->execute("select * from `players` where `username`=?", array($_GET['username']));
if ($query->recordcount() == 0) //Player doesn't exist
{
include("templates/private_header.php");
echo "<div class=\"contenu\">
<div class=\"contenu_bloc\">
<h1>Ville</h1>";
echo "Ce joueur n'existe pas ou est cacher !";
include("templates/private_footer.php");
break;
}
$requete = $db->execute("select * from `players` where `username`=?", array($_GET['username']));
$fucked = $requete->fetchrow();
if ($fucked['cache'] == 1) //Player cacher
{
include("templates/private_header.php");
echo "<div class=\"contenu\">
<div class=\"contenu_bloc\">
<h1>Ville</h1>";
echo "Ce joueur s'est cacher (quelle tappette) !";
include("templates/private_footer.php");
break;
}
if ($fucked['prison'] == 1) //Player cacher
{
include("templates/private_header.php");
echo "<div class=\"contenu\">
<div class=\"contenu_bloc\">
<h1>Ville</h1>";
echo "Ce joueur est dans la cité !";
include("templates/private_footer.php");
break;
}
if ($fucked['energy'] == 0) //Player cacher
{
include("templates/private_header.php");
echo "<div class=\"contenu\">
<div class=\"contenu_bloc\">
<h1>Ville</h1>";
echo "Pas asser de pa !";
include("templates/private_footer.php");
break;
}
if ($fucked['energy'] == 0) //Player cacher
{
include("templates/private_header.php");
echo "<div class=\"contenu\">
<div class=\"contenu_bloc\">
<h1>Ville</h1>";
echo "^u a plus de pa !";
include("templates/private_footer.php");
break;
}
if ($fucked['banni'] == 1) //Player cach�
{
include("templates/private_header.php");
echo "<div class=\"contenu\">
<div class=\"contenu_bloc\">
<h1>Ville</h1>";
echo "Ce joueur est banni fils de pute de tricheur !";
include("templates/private_footer.php");
break;
}
if ($fucked['cachette'] == 1) //Player cach�
{
include("templates/private_header.php");
echo "<div class=\"contenu\">
<div class=\"contenu_bloc\">
<h1>Ville</h1>";
echo "Ce joueur s'est caché tros longtemps !";
include("templates/private_footer.php");
break;
}
$enemy1 = $query->fetchrow(); //Get player info
foreach($enemy1 as $key=>$value)
{
$enemy->$key = $value;
}
if ($enemy->level != $player->level)
{
include("templates/private_header.php");
echo "Vos quartier sont différents.";
include("templates/private_footer.php");
break;
}
if ($player->level == 1)
{
include("templates/private_header.php");
echo "Tu ne peux pas attaquer au niveau 1 !<br />";
echo "<br /><a href=monter.php>Monter au niveau 2</a> <font color=white>[500 000$]</font>";
include("templates/private_footer.php");
break;
}
if ($enemy->ville != $player->ville)
{
include("templates/private_header.php");
echo "Vos quartier sont différents. Tu ne peux attaquer que quelqu'un de ton quartier !";
include("templates/private_footer.php");
break;
}
if ($enemy->gang == $player->gang && $player->gang > 0)
{
include("templates/private_header.php");
echo "Pourquoi attaquer ton pote de gang ?";
include("templates/private_footer.php");
break;
}
//Otherwise, check if player has any health
if ($enemy->hp == 0)
{
include("templates/private_header.php");
echo "<div class=\"contenu\">
<div class=\"contenu_bloc\">
<h1>Ville</h1>";
echo "Ce joueur est mort !";
include("templates/private_footer.php");
break;
}
//Player cannot attack anymore
if ($player->energy == 0)
{
include("templates/private_header.php");
echo "<div class=\"contenu\">
<div class=\"contenu_bloc\">
<h1>Ville</h1>";
echo "Tu n'as plus de PA.";
include("templates/private_footer.php");
break;
}
//Player is dead
if ($player->hp == 0)
{
include("templates/private_header.php");
echo "Tu es mort ! Va faire un tour a l'infirmerie !";
include("templates/private_footer.php");
break;
}
if ($player->energy == 0)
{
include("templates/private_header.php");
echo "Tu es mort ! Va faire un tour a l'infirmerie !";
include("templates/private_footer.php");
break;
}
if ($enemy->username == $player->username)
{
include("templates/private_header.php");
echo "<div class=\"contenu\">
<div class=\"contenu_bloc\">
<h1>Ville</h1>";
echo "Tu ne peux pas t'attaquer toi meme. Enfin voyons !";
include("templates/private_footer.php");
break;
}
//Get enemy's bonuses from equipment
$query = $db->query("select blueprint_items.effectiveness, blueprint_items.name from `items`, `blueprint_items` where blueprint_items.id=items.item_id and items.player_id=? and blueprint_items.type='weapon' and items.status='equipped'", array($enemy->id));
$enemy->atkbonus = ($query->recordcount() == 1)?$query->fetchrow():0;
$query = $db->query("select blueprint_items.effectiveness, blueprint_items.name from `items`, `blueprint_items` where blueprint_items.id=items.item_id and items.player_id=? and blueprint_items.type='armour' and items.status='equipped'", array($enemy->id));
$enemy->defbonus = ($query->recordcount() == 1)?$query->fetchrow():0;
//Get player's bonuses from equipment
$query = $db->query("select blueprint_items.effectiveness, blueprint_items.name from `items`, `blueprint_items` where blueprint_items.id=items.item_id and items.player_id=? and blueprint_items.type='weapon' and items.status='equipped'", array($player->id));
$player->atkbonus = ($query->recordcount() == 1)?$query->fetchrow():0;
$query = $db->query("select blueprint_items.effectiveness, blueprint_items.name from `items`, `blueprint_items` where blueprint_items.id=items.item_id and items.player_id=? and blueprint_items.type='armour' and items.status='equipped'", array($player->id));
$player->defbonus = ($query->recordcount() == 1)?$query->fetchrow():0;
//Calculate some variables that will be used
$enemy->strdiff = (($enemy->strength - $player->strength) > 0)?($enemy->strength - $player->strength):0;
$enemy->vitdiff = (($enemy->vitality - $player->vitality) > 0)?($enemy->vitality - $player->vitality):0;
$enemy->agidiff = (($enemy->agility - $player->agility) > 0)?($enemy->agility - $player->agility):0;
$player->strdiff = (($player->strength - $enemy->strength) > 0)?($player->strength - $enemy->strength):0;
$player->vitdiff = (($player->vitality - $enemy->vitality) > 0)?($player->vitality - $enemy->vitality):0;
$player->agidiff = (($player->agility - $enemy->agility) > 0)?($player->agility - $enemy->agility):0;
$totalstr = $enemy->strength + $player->strength;
$totalvit = $enemy->vitality + $player->vitality;
$totalagi = $enemy->agility + $player->agility;
//Calculate the damage to be dealt by each player (dependent on strength and vitality)
$enemy->maxdmg = (($enemy->strength * 2) + $enemy->atkbonus['effectiveness']) - ($player->defbonus['effectiveness']);
$enemy->maxdmg = $enemy->maxdmg - intval($enemy->maxdmg * ($player->vitdiff / $totalvit));
$enemy->maxdmg = ($enemy->maxdmg <= 2)?2:$enemy->maxdmg; //Set 2 as the minimum damage
$enemy->mindmg = (($enemy->maxdmg - 4) < 1)?1$enemy->maxdmg - 4); //Set a minimum damage range of maxdmg-4
$player->maxdmg = (($player->strength * 2) + $player->atkbonus['effectiveness']) - ($enemy->defbonus['effectiveness']);
$player->maxdmg = $player->maxdmg - intval($player->maxdmg * ($enemy->vitdiff / $totalvit));
$player->maxdmg = ($player->maxdmg <= 2)?2:$player->maxdmg; //Set 2 as the minimum damage
$player->mindmg = (($player->maxdmg - 4) < 1)?1$player->maxdmg - 4); //Set a minimum damage range of maxdmg-4
//Calculate battle 'combos' - how many times in a row a player can attack (dependent on agility)
$enemy->combo = ceil($enemy->agility / $player->agility);
$enemy->combo = ($enemy->combo > 3)?3:$enemy->combo;
$player->combo = ceil($player->agility / $enemy->agility);
$player->combo = ($player->combo > 3)?3:$player->combo;
//Calculate the chance to miss opposing player
$enemy->miss = intval(($player->agidiff / $totalagi) * 100);
$enemy->miss = ($enemy->miss > 20)?20:$enemy->miss; //Maximum miss chance of 20% (possible to change in admin panel?)
$enemy->miss = ($enemy->miss <= 5)?5:$enemy->miss; //Minimum miss chance of 5%
$player->miss = intval(($enemy->agidiff / $totalagi) * 100);
$player->miss = ($player->miss > 20)?20:$player->miss; //Maximum miss chance of 20%
$player->miss = ($player->miss <= 5)?5:$player->miss; //Minimum miss chance of 5%
$battlerounds = 2; //Maximum number of rounds/turns in the battle. Changed in admin panel?
$output = ""; //Output message
//While somebody is still alive, battle!
while ($enemy->hp > 0 && $player->hp > 0 && $battlerounds > 0)
{
$attacking = ($player->agility >= $enemy->agility)?$player:$enemy;
$defending = ($player->agility >= $enemy->agility)?$enemy:$player;
for($i = 0;$i < $attacking->combo;$i++)
{
//Chance to miss?
$misschance = intval(rand(0, 100));
if ($misschance <= $attacking->miss)
{
$output .= $attacking->username . " a essayer d'attaquer " . $defending->username . " mais a rater !<br />";
}
else
{
$damage = rand($attacking->mindmg, $attacking->maxdmg); //Calculate random damage
$defending->hp -= $damage;
$output .= ($player->username == $defending->username)?"<font color=\"red\">":"<font color=\"green\">";
$output .= $attacking->username . " attaque " . $defending->username . " pour <b>" . $damage . "</b> degats ! (";
$output .= ($defending->hp > 0)?$defending->hp . " Vie restante":"Mort";
$output .= ")<br />";
$output .= "</font>";
//Check if anybody is dead
if ($defending->hp <= 0)
{
$player = ($player->agility >= $enemy->agility)?$attacking:$defending;
$enemy = ($player->agility >= $enemy->agility)?$defending:$attacking;
break 2; //Break out of the for and while loop, but not the switch structure
}
}
$battlerounds--;
if ($battlerounds <= 0)
{
break 2; //Break out of for and while loop, battle is over!
}
}
for($i = 0;$i < $defending->combo;$i++)
{
//Chance to miss?
$misschance = intval(rand(0, 100));
if ($misschance <= $defending->miss)
{
$output .= $defending->username . " a essayer d'attaquer " . $attacking->username . " mais a louper !<br />";
}
else
{
$damage = rand($defending->mindmg, $defending->maxdmg); //Calculate random damage
$attacking->hp -= $damage;
$output .= ($player->username == $defending->username)?"<font color=\"green\">":"<font color=\"red\">";
$output .= $defending->username . " attaque " . $attacking->username . " pour <b>" . $damage . "</b> degats ! (";
$output .= ($attacking->hp > 0)?$attacking->hp . " Vie restante :":"Mort";
$output .= ")<br />";
$output .= "</font>";
//Check if anybody is dead
if ($attacking->hp <= 0)
{
$player = ($player->agility >= $enemy->agility)?$attacking:$defending;
$enemy = ($player->agility >= $enemy->agility)?$defending:$attacking;
break 2; //Break out of the for and while loop, but not the switch structure
}
}
$battlerounds--;
if ($battlerounds <= 0)
{
break 2; //Break out of for and while loop, battle is over!
}
}
$player = ($player->agility >= $enemy->agility)?$attacking:$defending;
$enemy = ($player->agility >= $enemy->agility)?$defending:$attacking;
}
if ($player->hp <= 0)
{
$date = date("d/m H:i");
$meurtre = "[ " . $date . " N" . $player->level . " ] <a href=profile.php?id=" . $enemy->username . ">" . $enemy->username . "</a> a défoncer <a href=profile.php?id=" . $player->username . ">" . $player->username . "</a> pour " . $player->contrat . " $\n";
$tfile = 'logs.txt';
if (file_exists($tfile)) {
$file = file($tfile);
$fp = fopen("$tfile", "w+");
fwrite($fp,$meurtre);
if (is_array($file)) {
while (list(, $line) = each($file)) {
fwrite($fp, $line);
}
}
}
fclose($fp);
$insert['player'] = $enemy->username;
$insert['time'] = date("H:i");
$insert['level'] = $enemy->level;
$insert['killed'] = $player->username;
$insert['contrat'] = $player->contrat;
$insert['gang'] = $enemy->gang;
$insert['ville'] = $player->Quartier;
$insert['ville'] = $enemy->Quartier;
$insert['td'] = "a defoncer";
$query = $db->autoexecute('meurtres', $insert, 'INSERT');
//Calculate losses
$exploss1 = $player->level * 6;
$exploss2 = (($player->level - $enemy->level) > 0)?($enemy->level - $player->level) * 4:0;
$exploss = $exploss1 + $exploss2;
$goldloss = intval(0.2 * $player->gold);
$goldloss = intval(rand(1, $goldloss));
$output .= "<br /><u>Tu as été tué par " . $enemy->username . " !</u><br />";
$output .= "<br />Tu perds <b></b>toutes tes $.";
$goldloss2 = (($player->gold - $goldloss) <= 0)?0:$goldloss;
//Update player (the loser)
$query = $db->execute("update `players` set `energy`=?, `stat_points`=5, `deaths`=?, `hp`=0, `level`=1, `maxhp`=50, `strength`=1, `vitality`=1, `agility`=1, `contrat`=0, `bank`=0, `gold`=?, `cnd`=0 where `id`=?", array($player->energy - 2, $player->deaths + 1, $player->gold = $player->cnd, $player->id));
$query = $db->execute("update `players` set `shit`=0, `beuh`=0, `lsd`=0, `coke`=0, `hero`=0, `morphine`=0, `crack`=0 where id`=?", array($player->id));
$query = $db->execute("DELETE FROM `items` WHERE `player_id` = ?", array($player->id));
//123456
// HERE HERE HERE
//Update enemy (the winner)
if ($exploss + $enemy->exp < $enemy->maxexp)
{
$query = $db->execute("update `players` set `gold`=?, `kills`=?, `hp`=? where `id`=?", array($enemy->exp + $exploss + $enemy->gold + $goldloss + $player->contrat, $enemy->kills + 1, $enemy->hp, $enemy->id));
$query = $db->execute("update `gangs` set `kills`=`kills`+1 where `id`=?", array($enemy->gang));
//Add log message for winner
$logmsg = "Tu as ete attaquer par <a href=\"profile.php?id=" . $player->username . "\">" . $player->username . "</a> mais tu l'a tué !<br />\nTu remportes donc " . $goldloss . " $. Tu récupères le contrat de " . $player->contrat . " $. <br />";
addlog($enemy->id, $logmsg, $db);
}
else //Defender has gained a level! =)
{
if ($enemy->level == 100) {
$query = $db->execute("update `players` set `gold`=?, `kills`=? where `id`=?", array($enemy->gold + $goldloss, $enemy->kills + 1, $enemy->id));
$query = $db->execute("update `gangs` set `kills`=`kills`+1 where `id`=?", array($enemy->gang));
}
else {
$query = $db->execute("update `players` set `stat_points`=?, `level`=?, `maxexp`=?, `gold`=?, `kills`=?, `hp`=?, `maxhp`=? where `id`=?", array($enemy->stat_points + 3, $enemy->level + 1, ($enemy->level+1) * 70 - 20, ($enemy->exp + $exploss) - $enemy->maxexp, $enemy->gold + $goldloss, $enemy->kills + 1, $enemy->maxhp + 30, $enemy->maxhp + 30, $enemy->id));
$query = $db->execute("update `gangs` set `kills`=`kills`+1 where `id`=?", array($enemy->gang));
//Add log message for winner
$logmsg = "Tu as ete attaquer par <a href=\"profile.php?id=" . $player->username . "\">" . $player->username . "</a> et tu l'as tu� !";
addlog($enemy->id, $logmsg, $db);
}
}
}
else if ($enemy->hp <= 0)
{
$date = date("d/m H:i");
$meurtre = "[ " . $date . " N" . $player->level . " ] <a href=profile.php?id=" . $player->username . ">" . $player->username . "</a> a tué <a href=profile.php?id=" . $enemy->username . ">" . $enemy->username . "</a> pour " . $enemy->contrat . " $\n";
$tfile = 'logs.txt';
if (file_exists($tfile)) {
$file = file($tfile);
$fp = fopen("$tfile", "w+");
fwrite($fp,$meurtre);
if (is_array($file)) {
while (list(, $line) = each($file)) {
fwrite($fp, $line);
}
}
}
fclose($fp);
$insert['player'] = $player->username;
$insert['time'] = date("H:i");
$insert['level'] = $player->level;
$insert['killed'] = $enemy->username;
$insert['contrat'] = $enemy->contrat;
$insert['gang'] = $player->gang;
$insert['ville'] = $player->Quartier;
$insert['ville'] = $enemy->ville;
$insert['td'] = "a tuer";
$query = $db->autoexecute('meurtres', $insert, 'INSERT');
//Calculate losses
$expwin1 = $enemy->level * 6;
$expwin2 = (($player->level - $enemy->level) > 0)?$expwin1 - (($player->level - $enemy->level) * 3):$expwin1 + (($player->level - $enemy->level) * 3);
$expwin2 = ($expwin2 <= 0)?1:$expwin2;
$expwin3 = round(0.6 * $expwin2);
$expwin = ceil(rand($expwin3, $expwin2));
$goldwin = ceil(10 * $enemy->level);
$output .= "<br /><u>Tu as tué " . $enemy->username . "!</u><br />";
$output .= "<br />Tu gagnes <b>" . $goldwin . "</b> $. Tu récupères le contrat de " . $enemy->contrat . " $.";
//HERE HERE HERE
if ($expwin + $player->exp >= $player->maxexp) //Player gained a level!
{
//Update player, gained a level
if ($player->level == 100) {
$query = $db->execute("update `players` set `gold`=?, `kills`=? where `id`=?", array($player->gold + $goldloss, $enemy->kills + 1, $player->id));
$query = $db->execute("update `gangs` set `kills`=`kills`+1 where `id`=?", array($player->gang));
}
else {
$output .= "<br /><b>Tu augmentes de niveau !</b>";
$newexp = $expwin + $player->exp - $player->maxexp;
$query = $db->execute("update `players` set `stat_points`=?, `level`=?, `maxexp`=?, `maxhp`=?, `exp`=?, `gold`=?, `kills`=?, `hp`=?, `energy`=? where `id`=?", array($player->stat_points + 3, $player->level + 1, ($player->level+1) * 70 - 20, $player->maxhp + 30, $newexp, $player->gold + $goldwin + $enemy->contrat, $player->kills + 1, $player->maxhp + 30, $player->energy - 1, $player->id));
$query = $db->execute("update `gangs` set `kills`=`kills`+1 where `id`=?", array($player->gang));
}
}
else
{
//Update player
$query = $db->execute("update `players` set `gold`=?, `kills`=?, `hp`=?, `energy`=? where `id`=?", array($player->gold + $goldwin + $enemy->contrat, $player->kills + 1, $player->hp, $player->energy - 1, $player->id));
$query = $db->execute("update `gangs` set `kills`=`kills`+1 where `id`=?", array($player->gang));
$nombre123 = mt_rand(1,3);
if ($nombre123 == 3) {
$query = $db->execute("update `players` set `recherche`=`recherche`+1 where `id`=?", array($player->id));
echo "<script>alert('Le flic t'as vu ! Une etoile\nde recherche s'est ajouter !')</script>";
}
}
//Add log message
$logmsg = "Tu as ete attaquer par <a href=\"profile.php?id=" . $player->username . "\">" . $player->username . "</a> et tu as ete tuer... Tu recuperes l'argent de ton Compte nouveau d�part.";
addlog($enemy->id, $logmsg, $db);
//Update enemy (who was defeated)
$query = $db->execute("update `players` set `shit`=0, `beuh`=0, `lsd`=0, `coke`=0, `hero`=0, `morphine`=0, `crack`=0 where id`=?", array($enemy->id));
$query = $db->execute("update `players` set `hp`=0, `deaths`=?, `level`=1, `maxexp`=50, `exp`=0, `maxhp`=50, `strength`=1, `vitality`=1, `agility`=1, `stat_points`=5, `contrat`=0, `gold`=?, `cnd`=0 where `id`=?", array($enemy->deaths + 1,$enemy->gold = $enemy->cnd, $enemy->id));
$query = $db->execute("DELETE FROM `items` WHERE `player_id`=?", array($enemy->id));
}
else
{
$output .= "<br /><u>Personne n'a gagner...</u>";
$query = $db->execute("update `players` set `hp`=?, `energy`=? where `id`=?", array($player->hp, $player->energy - 2, $player->id));
$query = $db->execute("update `players` set `hp`=? where `id`=?", array($enemy->hp, $enemy->id));
$logmsg = "Tu as été attaquer par <a href=\"profile.php?id=" . $player->username . "\">" . $player->username . "</a> mais personne n'a gagner...";
addlog($enemy->id, $logmsg, $db);
}
$player = check_user($secret_key, $db); //Get new stats
include("templates/private_header.php");
echo "<div class=\"contenu\">
<div class=\"contenu_bloc\">
<h1>Ville</h1>";
echo $output;
include("templates/private_footer.php");
break;
case "search":
//Check in case somebody entered 0
$_GET['fromlevel'] = ($_GET['fromlevel'] == 0)?"":$_GET['fromlevel'];
$_GET['tolevel'] = ($_GET['tolevel'] == 0)?"":$_GET['tolevel'];
//Construct query
$query = "select `id`, `cache`, `username`, `hp`, `maxhp`, `ville`, `level`, `contrat`, `kills`, `bank`, `gang` from `players` where `id`!= ? and `prison`=0 and `banni`=0 and ";
$query .= ($_GET['username'] != "")?"`username` LIKE ? and ":"";
$query .= ($_GET['fromlevel'] != "")?"`level` >= ? and ":"";
$query .= ($_GET['tolevel'] != "")?"`level` <= ? and ":"";
$query .= ($_GET['fromville'] != "")?"`ville` >= ? and ":"";
$query .= ($_GET['toville'] != "")?"`ville` <= ? and ":"";
$query .= ($_GET['alive'] == "1")?"`hp` > 0 ":"`hp` = 0 ";
$query .= "limit 999999999";
//Construct values array for adoDB
$values = array();
array_push($values, $player->id); //Make sure battle search doesn't show self
if ($_GET['username'] != "")
{
array_push($values, "%".trim($_GET['username'])."%"); //Add username value for search
}
//Add level range for search
if ($_GET['fromlevel'])
{
array_push($values, intval($_GET['fromlevel']));
}
if ($_GET['tolevel'])
{
array_push($values, intval($_GET['tolevel']));
}
if ($_GET['fromville'])
{
array_push($values, intval($_GET['fromville']));
}
if ($_GET['toville'])
{
array_push($values, intval($_GET['toville']));
}
include("templates/private_header.php");
echo "<div class=\"contenu\">
<div class=\"contenu_bloc\">
<h1>Ville</h1>";
//Display search form again
$somme1 = (($player->gold + $player->bank)/3);
$somme = intval($somme1);
echo "<table class=\"tableau\">
<tr><th colspan=\"2\">Se cacher</th></tr>
<tr>
<td width=\"100\">" . $somme . "$</td>
<td width=\"300\">
<form action=\"action.php\" method=\"post\">
<a href=cachette.php><input type=\"submit\" value=\"Se cacher\" class=\"btn_large\" /></a>
</form>
</td>
</tr>
</table><br /><br />";
echo "<fieldset>\n";
echo "<legend><b>Chercher un joueur</b></legend>\n";
echo "<form method=\"get\" action=\"battle1.php\">\n<input type=\"hidden\" name=\"act\" value=\"search\" />\n";
echo "<table width=\"100%\">\n";
echo "<tr>\n<td width=\"40%\">Pseudo :</td>\n<td width=\"60%\"><input type=\"text\" name=\"username\" value=\"" . stripslashes($_GET['username']) . "\" /></td>\n</tr>\n";
echo "<tr>\n<td width=\"40%\">Niveau :</td>\n<td width=\"60%\"><input type=\"text\" name=\"fromlevel\" size=\"4\" value=\"" . stripslashes($_GET['fromlevel']) . "\" /> à <input type=\"text\" name=\"tolevel\" size=\"4\" value=\"" . stripslashes($_GET['tolevel']) . "\" /></td>\n</tr>\n";
echo "<tr>\n<td width=\"40%\">Statut :</td>\n<td width=\"60%\"><select name=\"alive\" size=\"2\">\n<option value=\"1\"";
echo ($_GET['alive'] == 1)?" selected=\"selected\"":"";
echo ">En vie</option>\n<option value=\"0\"";
echo ($_GET['alive'] == 0)?" selected=\"selected\"":"";
echo ">Mort</option>\n</select></td>\n</tr>\n";
echo "<tr><td></td><td><br /><input type=\"submit\" value=\"Chercher\" /></td></tr>\n";
echo "</table>\n";
echo "</form>\n</fieldset>\n";
echo "<br /><br />";
echo "<table width=\"100%\">\n";
echo "<tr><th width=\"20%\">Joueur</th><th width=\"15%\">Contrat</th><th width=\"15%\">Meurtres</th><th width=\"15%\">Quartiers</th><th width=\"10%\">Niveau</th><th width=\"10%\">Gang</th><th width=\"15%\">Cacher</th><th width=\"15%\">Attaque</a></th><th width=\"15%\">Quartier</a></th></tr>\n";
$query = $db->execute($query, $values); //Search!
if ($query->recordcount() > 0) //Check if any players were found
{
$bool = 1;
while ($result = $query->fetchrow())
{
echo "<tr class=\"row" . $bool . "\">\n";
echo "<td width=\"20%\"><a href=\"profile.php?id=" . $result['username'] . "\">" . $result['username'] . "</a></td>\n";
echo "<td width=\"15%\">" . $result['contrat'] . "</td>\n";
echo "<td width=\"15%\">" . $result['kills'] . "</td>\n";
echo "<td width=\"15%\">" . $result['ville'] . "</td>\n";
echo "<td width=\"10%\">" . $result['level'] . "</td>\n";
if ($result['gang'] == 0) {echo "<td width=\"10%\">Sans</td>\n";}
else {echo "<td width=\"10%\">N. " . $result['gang'] . "</td>\n"; }
if ($result['cache'] == 0) {echo "<td width=\"15%\"><font color=green>Non</font></td>\n";}
else {echo "<td width=\"10%\"><font color=red>Cacher</font></td>\n"; }
echo "<td width=\"15%\"><a href=\"battle1.php?act=attack&username=" . $result['username'] . "\">Attaquer</a></td>\n";
if ($result['ville'] == 1) {echo "<td width=\"20%\">Doberwood</td>\n";}
if ($result['ville'] == 2) {echo "<td width=\"20%\">East Side</td>\n";}
if ($result['ville'] == 3) {echo "<td width=\"20%\">West Side</td>\n";}
if ($result['ville'] == 4) {echo "<td width=\"20%\">Mtrl Sud</td>\n";}
if ($result['ville'] == 5) {echo "<td width=\"20%\">Mtrl Nord</td> \n";}
echo "</tr>\n";
$bool = ($bool==1)?2:1;
}
}
else //Display error message
{
echo "<tr>\n";
echo "<td colspan=\"3\">Pas de joueur trouver. Change les critères !</td>\n";
echo "</tr>\n";
}
echo "</table>\n";
include("templates/private_footer.php");
break;
default:
include("templates/private_header.php");
echo "<div class=\"contenu\">
<div class=\"contenu_bloc\">
<h1>Ville</h1>";
//The default battle page, giving choice of whether to search for players or to target one
echo "<fieldset>\n";
echo "<legend><b>Chercher un joueur :</b></legend>\n";
echo "<form method=\"get\" action=\"battle1.php\">\n<input type=\"hidden\" name=\"act\" value=\"search\" />\n";
echo "<table width=\"100%\">\n";
echo "<tr>\n<td width=\"40%\">Pseudo :</td>\n<td width=\"60%\"><input type=\"text\" name=\"username\" /></td>\n</tr>\n";
echo "<tr>\n<td width=\"40%\">Niveau :</td>\n<td width=\"60%\"><input type=\"text\" name=\"fromlevel\" size=\"4\" /> à <input type=\"text\" name=\"tolevel\" size=\"4\" /></td>\n</tr>\n";
echo "<tr>\n<td width=\"40%\">Statut :</td>\n<td width=\"60%\"><select name=\"alive\" size=\"2\">\n<option value=\"1\" selected=\"selected\">En vie</option>\n<option value=\"0\">Mort</option>\n</select></td>\n</tr>\n";
echo "<tr><td></td><td><br /><input type=\"submit\" value=\"Chercher\" /></td></tr>\n";
echo "</table>\n";
echo "</form>\n</fieldset>\n";
echo "<br /><br />\n";
echo "<fieldset>\n";
echo "<legend><b>Attaquer un joueur</b></legend>\n";
echo "<form method=\"get\" action=\"battle1.php?act=attack\">\n<input type=\"hidden\" name=\"act\" value=\"attack\" />\n";
echo "Pseudo : <input type=\"text\" name=\"username\" /><br />\n";
echo "<input type=\"submit\" value=\"Combattre !\" />\n";
echo "</form>\n";
include("templates/private_footer.php");
break;
}
}
else {
include("templates/private_header.php");
echo "Tu ne peux pas aller ici !<br />";
echo "Sois tu es cacher, sois tu es dans une autres citer ou en prison !";
include("templates/private_footer.php");}
?>