Commit 58f7f5c0 authored by Erwan Normand's avatar Erwan Normand
Browse files

Clean the upload

parent 31df833e
......@@ -30,7 +30,7 @@
<br/>
<div class="row">
<div class="col-md-6 col-md-offset-3">
<form class="form-horizontal" action="merge.php" method="POST">
<form class="form-horizontal" action="upload.php" method="POST">
<fieldset>
<div class="form-group">
<label for="inputName" class="col-lg-2 control-label">Level name</label>
......@@ -65,7 +65,8 @@
<div class="form-group">
<label class="col-lg-2 control-label">Where to put the level ?</label>
<div class="col-lg-5">
<select class="form-control" name="x">
<label for="x" class="">X</label>
<select class="form-control" name="x" id="x">
<option>1</option>
<option>2</option>
<option>3</option>
......@@ -74,7 +75,8 @@
</select>
</div>
<div class="col-lg-5">
<select class="form-control" name="y">
<label for="y" class="">Y</label>
<select class="form-control" name="y" id="y">
<option>1</option>
<option>2</option>
<option>3</option>
......
......@@ -3,9 +3,11 @@
class Data {
public static function saveXML($data, $name, $x, $y, $TD = 1){
if(file_put_contents('data/td'.$TD.'/'.$x.'_'.$y.'-'.$name.'.vvvvvv', $data)){
echo 'Okay man !';
$file = 'data/td'.$TD.'/'.$x.'_'.$y.'-'.$name.'.vvvvvv';
if (!file_put_contents($file, $data)) {
trigger_error('Cannot save the vvvvvv file : ' . $file, E_USER_ERROR);
}
return true;
}
public static function loadXML($TD){
......
......@@ -3,7 +3,7 @@
error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once 'Data.class.php';
require_once 'model/Data.class.php';
require_once 'model/Tabs.class.php';
$name = $_POST['name'];
......@@ -12,29 +12,8 @@ $x = $_POST['x'];
$y = $_POST['y'];
$td = $_POST['td'];
var_dump($name);
var_dump($data);
var_dump($x);
var_dump($y);
var_dump($td);
$success = Data::saveXML($data, $name, $x, $y, $td);
Data::saveXML($data, $name, $x, $y, $td);
echo '<br/>';
$levels = Data::loadXML($td);
$tabs[] = array();
var_dump($levels);
foreach($levels as $level){
$myContent = new tabs();
$myContent->importXML($level['content']);
$tabs[] = $myContent;
}
echo '<br/>';
echo '<br/>';
echo '<br/>';
echo '<br/>';
var_dump($levels);
//Merge $levels
\ No newline at end of file
if ($success) {
header('Location: index.html');
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment