heuzef 10 лет назад
Родитель
Сommit
cfd35e4b70
5 измененных файлов: 28 добавлений и 49 удалений
  1. +19
    -17
      change_map.php
  2. +9
    -14
      index.php
  3. +0
    -18
      medias/c0f08ae603e364cb554fe71c9fc94ffd/.xml
  4. Двоичные данные
      medias/c0f08ae603e364cb554fe71c9fc94ffd/map.jpg
  5. +0
    -0
      medias/map.jpg

+ 19
- 17
change_map.php Просмотреть файл

@@ -1,24 +1,26 @@
<?php
<?php
include "header.php";
$nom = "map.jpg";

if($_GET){
$url = $_GET['url'];
$name = basename($url);
list($txt, $ext) = explode(".", $name);
$name = "map.jpg";
$uploaddir = './medias/'.$hash.'/';
$uploadfile = $uploaddir . basename($nom);

if($ext == "jpg" or $ext == "png"){
$upload = file_put_contents("uploads/$name",file_get_contents($url));
$extensions_valides = array( 'jpg' , 'jpeg' );
$extension_upload = strtolower( substr( strrchr($_FILES['userfile']['name'], '.') ,1) );

if($upload)
echo "Success: <a href='uploads/".$name."' target='_blank'>Check Uploaded</a>"; else "Erreur !";
if ( in_array($extension_upload,$extensions_valides) ) {

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

if ($resultat) header("location:index.php?msg=5");
else {
header("location:index.php?msg=6");
}
else{
echo "Erreur !";

}

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

<!-- <h3>Paste the url and hit enter!</h3>
<form action="" method="post">
Your URL: <input type="text" name="url" />
</form> -->
?>

+ 9
- 14
index.php Просмотреть файл

@@ -25,6 +25,11 @@ $message[5]='
<button type="button" class="close" data-dismiss="alert">X</button>
<h4>OK !</h4>
<p>Votre carte est à jour !</p>';
$message[6]='
<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 de mise à jour de votre carte. Seul les fichiers <strong>.jpg</strong> (10 Mo max) sont autorisés.</p>';
?>
<!DOCTYPE html>
<html lang="fr">
@@ -241,30 +246,20 @@ $message[5]='
<div class="modal fade" id="modal_change_map">
<div class="modal-dialog">
<div class="modal-content">
<form class="form-horizontal well" role="form" method="post" action="" enctype="multipart/form-data">
<form class="form-horizontal well" role="form" method="post" action="change_map.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="glyphicon glyphicon-map-marker"></i>&nbsp;&nbsp;CHANGER LA CARTE</h4>
</div>
<div class="modal-body">
<?php
if($_POST){
$url_map = $_POST['url_map'];
$name = basename($url_map);
list($txt, $ext) = explode(".", $name);
$name = "map.jpg";
if($ext == "jpg"){
$upload = file_put_contents("./medias/".$name,file_get_contents($url_map));}}
?>
<h4>Entrez le lien du fichier. Seul les fichiers <strong>.jpg</strong> sont autorisés.</h4>
<label class="control-label" for="focusedInput">URL :</label>
<input class="form-control" id="focusedInput" type="text" name="url_map" value="http://ecomonde/medias/default/map.jpg">
<input type="hidden" name="MAX_FILE_SIZE" value="10048576" />
<label class="control-label" for="focusedInput">Seul les fichiers <strong>.jpg</strong> (10 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">Mise à jour de la carte</button>
</div>
</form>
</form>
</div>
</div>
</div>


+ 0
- 18
medias/c0f08ae603e364cb554fe71c9fc94ffd/.xml Просмотреть файл

@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<response>
<entry>
<nom></nom>
<hp>10</hp>
<xp></xp>
<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>
</entry>
</response>

Двоичные данные
medias/c0f08ae603e364cb554fe71c9fc94ffd/map.jpg Просмотреть файл

До После
Ширина: 2000  |  Высота: 1400  |  Размер: 1.0 MiB

+ 0
- 0
medias/map.jpg Просмотреть файл


Загрузка…
Отмена
Сохранить