-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin_control.php
91 lines (88 loc) · 3.6 KB
/
admin_control.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
session_start();
// Vérifier si l'utilisateur est authentifié
if (!isset($_SESSION['user_type']) || $_SESSION['user_type'] !== 'admin') {
header("Location: admin_login.html");
exit();
}
$filename = 'private/taille.txt';
$fileContent = file_get_contents($filename);
list($width, $height) = explode(',', $fileContent);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin Control Pixel War</title>
<link rel="stylesheet" href="stylesheets/main.css">
</head>
<body>
<header>
<nav class="menu">
<div class="menu-links">
<a class="lien" href="index.html" id="case_1">
<p>Accueil</p>
</a>
<a class="lien" href="pixel_war.html" id="case_2">
<p>Pixel War</p>
</a>
<a class="lien" href="viewing.html" id="case_2">
<p>Viewing</p>
</a>
<a class="lien" href="admin_login.html" id="case_2">
<U><p>Admin</p></U>
</a>
<a class="lien logo-link" id="case_logo">
<img src="images/rezoleo_logo.png" alt="logo" id="logo" style="width : 80px">
</a>
</div>
</nav>
</header>
<div class="pixel_war_body_admin">
<div class="admin_writing_pixels">
<div style="height: 300px;">
<canvas id="pixel_war"></canvas>
</div>
<div class="buttons_writing_pixels">
<button id="refreshButton">Refresh</button>
<button id="uploadModificationButton">Upload Modification</button>
</div>
</div>
<?php if (isset($_GET['error'])): ?>
<div class="error-size">
<p>Wrong size</p>
</div>
<?php endif; ?>
<div>
<form class="form_admin" action="augment_pixel_war_size.php" method="post">
<div class="current_pixel_war_size">
<p>Current size: <?php echo $height; ?> x <?php echo $width; ?> : Put even numbers only</p>
</div>
<div class="numbers_input">
<input type="number" name="new_line" placeholder="New line size" step="1" min="1">
<input type="number" name="new_column" placeholder="New column size" step="1" min="1">
</div>
<button id="uploadModificationButton">Augment Pixel War Size</button>
</form>
</div>
<form class="changing-pixel-war-state" action="admin_pixel_war_deactivate.php">
<button id="changePixelWarStateButton">Deactivate Pixel War</button>
</form>
<form class="reinitialize-canva" action="admin_reinitialize_canva.php" method="post">
<div class="numbers_input">
<?php if (isset($_GET['error_reinitialize']) && $_GET['error_reinitialize'] === 'true'): ?>
<div class="error-reinitialize">
<p>Problem when reinitializing Pixel War</p>
</div>
<?php endif; ?>
<input type="number" name="line" placeholder="line size" step="1" min="1">
<input type="number" name="column" placeholder="colum size" step="1" min="1">
</div>
<button id="reinitializeCanva">REINITIALIZE CANVA</button>
</form>
</div>
<script src="scripts/refresh_admin.js"></script>
<script src="scripts/disable_pixel_war_admin.js"></script>
</body>
</html>