Bonjour,

J'ai un script me permettant de contrôler l'accès de mon fichier via un mot de passe.
J'aimerais qu'il accepte 2 mots de passe différents : soit admin, soit user.
Ce script fonctionne si j'entre le mot de passe "admin", mais il ne fonctionne pas avec "user".
Pouvez-vous m'aider ?

voici le code :

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
43
44
 
<?php
$password = "admin";  // Modify Password to suit for access, Max 10 Char.	
$password2 = "user";
##########################################################################
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Password Protect </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\">Password Protect v1.0</h2>";
// If password is valid let the user get access
if (isset($_POST["password"]) && ($_POST["password"]=="$password")OR isset($_POST["password2"]) &&($_POST["password2"]=="$password2")) {
?>
<!-- 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>