Ver código fonte

Ajout import des joueurs ok !

master
heuzef 10 anos atrás
pai
commit
fd4f2e2b61
4 arquivos alterados com 79 adições e 1 exclusões
  1. +26
    -0
      import_player.php
  2. +32
    -1
      index.php
  3. +0
    -0
      medias/c0f08ae603e364cb554fe71c9fc94ffd/Derpy.xml
  4. +21
    -0
      medias/c0f08ae603e364cb554fe71c9fc94ffd/prout.xml

+ 26
- 0
import_player.php Ver arquivo

@@ -0,0 +1,26 @@
<?php
include "header.php";
$nom = $_FILES['userfile']['name'];

$uploaddir = './medias/'.$hash.'/';
$uploadfile = $uploaddir . basename($nom);

$extensions_valides = array( 'xml' );
$extension_upload = strtolower( substr( strrchr($_FILES['userfile']['name'], '.') ,1) );

if ( in_array($extension_upload,$extensions_valides) ) {

$resultat = move_uploaded_file($_FILES['userfile']['tmp_name'],$uploadfile);

if ($resultat) header("location:index.php?msg=7");
else {
header("location:index.php?msg=8");
}

}

else {
header("location:index.php?msg=8");
}

?>

+ 32
- 1
index.php Ver arquivo

@@ -30,6 +30,16 @@ $message[6]='
<button type="button" class="close" data-dismiss="alert">X</button>
<h4>ERREUR !</h4>
<p>Echec de mise à jour de votre carte. Seul les fichiers <strong>.jpg</strong> (10 Mo max) sont autorisés.</p>';
$message[7]='
<div class="col-lg-6 alert alert-dismissable alert-success">
<button type="button" class="close" data-dismiss="alert">X</button>
<h4>OK !</h4>
<p>Joueur importé !</p>';
$message[8]='
<div class="col-lg-6 alert alert-dismissable alert-danger">
<button type="button" class="close" data-dismiss="alert">X</button>
<h4>ERREUR !</h4>
<p>Echec à l\'importation du joueur. Seul les fichiers <strong>.xml</strong> (10 M max) sont autorisés.</p>';
?>
<!DOCTYPE html>
<html lang="fr">
@@ -106,7 +116,7 @@ $message[6]='
</p>
<hr />
<p>
<a href="#" class="btn btn-default btn-lg disabled"><i class="glyphicon glyphicon-import"></i>&nbsp;&nbsp;Importer un joueur (.XML)</a>
<a data-toggle="modal" data-target="#modal_import_player" class="btn btn-default btn-lg"><i class="glyphicon glyphicon-import"></i>&nbsp;&nbsp;Importer un joueur (.XML)</a>
</p>
<hr />
<p>
@@ -271,6 +281,27 @@ $message[6]='
</div>
</div>

<div class="modal fade" id="modal_import_player">
<div class="modal-dialog">
<div class="modal-content">
<form class="form-horizontal well" role="form" method="post" action="import_player.php" enctype="multipart/form-data">
<div class="modal-header">
<a type="button" class="close" data-dismiss="modal" aria-hidden="true" style="color:black;">X</a>
<h4 class="modal-title"><i class="ionicons ion-map"></i>&nbsp;&nbsp;IMPORTER UN JOUEUR</h4>
</div>
<div class="modal-body">
<input type="hidden" name="MAX_FILE_SIZE" value="1004857" />
<label class="control-label" for="focusedInput">Seul les fichiers <strong>.xml</strong> (1 Mo max) sont autorisés.</label>
<input class="form-control" id="focusedInput" type="file" name="userfile">
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-info">Importer le joueur</button>
</div>
</form>
</div>
</div>
</div>

<?php elseif($status == 0): ?>

<div class="container-fluid">


+ 0
- 0
medias/c0f08ae603e364cb554fe71c9fc94ffd/Derpy.xml Ver arquivo


+ 21
- 0
medias/c0f08ae603e364cb554fe71c9fc94ffd/prout.xml Ver arquivo

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<response>
<entry>
<nom>prout</nom>
<level>0</level>
<hp>10</hp>
<xp>0</xp>
<money>0</money>
<ecos>
<verte>0</verte>
<bleue>0</bleue>
<jaune>0</jaune>
<rouge>0</rouge>
<blanche>0</blanche>
<noire>0</noire>
</ecos>
<trans>default</trans>
<notes>...</notes>
<gift>10</gift>
</entry>
</response>

Carregando…
Cancelar
Salvar