-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.php
174 lines (164 loc) · 6.78 KB
/
app.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<?php
require_once("include/SQL.php");
$json = '[
{
"ID":1,
"Type":1,
"X":-1,
"Y":-1,
"Height":0.2,
"Width":0.2,
"PrimaryColor":"#F0F",
"SecondaryColor":"#0F0",
},
]';
$name = "Sans-Titre";
if (isset($_GET['name'])) {
$name = $_GET['name'];
$IP = $_SERVER['REMOTE_ADDR'];
$req = $pdo->prepare("SELECT json FROM save WHERE ip = :ip AND name = :name");
$req->execute([
":ip" => $IP,
":name" => $name
]);
$result = $req->fetch(PDO::FETCH_ASSOC);
if ($result) {
$json = $result["json"];
$name = $_GET["name"];
}
else {
echo '<script>alert("Nom non trouvé dans votre base de donnée")</script>';
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="storage/main.css" rel="stylesheet">
<script src="https://kit.fontawesome.com/cc08db76b3.js" crossorigin="anonymous"></script>
<script src="storage/script.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.3/jspdf.min.js"></script>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>BETTER THAN PAINT</title>
</head>
<body>
<div class="title">
<h1 class="main-title"><span>B</span>ETTER <span>T</span>HAN <span>P</span>AINT</h1>
</div>
<div class="main-container">
<div class="header">
<input type="text" value=<?= $name ?> placeholder="Art Name" id="title">
</div>
<div class="wrapper">
<div class="header-secondary">
<div title="Load a file from your PC">
<button id="circle" onclick="document.getElementById('file-input').click();">
<i class="fas fa-cloud-upload-alt"></i>
<input id="file-input" type="file" name="file" style="display: none;" />
</button>
</div>
<div title="Download the file locally">
<button id="circle" onclick="SaveToClient()">
<i class="fas fa-download"></i>
</button>
</div>
<div title="Save file to the server (Be sure to remember the name !)">
<button id="circle" onclick="SaveToServer()" >
<i class="fas fa-save"></i>
</button>
</div>
<div title="Load a distant file">
<button id="circle" id="import" onclick="LoadFromServer()">
<i class="fas fa-cloud-download-alt"></i>
</button>
</div>
<div title="Export to PNG">
<button id="circle" onclick=ExportToPNG() >
<i class="fas fa-file-image"></i>
</button>
</div>
<div title="Export to PDF">
<button id="circle" onclick=ExportToPDF() >
<i class="fas fa-file-pdf"></i>
</button>
</div>
<div title="Who wouldn't have some RGB ?">
<button onclick="colors()"id="rgb">
<i class="fas fa-palette"></i>
</button>
</div>
<div class="dropdown">
<button class="dropbtn">font</button>
<div class="conteneur">
<p onclick="font('Roboto')">Roboto</p>
<p onclick="font('Inspiration')">Inpiration</p>
<p onclick="font('Torus')">Torus</p>
<p onclick="font('Noto Sans Japanese')">Noto Sans Japanese</p>
</div>
</div>
</div>
<div class="block">
<div class="card">
<div class="workspace">
<div class="selectionBox"><div draggable="true" id="selection" style="opacity:0;width:0;height:0;top:0;left:0;"><span id="resize" draggable="true"></span></div></div>
<canvas id="myCanvas" width="848" height="480" style="border:1px solid black;"></canvas>
</div>
<div class="tools">
<div>
<button id="bSquare">
<i class="fas fa-square"></i>
</button>
</div>
<div>
<button id="bCircle">
<i class="fas fa-circle"></i>
</button>
</div>
<div>
<button id="bTriangle">
<i class="fas fa-caret-up"></i>
</button>
</div>
<div>
<button id="bText">
<i class="fas fa-bold"></i>
</button>
</div>
</div>
</div>
<div class="color-slider">
<div class="dotContainer">
<span class="dot" id="primary-prev" onclick="ExchangeColors()"></span>
<span class="dot2" id="secondary-prev"></span>
</div>
<div class="slider">
<div class="red-value">
<div id="rValue">0</div>
<input type="range" onchange="color()" value="00" min="0" max="255" id="slideR">
</div>
<div class="green-value">
<div id="gValue">0</div>
<input type="range" onchange="color()" value="00" min="0" max="255" id="slideG">
</div>
<div class="blue-value">
<div id="bValue">0</div>
<input type="range" onchange="color()" value="00" min="0" max="255" id="slideB">
</div>
</div>
<a id="downloader" style="display:hidden;"></a>
</div>
</div>
<div>
<span class="rgb_container"id="measure"></span>
</div>
</div>
</div>
<div class="footer">
</div>
</div>
</div>
</body>
<script type="text/javascript">elements=<?= $json ?></script>
</html>