<?php include "core/menu.php";
session_start();
error_reporting(0);
include ('config/config.php');

function deconnexion()
{
	$_SESSION = array(); //Destruction des variables.
	session_destroy(); //Destruction de la session.
	?>
	<script language="JavaScript">
	<!--
	window.location.href="index.php"
	//-->
	</script>
	<?php
}

 mysql_select_db($realmd);
  $points = mysql_query("SELECT * FROM account WHERE id = '$_SESSION[id]'");
  $donnees = mysql_fetch_array($points);
if ($_SESSION['logged'] == 0)
{
if ($_SESSION['logged'] == 0)
			{
			echo "
<h3><center><b>Vous devez &ecirc;tre connect&eacute; pour acceder &agrave; cette partie !</center></b></h3>
<center>
<form action=\"connexion.php?action=connexion\" method=\"post\">
<b>Nom de compte :</b></font><br /><input type=\"text\" name=\"pseudo\"><br />
<b>Mot de passe  :</b></font><br <input type=\"password\" name=\"pass\"><br /><br />
<input type=\"submit\" value=\"Connexion\" name=\"connexion\" >
</center></form>";
			}
			else
			{
			echo "
<h3><center><b>Une erreur est survenue merci de la signaler au WebMaster</center></b></h3>
<center><a href=\"membre.php\">Retour</a></center>";
			}
}
else
{
if ($alow_connexion == 0)
{
?>
<meta http-equiv="refresh" content="5;url=index.php" />
<?php
}
else
{
?>
	<?php
mysql_select_db($realmd,$connexion) or die(mysql_error());
		$post = $_SESSION['id'];
			$sql2="SELECT * FROM account WHERE id='$post'";
			$resultat=mysql_query($sql2) or die ("Erreur requette SQL");
			$info=mysql_fetch_array($resultat);
			$mid = $_SESSION['id'];?>
<center><h2><u>Boutique :</h2></u><br />
	Bienvenue, <b><?php echo $_SESSION['username']; ?>!<br /></b>
	<u>Vous avez : <b><?php echo $info["points"];  
						?> points</b></u><br /><hr size="1" noshade="noshade" />
	
	  <?php
mysql_select_db($realmd,$connexion) or die(include('install.php'));
if (!$_SESSION['logged'])
{
	$_SESSION['logged'] = false;
	$_SESSION['securite'] = 0;
}
if (isset($_GET['deconnexion']))
{
	deconnexion();
}
?>
<?php
switch ($_GET['action'])
		{
					case "axe":
						mysql_select_db($characters,$connexion) or die();
$coch = mysql_query("SELECT COUNT(*) AS nombre FROM characters WHERE account = '$mid'");
$arcc = mysql_fetch_array($coch);
$count = $count2['nombre'];
if ($count == 1) echo 'Vous n\'avez aucun personnage';
else {
?>
	<center><form method="POST" action="weapon.php?action=aaxe">
	
						  <img src="img/honehand.png" /><br><br><SELECT NAME="aaxe">
<?php
mysql_select_db($site,$connexion);
	$SQL = "SELECT * FROM `weapon` WHERE categorie = 1 AND souscategorie = 1";
	$result = mysql_query($SQL) or die("Erreur SQL");
	while ($datam = mysql_fetch_array($result))
	{
		echo "<OPTION VALUE='".$datam[id]."'> ".$datam[name]."  </option>";
	}
echo "Acheter des Haches a une main<br /><br />Personnage: 
<SELECT NAME=\"characterm\"><br><br>";
	mysql_select_db($characters,$connexion);
	$SQL = "SELECT * FROM `characters` WHERE `account`= '$mid'";
	$result = mysql_query($SQL) or die("Erreur SQL");
	while ($datach = mysql_fetch_array($result))
	{
		echo "Personnage<OPTION VALUE='".$datach[guid]."'> ".$datach[name]." (Niveau ".$datach[level].")</option><br><br>";
	}
	echo '</SELECT><br /><br />
	<input type="submit" value="Valider" /><br />
	</form>
	<br><br><center><a href="boutique.php">Retour</a></center>';	
		}
				break;
				case "mace":
						mysql_select_db($characters,$connexion) or die();
$coch = mysql_query("SELECT COUNT(*) AS nombre FROM characters WHERE account = '$mid'");
$arcc = mysql_fetch_array($coch);
$count = $count2['nombre'];
if ($count == 1) echo 'Vous n\'avez aucun personnage';
else {
?>
	<center><form method="POST" action="weapon.php?action=amace">
	
						  <img src="img/monehand.png" /><br><br><SELECT NAME="amace">
<?php
mysql_select_db($site,$connexion);
	$SQL = "SELECT * FROM `weapon` WHERE categorie = 1 AND souscategorie = 2";
	$result = mysql_query($SQL) or die("Erreur SQL");
	while ($datam = mysql_fetch_array($result))
	{
		echo "<OPTION VALUE='".$datam[id]."'> ".$datam[name]."  </option>";
	}
echo "Acheter des Haches a une main<br /><br />Personnage: 
<SELECT NAME=\"characterm\"><br><br>";
	mysql_select_db($characters,$connexion);
	$SQL = "SELECT * FROM `characters` WHERE `account`= '$mid'";
	$result = mysql_query($SQL) or die("Erreur SQL");
	while ($datach = mysql_fetch_array($result))
	{
		echo "Personnage<OPTION VALUE='".$datach[guid]."'> ".$datach[name]." (Niveau ".$datach[level].")</option><br><br>";
	}
	echo '</SELECT><br /><br />
	<input type="submit" value="Valider" /><br />
	</form>
	<br><br><center><a href="boutique.php">Retour</a></center>';	
		}
				break;
				case "sword":
						mysql_select_db($characters,$connexion) or die();
$coch = mysql_query("SELECT COUNT(*) AS nombre FROM characters WHERE account = '$mid'");
$arcc = mysql_fetch_array($coch);
$count = $count2['nombre'];
if ($count == 1) echo 'Vous n\'avez aucun personnage';
else {
?>
	<center><form method="POST" action="weapon.php?action=asword">
	
						  <img src="img/eonehand.png" /><br><br><SELECT NAME="asword">
<?php
mysql_select_db($site,$connexion);
	$SQL = "SELECT * FROM `weapon` WHERE categorie = 1 AND souscategorie = 3";
	$result = mysql_query($SQL) or die("Erreur SQL");
	while ($datam = mysql_fetch_array($result))
	{
		echo "<OPTION VALUE='".$datam[id]."'> ".$datam[name]."  </option>";
	}
echo "Acheter des Haches a une main<br /><br />Personnage: 
<SELECT NAME=\"characterm\"><br><br>";
	mysql_select_db($characters,$connexion);
	$SQL = "SELECT * FROM `characters` WHERE `account`= '$mid'";
	$result = mysql_query($SQL) or die("Erreur SQL");
	while ($datach = mysql_fetch_array($result))
	{
		echo "Personnage<OPTION VALUE='".$datach[guid]."'> ".$datach[name]." (Niveau ".$datach[level].")</option><br><br>";
	}
	echo '</SELECT><br /><br />
	<input type="submit" value="Valider" /><br />
	</form>
	<br><br><center><a href="boutique.php">Retour</a></center>';	
		}
				break;
				case "dagger":
						mysql_select_db($characters,$connexion) or die();
$coch = mysql_query("SELECT COUNT(*) AS nombre FROM characters WHERE account = '$mid'");
$arcc = mysql_fetch_array($coch);
$count = $count2['nombre'];
if ($count == 1) echo 'Vous n\'avez aucun personnage';
else {
?>
	<center><form method="POST" action="weapon.php?action=adagger">
	
						  <img src="img/dagger.png" /><br><br><SELECT NAME="adagger">
<?php
mysql_select_db($site,$connexion);
	$SQL = "SELECT * FROM `weapon` WHERE categorie = 1 AND souscategorie = 4";
	$result = mysql_query($SQL) or die("Erreur SQL");
	while ($datam = mysql_fetch_array($result))
	{
		echo "<OPTION VALUE='".$datam[id]."'> ".$datam[name]."  </option>";
	}
echo "Acheter des Haches a une main<br /><br />Personnage: 
<SELECT NAME=\"characterm\"><br><br>";
	mysql_select_db($characters,$connexion);
	$SQL = "SELECT * FROM `characters` WHERE `account`= '$mid'";
	$result = mysql_query($SQL) or die("Erreur SQL");
	while ($datach = mysql_fetch_array($result))
	{
		echo "Personnage<OPTION VALUE='".$datach[guid]."'> ".$datach[name]." (Niveau ".$datach[level].")</option><br><br>";
	}
	echo '</SELECT><br /><br />
	<input type="submit" value="Valider" /><br />
	</form>
	<br><br><center><a href="boutique.php">Retour</a></center>';	
		}
				break;
				case "aaxe":
					mysql_select_db($characters,$connexion);
$lol = mysql_query("SELECT * FROM mail ORDER BY id DESC LIMIT 1");
$lo = mysql_fetch_assoc($lol);
$lod = $lo["id"] + 1;
$lol2 = mysql_query("SELECT * FROM character_inventory ORDER BY item DESC LIMIT 1");
$lo2 = mysql_fetch_assoc($lol2);
$lod2 = $lo2["item"] + 2;
	mysql_select_db($site,$connexion);
	$idm = $_POST['aaxe'];
	$datam2 = mysql_query("SELECT * FROM `weapon` WHERE id = '$idm'");
	$datam = mysql_fetch_assoc($datam2);
	$prixm = $datam['prix'];
	$idom = $datam['item'];
	$perso = $_POST['characterm'];
	mysql_select_db($characters,$connexion);
	$datachar1 = mysql_query("SELECT * FROM `characters` WHERE `guid`='$perso'") or die(mysql_error());
	$datachar = mysql_fetch_array($datachar1w);
	$onl = $info['online'];

	if ($info['points'] < $prix)
	{
	echo "<center><p><h3>Vous n'avez pas assez de points de vote !</h3></p></center>";
	}
	if ($info['points'] > $prix)
	{
	if ($onl == 1)
	{
	echo 'Vous etes actuellement connect&eacute;. Veuillez vous deconnecter pour completer votre achat.';
	}
	if ($onl == 0)
	{
	$addm = $datam['item'];
	$myp = $info['points'];
	$voted = $myp - $prixm;
	$useracc = $info['username'];
	mysql_query("INSERT INTO item_instance VALUES ('$lod2', '$perso', '$lod2 1191182336 3 $idom 1065353216 0 $perso 0 $perso 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 45 0 0 0','')") or die(mysql_error());;
	mysql_query("INSERT INTO mail VALUES ($lod,3,41,0,16128,$perso,'Boutique', 'Voici les objets que vous avez commandé. Nous vous remercions d\'avoir fait un achat.',1,1307872055,1305280055,0,0,0)") or die(mysql_error());
	mysql_query("INSERT INTO mail_items VALUES ($lod, $lod2, $idom, $perso)") or die(mysql_error());
		mysql_select_db($realmd,$connexion);
mysql_query("UPDATE account SET points='$voted' WHERE username='$useracc'");
echo 'Les objets vous ont ete donn&eacute;s.<br /><meta http-equiv="refresh" content="3;url=boutique.php" />
<center>Vous allez &ecirc;tre redirig&eacute; dans 3 secontes !</center>';
}
}
break;
case "asword":
					mysql_select_db($characters,$connexion);
$lol = mysql_query("SELECT * FROM mail ORDER BY id DESC LIMIT 1");
$lo = mysql_fetch_assoc($lol);
$lod = $lo["id"] + 1;
$lol2 = mysql_query("SELECT * FROM character_inventory ORDER BY item DESC LIMIT 1");
$lo2 = mysql_fetch_assoc($lol2);
$lod2 = $lo2["item"] + 2;
	mysql_select_db($site,$connexion);
	$idm = $_POST['asword'];
	$datam2 = mysql_query("SELECT * FROM `weapon` WHERE id = '$idm'");
	$datam = mysql_fetch_assoc($datam2);
	$prixm = $datam['prix'];
	$idom = $datam['item'];
	$perso = $_POST['characterm'];
	mysql_select_db($characters,$connexion);
	$datachar1 = mysql_query("SELECT * FROM `characters` WHERE `guid`='$perso'") or die(mysql_error());
	$datachar = mysql_fetch_array($datachar1w);
	$onl = $info['online'];

	if ($info['points'] < $prixm)
	{
	echo "<center><p><h3>Vous n'avez pas assez de points de vote !</h3></p></center>";
	}
	if ($info['points'] > $prixm)
	{
	if ($onl == 1)
	{
	echo 'Vous etes actuellement connect&eacute;. Veuillez vous deconnecter pour completer votre achat.';
	}
	if ($onl == 0)
	{
	$addm = $datam['item'];
	$myp = $info['points'];
	$voted = $myp - $prixm;
	$useracc = $info['username'];
	mysql_query("INSERT INTO item_instance VALUES ('$lod2', '$perso', '$lod2 1191182336 3 $idom 1065353216 0 $perso 0 $perso 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 45 0 0 0','')") or die(mysql_error());;
	mysql_query("INSERT INTO mail VALUES ('$lod','3','41','0','16128','$perso','Boutique', 'Voici les objets que vous avez commandé. Nous vous remercions d\'avoir fait un achat.',1,1307872055,1305280055,0,0,0)") or die(mysql_error());
	mysql_query("INSERT INTO mail_items VALUES ('$lod', '$lod2', '$idom', '$perso')") or die(mysql_error());
		mysql_select_db($realmd,$connexion);
mysql_query("UPDATE account SET points='$voted' WHERE username='$useracc'");
echo 'Les objets vous ont ete donn&eacute;s.<br /><meta http-equiv="refresh" content="3;url=boutique.php" />
<center>Vous allez &ecirc;tre redirig&eacute; dans 3 secontes !</center>';
}
}
break;
case "amace":
					mysql_select_db($characters,$connexion);
$lol = mysql_query("SELECT * FROM mail ORDER BY id DESC LIMIT 1");
$lo = mysql_fetch_assoc($lol);
$lod = $lo["id"] + 1;
$lol2 = mysql_query("SELECT * FROM character_inventory ORDER BY item DESC LIMIT 1");
$lo2 = mysql_fetch_assoc($lol2);
$lod2 = $lo2["item"] + 2;
	mysql_select_db($site,$connexion);
	$idm = $_POST['amace'];
	$datam2 = mysql_query("SELECT * FROM `weapon` WHERE id = '$idm'");
	$datam = mysql_fetch_assoc($datam2);
	$prixm = $datam['prix'];
	$idom = $datam['item'];
	$perso = $_POST['characterm'];
	mysql_select_db($characters,$connexion);
	$datachar1 = mysql_query("SELECT * FROM `characters` WHERE `guid`='$perso'") or die(mysql_error());
	$datachar = mysql_fetch_array($datachar1w);
	$onl = $info['online'];

	if ($info['points'] < $prix)
	{
	echo "<center><p><h3>Vous n'avez pas assez de points de vote !</h3></p></center>";
	}
	if ($info['points'] > $prix)
	{
	if ($onl == 1)
	{
	echo 'Vous etes actuellement connect&eacute;. Veuillez vous deconnecter pour completer votre achat.';
	}
	if ($onl == 0)
	{
	$addm = $datam['item'];
	$myp = $info['points'];
	$voted = $myp - $prixm;
	$useracc = $info['username'];
	mysql_query("INSERT INTO item_instance VALUES ('$lod2', '$perso', '$lod2 1191182336 3 $idom 1065353216 0 $perso 0 $perso 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 45 0 0 0','')") or die(mysql_error());;
	mysql_query("INSERT INTO mail VALUES ($lod,3,41,0,16128,$perso,'Boutique', 'Voici les objets que vous avez commandé. Nous vous remercions d\'avoir fait un achat.',1,1307872055,1305280055,0,0,0)") or die(mysql_error());
	mysql_query("INSERT INTO mail_items VALUES ($lod, $lod2, $idom, $perso)") or die(mysql_error());
		mysql_select_db($realmd,$connexion);
mysql_query("UPDATE account SET points='$voted' WHERE username='$useracc'");
echo 'Les objets vous ont ete donn&eacute;s.<br /><meta http-equiv="refresh" content="3;url=boutique.php" />
<center>Vous allez &ecirc;tre redirig&eacute; dans 3 secontes !</center>';
}
}
break;
case "adagger":
					mysql_select_db($characters,$connexion);
$lol = mysql_query("SELECT * FROM mail ORDER BY id DESC LIMIT 1");
$lo = mysql_fetch_assoc($lol);
$lod = $lo["id"] + 1;
$lol2 = mysql_query("SELECT * FROM character_inventory ORDER BY item DESC LIMIT 1");
$lo2 = mysql_fetch_assoc($lol2);
$lod2 = $lo2["item"] + 2;
	mysql_select_db($site,$connexion);
	$idm = $_POST['adagger'];
	$datam2 = mysql_query("SELECT * FROM `weapon` WHERE id = '$idm'");
	$datam = mysql_fetch_assoc($datam2);
	$prixm = $datam['prix'];
	$idom = $datam['item'];
	$perso = $_POST['characterm'];
	mysql_select_db($characters,$connexion);
	$datachar1 = mysql_query("SELECT * FROM `characters` WHERE `guid`='$perso'") or die(mysql_error());
	$datachar = mysql_fetch_array($datachar1w);
	$onl = $info['online'];

	if ($info['points'] < $prix)
	{
	echo "<center><p><h3>Vous n'avez pas assez de points de vote !</h3></p></center>";
	}
	if ($info['points'] > $prix)
	{
	if ($onl == 1)
	{
	echo 'Vous etes actuellement connect&eacute;. Veuillez vous deconnecter pour completer votre achat.';
	}
	if ($onl == 0)
	{
	$addm = $datam['item'];
	$myp = $info['points'];
	$voted = $myp - $prixm;
	$useracc = $info['username'];
	mysql_query("INSERT INTO item_instance VALUES ('$lod2', '$perso', '$lod2 1191182336 3 $idom 1065353216 0 $perso 0 $perso 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 45 0 0 0','')") or die(mysql_error());;
	mysql_query("INSERT INTO mail VALUES ($lod,3,41,0,16128,$perso,'Boutique', 'Voici les objets que vous avez commandé. Nous vous remercions d\'avoir fait un achat.',1,1307872055,1305280055,0,0,0)") or die(mysql_error());
	mysql_query("INSERT INTO mail_items VALUES ($lod, $lod2, $idom, $perso)") or die(mysql_error());
		mysql_select_db($realmd,$connexion);
mysql_query("UPDATE account SET points='$voted' WHERE username='$useracc'");
echo 'Les objets vous ont ete donn&eacute;s.<br /><meta http-equiv="refresh" content="3;url=boutique.php" />
<center>Vous allez &ecirc;tre redirig&eacute; dans 3 secontes !</center>';
}
}
break;                                                              
//						PARTIE ARMES A DEUX MAINS					//
case "axet":
						mysql_select_db($characters,$connexion) or die();
$coch = mysql_query("SELECT COUNT(*) AS nombre FROM characters WHERE account = '$mid'");
$arcc = mysql_fetch_array($coch);
$count = $count2['nombre'];
if ($count == 1) echo 'Vous n\'avez aucun personnage';
else {
?>
	<center><form method="POST" action="weapon.php?action=aaxet">
	
						  <img src="img/htwo.png" /><br><br><SELECT NAME="aaxet">
<?php
mysql_select_db($site,$connexion);
	$SQL = "SELECT * FROM `weapon` WHERE categorie = 2 AND souscategorie = 1";
	$result = mysql_query($SQL) or die("Erreur SQL");
	while ($datam = mysql_fetch_array($result))
	{
		echo "<OPTION VALUE='".$datam[id]."'> ".$datam[name]."  </option>";
	}
echo "Acheter des Haches a une main<br /><br />Personnage: 
<SELECT NAME=\"characterm\"><br><br>";
	mysql_select_db($characters,$connexion);
	$SQL = "SELECT * FROM `characters` WHERE `account`= '$mid'";
	$result = mysql_query($SQL) or die("Erreur SQL");
	while ($datach = mysql_fetch_array($result))
	{
		echo "Personnage<OPTION VALUE='".$datach[guid]."'> ".$datach[name]." (Niveau ".$datach[level].")</option><br><br>";
	}
	echo '</SELECT><br /><br />
	<input type="submit" value="Valider" /><br />
	</form>
	<br><br><center><a href="boutique.php">Retour</a></center>';	
		}
				break;
				case "macet":
						mysql_select_db($characters,$connexion) or die();
$coch = mysql_query("SELECT COUNT(*) AS nombre FROM characters WHERE account = '$mid'");
$arcc = mysql_fetch_array($coch);
$count = $count2['nombre'];
if ($count == 1) echo 'Vous n\'avez aucun personnage';
else {
?>
	<center><form method="POST" action="weapon.php?action=amacet">
	
						  <img src="img/mtwo.png" /><br><br><SELECT NAME="amacet">
<?php
mysql_select_db($site,$connexion);
	$SQL = "SELECT * FROM `weapon` WHERE categorie = 2 AND souscategorie = 2";
	$result = mysql_query($SQL) or die("Erreur SQL");
	while ($datam = mysql_fetch_array($result))
	{
		echo "<OPTION VALUE='".$datam[id]."'> ".$datam[name]."  </option>";
	}
echo "Acheter des Haches a une main<br /><br />Personnage: 
<SELECT NAME=\"characterm\"><br><br>";
	mysql_select_db($characters,$connexion);
	$SQL = "SELECT * FROM `characters` WHERE `account`= '$mid'";
	$result = mysql_query($SQL) or die("Erreur SQL");
	while ($datach = mysql_fetch_array($result))
	{
		echo "Personnage<OPTION VALUE='".$datach[guid]."'> ".$datach[name]." (Niveau ".$datach[level].")</option><br><br>";
	}
	echo '</SELECT><br /><br />
	<input type="submit" value="Valider" /><br />
	</form>
	<br><br><center><a href="boutique.php">Retour</a></center>';	
		}
				break;
				case "swordt":
						mysql_select_db($characters,$connexion) or die();
$coch = mysql_query("SELECT COUNT(*) AS nombre FROM characters WHERE account = '$mid'");
$arcc = mysql_fetch_array($coch);
$count = $count2['nombre'];
if ($count == 1) echo 'Vous n\'avez aucun personnage';
else {
?>
	<center><form method="POST" action="weapon.php?action=aswordt">
	
						  <img src="img/etwo.png" /><br><br><SELECT NAME="aswordt">
<?php
mysql_select_db($site,$connexion);
	$SQL = "SELECT * FROM `weapon` WHERE categorie = 2 AND souscategorie = 3";
	$result = mysql_query($SQL) or die("Erreur SQL");
	while ($datam = mysql_fetch_array($result))
	{
		echo "<OPTION VALUE='".$datam[id]."'> ".$datam[name]."  </option>";
	}
echo "Acheter des Haches a une main<br /><br />Personnage: 
<SELECT NAME=\"characterm\"><br><br>";
	mysql_select_db($characters,$connexion);
	$SQL = "SELECT * FROM `characters` WHERE `account`= '$mid'";
	$result = mysql_query($SQL) or die("Erreur SQL");
	while ($datach = mysql_fetch_array($result))
	{
		echo "Personnage<OPTION VALUE='".$datach[guid]."'> ".$datach[name]." (Niveau ".$datach[level].")</option><br><br>";
	}
	echo '</SELECT><br /><br />
	<input type="submit" value="Valider" /><br />
	</form>
	<br><br><center><a href="boutique.php">Retour</a></center>';	
		}
				break;	
				case "staff":
						mysql_select_db($characters,$connexion) or die();
$coch = mysql_query("SELECT COUNT(*) AS nombre FROM characters WHERE account = '$mid'");
$arcc = mysql_fetch_array($coch);
$count = $count2['nombre'];
if ($count == 1) echo 'Vous n\'avez aucun personnage';
else {
?>
	<center><form method="POST" action="weapon.php?action=astaff">
	
						  <img src="img/staff.png" /><br><br><SELECT NAME="astaff">
<?php
mysql_select_db($site,$connexion);
	$SQL = "SELECT * FROM `weapon` WHERE categorie = 2 AND souscategorie = 4";
	$result = mysql_query($SQL) or die("Erreur SQL");
	while ($datam = mysql_fetch_array($result))
	{
		echo "<OPTION VALUE='".$datam[id]."'> ".$datam[name]."  </option>";
	}
echo "Acheter des Haches a une main<br /><br />Personnage: 
<SELECT NAME=\"characterm\"><br><br>";
	mysql_select_db($characters,$connexion);
	$SQL = "SELECT * FROM `characters` WHERE `account`= '$mid'";
	$result = mysql_query($SQL) or die("Erreur SQL");
	while ($datach = mysql_fetch_array($result))
	{
		echo "Personnage<OPTION VALUE='".$datach[guid]."'> ".$datach[name]." (Niveau ".$datach[level].")</option><br><br>";
	}
	echo '</SELECT><br /><br />
	<input type="submit" value="Valider" /><br />
	</form>
	<br><br><center><a href="boutique.php">Retour</a></center>';	
		}
				break;
				case "aaxet":
					mysql_select_db($characters,$connexion);
$lol = mysql_query("SELECT * FROM mail ORDER BY id DESC LIMIT 1");
$lo = mysql_fetch_assoc($lol);
$lod = $lo["id"] + 1;
$lol2 = mysql_query("SELECT * FROM character_inventory ORDER BY item DESC LIMIT 1");
$lo2 = mysql_fetch_assoc($lol2);
$lod2 = $lo2["item"] + 2;
	mysql_select_db($site,$connexion);
	$idm = $_POST['aaxet'];
	$datam2 = mysql_query("SELECT * FROM `weapon` WHERE id = '$idm'");
	$datam = mysql_fetch_assoc($datam2);
	$prixm = $datam['prix'];
	$idom = $datam['item'];
	$perso = $_POST['characterm'];
	mysql_select_db($characters,$connexion);
	$datachar1 = mysql_query("SELECT * FROM `characters` WHERE `guid`='$perso'") or die(mysql_error());
	$datachar = mysql_fetch_array($datachar1w);
	$onl = $info['online'];

	if ($info['points'] < $prix)
	{
	echo "<center><p><h3>Vous n'avez pas assez de points de vote !</h3></p></center>";
	}
	if ($info['points'] > $prix)
	{
	if ($onl == 1)
	{
	echo 'Vous etes actuellement connect&eacute;. Veuillez vous deconnecter pour completer votre achat.';
	}
	if ($onl == 0)
	{
	$addm = $datam['item'];
	$myp = $info['points'];
	$voted = $myp - $prixm;
	$useracc = $info['username'];
	mysql_query("INSERT INTO item_instance VALUES ('$lod2', '$perso', '$lod2 1191182336 3 $idom 1065353216 0 $perso 0 $perso 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 45 0 0 0','')") or die(mysql_error());;
	mysql_query("INSERT INTO mail VALUES ($lod,3,41,0,16128,$perso,'Boutique', 'Voici les objets que vous avez commandé. Nous vous remercions d\'avoir fait un achat.',1,1307872055,1305280055,0,0,0)") or die(mysql_error());
	mysql_query("INSERT INTO mail_items VALUES ($lod, $lod2, $idom, $perso)") or die(mysql_error());
		mysql_select_db($realmd,$connexion);
mysql_query("UPDATE account SET points='$voted' WHERE username='$useracc'");
echo 'Les objets vous ont ete donn&eacute;s.<br /><meta http-equiv="refresh" content="3;url=boutique.php" />
<center>Vous allez &ecirc;tre redirig&eacute; dans 3 secontes !</center>';
}
}
break;   
case "amacet":
					mysql_select_db($characters,$connexion);
$lol = mysql_query("SELECT * FROM mail ORDER BY id DESC LIMIT 1");
$lo = mysql_fetch_assoc($lol);
$lod = $lo["id"] + 1;
$lol2 = mysql_query("SELECT * FROM character_inventory ORDER BY item DESC LIMIT 1");
$lo2 = mysql_fetch_assoc($lol2);
$lod2 = $lo2["item"] + 2;
	mysql_select_db($site,$connexion);
	$idm = $_POST['amacet'];
	$datam2 = mysql_query("SELECT * FROM `weapon` WHERE id = '$idm'");
	$datam = mysql_fetch_assoc($datam2);
	$prixm = $datam['prix'];
	$idom = $datam['item'];
	$perso = $_POST['characterm'];
	mysql_select_db($characters,$connexion);
	$datachar1 = mysql_query("SELECT * FROM `characters` WHERE `guid`='$perso'") or die(mysql_error());
	$datachar = mysql_fetch_array($datachar1w);
	$onl = $info['online'];

	if ($info['points'] < $prix)
	{
	echo "<center><p><h3>Vous n'avez pas assez de points de vote !</h3></p></center>";
	}
	if ($info['points'] > $prix)
	{
	if ($onl == 1)
	{
	echo 'Vous etes actuellement connect&eacute;. Veuillez vous deconnecter pour completer votre achat.';
	}
	if ($onl == 0)
	{
	$addm = $datam['item'];
	$myp = $info['points'];
	$voted = $myp - $prixm;
	$useracc = $info['username'];
	mysql_query("INSERT INTO item_instance VALUES ('$lod2', '$perso', '$lod2 1191182336 3 $idom 1065353216 0 $perso 0 $perso 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 45 0 0 0','')") or die(mysql_error());;
	mysql_query("INSERT INTO mail VALUES ($lod,3,41,0,16128,$perso,'Boutique', 'Voici les objets que vous avez commandé. Nous vous remercions d\'avoir fait un achat.',1,1307872055,1305280055,0,0,0)") or die(mysql_error());
	mysql_query("INSERT INTO mail_items VALUES ($lod, $lod2, $idom, $perso)") or die(mysql_error());
		mysql_select_db($realmd,$connexion);
mysql_query("UPDATE account SET points='$voted' WHERE username='$useracc'");
echo 'Les objets vous ont ete donn&eacute;s.<br /><meta http-equiv="refresh" content="3;url=boutique.php" />
<center>Vous allez &ecirc;tre redirig&eacute; dans 3 secontes !</center>';
}
}
break;
case "aswordt":
					mysql_select_db($characters,$connexion);
$lol = mysql_query("SELECT * FROM mail ORDER BY id DESC LIMIT 1");
$lo = mysql_fetch_assoc($lol);
$lod = $lo["id"] + 1;
$lol2 = mysql_query("SELECT * FROM character_inventory ORDER BY item DESC LIMIT 1");
$lo2 = mysql_fetch_assoc($lol2);
$lod2 = $lo2["item"] + 2;
	mysql_select_db($site,$connexion);
	$idm = $_POST['aswordt'];
	$datam2 = mysql_query("SELECT * FROM `weapon` WHERE id = '$idm'");
	$datam = mysql_fetch_assoc($datam2);
	$prixm = $datam['prix'];
	$idom = $datam['item'];
	$perso = $_POST['characterm'];
	mysql_select_db($characters,$connexion);
	$datachar1 = mysql_query("SELECT * FROM `characters` WHERE `guid`='$perso'") or die(mysql_error());
	$datachar = mysql_fetch_array($datachar1w);
	$onl = $info['online'];

	if ($info['points'] < $prix)
	{
	echo "<center><p><h3>Vous n'avez pas assez de points de vote !</h3></p></center>";
	}
	if ($info['points'] > $prix)
	{
	if ($onl == 1)
	{
	echo 'Vous etes actuellement connect&eacute;. Veuillez vous deconnecter pour completer votre achat.';
	}
	if ($onl == 0)
	{
	$addm = $datam['item'];
	$myp = $info['points'];
	$voted = $myp - $prixm;
	$useracc = $info['username'];
	mysql_query("INSERT INTO item_instance VALUES ('$lod2', '$perso', '$lod2 1191182336 3 $idom 1065353216 0 $perso 0 $perso 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 45 0 0 0','')") or die(mysql_error());;
	mysql_query("INSERT INTO mail VALUES ($lod,3,41,0,16128,$perso,'Boutique', 'Voici les objets que vous avez commandé. Nous vous remercions d\'avoir fait un achat.',1,1307872055,1305280055,0,0,0)") or die(mysql_error());
	mysql_query("INSERT INTO mail_items VALUES ($lod, $lod2, $idom, $perso)") or die(mysql_error());
		mysql_select_db($realmd,$connexion);
mysql_query("UPDATE account SET points='$voted' WHERE username='$useracc'");
echo 'Les objets vous ont ete donn&eacute;s.<br /><meta http-equiv="refresh" content="3;url=boutique.php" />
<center>Vous allez &ecirc;tre redirig&eacute; dans 3 secontes !</center>';
}
}
break; 
case "astaff":
					mysql_select_db($characters,$connexion);
$lol = mysql_query("SELECT * FROM mail ORDER BY id DESC LIMIT 1");
$lo = mysql_fetch_assoc($lol);
$lod = $lo["id"] + 1;
$lol2 = mysql_query("SELECT * FROM character_inventory ORDER BY item DESC LIMIT 1");
$lo2 = mysql_fetch_assoc($lol2);
$lod2 = $lo2["item"] + 2;
	mysql_select_db($site,$connexion);
	$idm = $_POST['astaff'];
	$datam2 = mysql_query("SELECT * FROM `weapon` WHERE id = '$idm'");
	$datam = mysql_fetch_assoc($datam2);
	$prixm = $datam['prix'];
	$idom = $datam['item'];
	$perso = $_POST['characterm'];
	mysql_select_db($characters,$connexion);
	$datachar1 = mysql_query("SELECT * FROM `characters` WHERE `guid`='$perso'") or die(mysql_error());
	$datachar = mysql_fetch_array($datachar1w);
	$onl = $info['online'];

	if ($info['points'] < $prix)
	{
	echo "<center><p><h3>Vous n'avez pas assez de points de vote !</h3></p></center>";
	}
	if ($info['points'] > $prix)
	{
	if ($onl == 1)
	{
	echo 'Vous etes actuellement connect&eacute;. Veuillez vous deconnecter pour completer votre achat.';
	}
	if ($onl == 0)
	{
	$addm = $datam['item'];
	$myp = $info['points'];
	$voted = $myp - $prixm;
	$useracc = $info['username'];
	mysql_query("INSERT INTO item_instance VALUES ('$lod2', '$perso', '$lod2 1191182336 3 $idom 1065353216 0 $perso 0 $perso 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 45 0 0 0','')") or die(mysql_error());;
	mysql_query("INSERT INTO mail VALUES ($lod,3,41,0,16128,$perso,'Boutique', 'Voici les objets que vous avez commandé. Nous vous remercions d\'avoir fait un achat.',1,1307872055,1305280055,0,0,0)") or die(mysql_error());
	mysql_query("INSERT INTO mail_items VALUES ($lod, $lod2, $idom, $perso)") or die(mysql_error());
		mysql_select_db($realmd,$connexion);
mysql_query("UPDATE account SET points='$voted' WHERE username='$useracc'");
echo 'Les objets vous ont ete donn&eacute;s.<br /><meta http-equiv="refresh" content="3;url=boutique.php" />
<center>Vous allez &ecirc;tre redirig&eacute; dans 3 secontes !</center>';
}
}
break;   
}
				?>
<?php
}
}
?>
</center>            </div>
            <div id="contenu_b"></div>
    </div>
        <div id="menu-v">
				<hr />
<?php include "core/menud.php" ?>
<?php include "core/end.php" ?>