-
Notifications
You must be signed in to change notification settings - Fork 0
/
modify_page.php
67 lines (61 loc) · 2.07 KB
/
modify_page.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="add_page.css" />
<title>ADD Page</title>
</head>
<body>
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<center>
<?php
$nb = $_GET['name_nb'];
$file = file_get_contents("./preset/data_preset_" . $nb . ".txt",FILE_USE_INCLUDE_PATH);
$file = explode("|", $file);
$name = $file[0];
$day = explode("-", $file[1]);
$houre = explode("-", $file[2]);
$day_array = [];
for($i = 0; $i <= count($day)-1; $i++){
if($day[$i] == "true"){
array_push($day_array, "checked");
}else{
array_push($day_array, " ");
}
}
echo "<h1>Preset Info</h1>
<div>
<p id= \"original_name\" > ".$name."</p>
<h2 >Le nom de ton preset</h2>
<input type=\"text\" name=\"name\" id=\"name\" value= ". $name .">
</div>
<div>
<h2>Coche les jours Actif</h2>
<input type=\"checkbox\" name=\"day\" class=\"day_check\" $day_array[0]>
Lundi<br>
<input type=\"checkbox\" name=\"day\" class=\"day_check\" $day_array[1]>
Mardi<br>
<input type=\"checkbox\" name=\"day\" class=\"day_check\" $day_array[2]>
Mercredi<br>
<input type=\"checkbox\" name=\"day\" class=\"day_check\" $day_array[3]>
Jeudi<br>
<input type=\"checkbox\" name=\"day\" class=\"day_check\" $day_array[4]>
Vendredi<br>
<input type=\"checkbox\" name=\"day\" class=\"day_check\" $day_array[5]>
Samedi<br>
<input type=\"checkbox\" name=\"day\" class=\"day_check\" $day_array[6]>
Dimanche<br>
</div>
<div id=\"timer_div\">
<h2>Choisis les horaires</h2>";
$type = "<input type=\"time\" name=\"time\" class=\"timer\" ";
for($i = 0; $i <= count($houre)-1; $i++){
echo $type . "value=". $houre[$i] . "><br>";
}
echo "</div>"
?>
<button id="button_add" onclick="add()">ADD Timer</button><br>
<button id="button_submit" onclick="main()">Submit</button>
</center>
<script type="text/javascript" src="modify_page.js"></script>
</body>
</html>