<?php
$nom_modif="";

if (isset($_GET['entry'])) {
	$nom_modif = $_GET['entry'];
} else {
	header("location: index.php");
	end;
}

$xml = simplexml_load_file('./gamers/'.$nom_modif.'.xml');

if (isset($_GET['hp_plus']) && $xml->entry->hp<10) {
	$xml->entry->hp++;
}

if (isset($_GET['hp_moins']) && $xml->entry->hp>0) {
	$xml->entry->hp--;
}

if (isset($_GET['xp_plus']) && $xml->entry->xp<99999) {
	$xml->entry->xp++;
}

if (isset($_GET['xp_moins']) && $xml->entry->xp>0) {
	$xml->entry->xp--;
}

if (isset($_GET['xp_plusplus']) && $xml->entry->xp<99989) {
	$xml->entry->xp+=10;
}

if (isset($_GET['xp_moinsmoins']) && $xml->entry->xp>9) {
	$xml->entry->xp-=10;
}

if (isset($_GET['eco_verte_plus']) && $xml->entry->ecos->verte<5) {
	$xml->entry->ecos->verte++;
}
if (isset($_GET['eco_verte_moins']) && $xml->entry->ecos->verte>0) {
	$xml->entry->ecos->verte--;
}

if (isset($_GET['eco_bleue_plus']) && $xml->entry->ecos->bleue<5) {
	$xml->entry->ecos->bleue++;
}
if (isset($_GET['eco_bleue_moins']) && $xml->entry->ecos->bleue>0) {
	$xml->entry->ecos->bleue--;
}

if (isset($_GET['eco_jaune_plus']) && $xml->entry->ecos->jaune<5) {
	$xml->entry->ecos->jaune++;
}
if (isset($_GET['eco_jaune_moins']) && $xml->entry->ecos->jaune>0) {
	$xml->entry->ecos->jaune--;
}

if (isset($_GET['eco_rouge_plus']) && $xml->entry->ecos->rouge<5) {
	$xml->entry->ecos->rouge++;
}
if (isset($_GET['eco_rouge_moins']) && $xml->entry->ecos->rouge>0) {
	$xml->entry->ecos->rouge--;
}

if (isset($_GET['eco_blanche_plus']) && $xml->entry->ecos->blanche<5) {
	$xml->entry->ecos->blanche++;
}
if (isset($_GET['eco_blanche_moins']) && $xml->entry->ecos->blanche>0) {
	$xml->entry->ecos->blanche--;
}

if (isset($_GET['eco_noire_plus']) && $xml->entry->ecos->noire<5) {
	$xml->entry->ecos->noire++;
}

if (isset($_GET['eco_noire_moins']) && $xml->entry->ecos->noire>0) {
	$xml->entry->ecos->noire--;
}

if (isset($_GET['trans_default'])) {
	$xml->entry->trans="default";
}

if (isset($_GET['trans_light'])) {
	$xml->entry->trans="light";
}

if (isset($_GET['trans_dark'])) {
	$xml->entry->trans="dark";
}

if (isset($_GET['edit_notes'])) {
	$xml->entry->notes = $_POST["notes"];
}

$xml->asXml('./gamers/'.$nom_modif.'.xml');
header("location: index.php");
?>