Bonjour,
Je suis occupé à réaliser un programme en PHP dans lequel on a un mot de passe affecté à une variable.
Il faudrait que l'administrateur puisse avoir une zone spéciale sur sa page d'accueil, par exemple une zone texte, dans laquelle il puisse changer le mot de passe.
Comment dois-je faire ?
Voici déjà le code source :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <?php $password = "admin"; // Modify Password to suit for access, Max 10 Char. ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Simple Password Protect - PHP PasswordProtect</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- P { FONT-SIZE: 8pt; COLOR: #000000; FONT-FAMILY: Verdana, Tahoma, Arial} TD { FONT-SIZE: 8pt; COLOR: #000000; FONT-FAMILY: Verdana, Tahoma, Arial} --> </style> </head> <body> <?php print "<h2 align=\"center\">PHP Simple Password Protect</h2>"; // If password is valid let the user get access if (isset($_POST["password"]) && ($_POST["password"]=="$password")) { ?> <!-- START OF HIDDEN HTML - PLACE YOUR CONTENT HERE --> <p align="center"><br><br><br> <b>Congratulations</b><br>you have gained access to the Protected and Secret Area!</p> <!-- END OF HIDDEN HTML --> <?php } else { // Wrong password or no password entered display this message if (isset($_POST['password']) || $password == "") { print "<p align=\"center\"><font color=\"red\"><b>Incorrect Password</b><br>Please enter the correct password</font></p>";} print "<form method=\"post\"><p align=\"center\">Please enter your password for access<br>"; print "<input name=\"password\" type=\"password\" size=\"25\" maxlength=\"10\"><input value=\"Login\" type=\"submit\"></p></form>"; } ?> <BR> </body> </html>
Partager