-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
274 lines (257 loc) · 13.6 KB
/
Copy pathindex.html
File metadata and controls
274 lines (257 loc) · 13.6 KB
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HardLink - Connexion</title>
<link rel="icon" type="image/x-icon" href="img/HDL.ico">
<link rel="stylesheet" href="global.css">
<link rel="stylesheet" href="index.css?v=1704806400">
<style>
/* Masquer le contenu initialement via une classe pour permettre l'annulation en JS */
.maintenance-locked body { display: none !important; }
</style>
<script>
// Appliquer le verrou immédiatement
if (sessionStorage.getItem('site_maintenance') === 'true') {
if (!window.location.search.includes('admin')) {
window.location.replace('maintenance.html');
} else {
// Si on a ?admin, on s'assure que le verrou n'est pas appliqué au document
document.documentElement.classList.remove('maintenance-locked');
}
}
</script>
<script src="js/auth_check.js"></script>
</head>
<body>
<div id="background-slider">
<img src="img/fibre2.jpg" alt="Background Image 1" class="active">
<!-- Les autres images seront chargées dynamiquement pour économiser de la bande passante -->
</div>
<script>
// Chargement différé des images de fond
document.addEventListener('DOMContentLoaded', function() {
const slider = document.getElementById('background-slider');
const images = [
'img/Fibre.jpg', 'img/fibre1.jpg', 'img/fibre3.jpg',
'img/fibre4.jpg', 'img/fibre5.jpg', 'img/fibre6.jpg',
'img/fibre7.jpg', 'img/fibre8.jpg', 'img/fibre9.jpg'
];
// On charge les images une par une avec un délai
images.forEach((src, index) => {
setTimeout(() => {
const img = new Image();
img.src = src;
img.alt = "Background Image " + (index + 2);
slider.appendChild(img);
}, (index + 1) * 2000); // 2 secondes entre chaque image
});
});
</script>
<div class="container-index">
<div class="header-content" style="display: flex; align-items: center; justify-content: center; gap: 20px; margin-bottom: 30px;">
<div style="display: flex; align-items: center; gap: 10px;">
<img src="img/HDL.ico" alt="HardLink Icon" style="height: 30px; width: 30px; border-radius: 6px; box-shadow: 0 0 15px rgba(255, 255, 255, 0.6);">
<h1 style="margin: 0; font-size: 1.8em; letter-spacing: 0.5px;">HardLink</h1>
</div>
</div>
<div class="form-section" id="login-section">
<h2>Connexion</h2>
<form id="login-form">
<div class="input-group">
<label for="login-username">Nom d'utilisateur:</label>
<input type="text" id="login-username" name="username" placeholder="Entrez votre nom" required>
</div>
<div class="input-group">
<label for="login-password">Mot de passe:</label>
<div class="password-wrapper">
<input type="password" id="login-password" name="password" placeholder="••••••••" required>
<span class="toggle-password" data-target="login-password">👁️</span>
</div>
</div>
<button type="submit">Se connecter</button>
</form>
<p><span class="text-black">Pas encore de compte ?</span> <a href="#" id="show-register">S'inscrire</a></p>
</div>
<div class="form-section hidden-section" id="register-section">
<h2>Inscription</h2>
<form id="register-form">
<div class="register-grid">
<div class="input-group">
<label for="register-username">Nom d'utilisateur:</label>
<input type="text" id="register-username" name="username" placeholder="Choisissez un nom" required>
</div>
<div class="input-group">
<label for="register-email">Email:</label>
<input type="email" id="register-email" name="email" placeholder="votre@email.com" required>
</div>
<div class="input-group">
<label for="register-telephone">Téléphone:</label>
<input type="tel" id="register-telephone" name="telephone" placeholder="06.XX.XX.XX.XX" required>
</div>
<div class="input-group">
<label for="register-password">Mot de passe:</label>
<div class="password-wrapper">
<input type="password" id="register-password" name="password" placeholder="••••••••" required>
<span class="toggle-password" data-target="register-password">👁️</span>
</div>
</div>
<div class="input-group">
<label for="register-confirm-password">Confirmer le mot de passe:</label>
<div class="password-wrapper">
<input type="password" id="register-confirm-password" name="confirm_password" placeholder="••••••••" required>
<span class="toggle-password" data-target="register-confirm-password">👁️</span>
</div>
</div>
<div class="input-group">
<label for="register-wilaya">Wilaya:</label>
<select id="register-wilaya" name="wilaya_id" required>
<option value="" disabled selected>Chargement des wilayas...</option>
</select>
</div>
<!-- Champ pour nouvelle wilaya (caché par défaut) -->
<div id="new-wilaya-group" class="input-group" style="display: none;">
<label for="new-wilaya-name">Nouvelle Wilaya:</label>
<input type="text" id="new-wilaya-name" placeholder="Ex: Ghardaïa">
</div>
</div>
<button type="submit">S'inscrire</button>
</form>
<p><span class="text-black">Pas de compte ?</span> <a href="#" id="show-login">Se connecter</a></p>
</div>
<footer class="main-footer">
<p>© 2025 HardLink v2.1 - Tous droits réservés</p>
<div class="contact-note">
Pour Toutes informations Contacter Mr : <strong>Badreddine Soualem</strong> | 📞 06.60.37.45.02 | 📧 Badreddine.soualem@at.dz
</div>
</footer>
</div>
<script>
document.getElementById('show-register').addEventListener('click', function(e) {
e.preventDefault();
document.querySelector('.container-index').style.maxWidth = '800px';
document.getElementById('login-section').classList.add('hidden-section');
document.getElementById('register-section').classList.remove('hidden-section');
});
document.getElementById('show-login').addEventListener('click', function(e) {
e.preventDefault();
document.querySelector('.container-index').style.maxWidth = '500px';
document.getElementById('register-section').classList.add('hidden-section');
document.getElementById('login-section').classList.remove('hidden-section');
});
// Charger les wilayas au démarrage
document.addEventListener('DOMContentLoaded', function() {
const wilayaSelect = document.getElementById('register-wilaya');
fetch('api/get_wilayas.php')
.then(res => res.json())
.then(data => {
if (data.success) {
wilayaSelect.innerHTML = '<option value="" disabled selected>Choisir une Wilaya</option>';
data.wilayas.forEach(w => {
const option = document.createElement('option');
option.value = w.id;
option.textContent = `${w.code} - ${w.nom}`;
wilayaSelect.appendChild(option);
});
// Ajouter l'option "Autre"
const otherOption = document.createElement('option');
otherOption.value = "OTHER";
otherOption.textContent = "➕ Autre (Nouvelle Wilaya)";
otherOption.style.fontWeight = "bold";
otherOption.style.color = "#0077b3";
wilayaSelect.appendChild(otherOption);
}
});
});
// Afficher/Cacher le champ nouvelle wilaya
document.getElementById('register-wilaya').addEventListener('change', function() {
const newWilayaGroup = document.getElementById('new-wilaya-group');
if (this.value === 'OTHER') {
newWilayaGroup.style.display = 'block';
document.getElementById('new-wilaya-name').required = true;
} else {
newWilayaGroup.style.display = 'none';
document.getElementById('new-wilaya-name').required = false;
}
});
// Toggle Password Visibility
document.querySelectorAll('.toggle-password').forEach(span => {
span.addEventListener('click', function() {
const targetId = this.getAttribute('data-target');
const passwordInput = document.getElementById(targetId);
if (passwordInput.type === 'password') {
passwordInput.type = 'text';
this.textContent = '🙈'; // Icône œil barré (ou similaire)
} else {
passwordInput.type = 'password';
this.textContent = '👁️'; // Icône œil
}
});
});
const registerForm = document.getElementById('register-form');
registerForm.addEventListener('submit', function(e) {
e.preventDefault();
const username = document.getElementById('register-username').value;
const email = document.getElementById('register-email').value;
const telephone = document.getElementById('register-telephone').value;
const password = document.getElementById('register-password').value;
const confirmPassword = document.getElementById('register-confirm-password').value;
let wilaya_id = document.getElementById('register-wilaya').value;
let new_wilaya_name = document.getElementById('new-wilaya-name').value;
if (password !== confirmPassword) {
alert('Les mots de passe ne correspondent pas.');
return;
}
fetch('api/register.php', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ username, email, telephone, password, wilaya_id, new_wilaya_name })
})
.then(response => response.json())
.then(data => {
if (data.success) {
alert('Inscription réussie ! Vous pouvez maintenant vous connecter.');
document.getElementById('show-login').click(); // Revenir au formulaire de connexion
} else {
alert('Erreur lors de l\'inscription: ' + data.message);
}
})
.catch(error => {
console.error('Erreur:', error);
alert('Une erreur est survenue lors de l\'inscription.');
});
});
const loginForm = document.getElementById('login-form');
loginForm.addEventListener('submit', function(e) {
e.preventDefault();
const username = document.getElementById('login-username').value; // Récupérer le nom d'utilisateur
const password = document.getElementById('login-password').value;
fetch('api/login.php', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ username, password })
})
.then(response => response.json())
.then(data => {
if (data.success) {
alert('Connexion réussie !');
localStorage.setItem('currentUser', JSON.stringify(data.user)); // Stocker l'utilisateur connecté
window.location.href = 'dashboard.html';
} else {
alert('Nom d\'utilisateur ou mot de passe incorrect.');
}
})
.catch(error => {
console.error('Erreur:', error);
alert('Une erreur est survenue lors de la connexion.');
});
});
</script>
<script src="background-slider.js"></script>
</body>
</html>