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
|
<?php
session_start();
include("include/header.inc.php");
function checkPass($login,$password){
if(!file_exists("password.txt")){
echo"impossible";
exit();
}
$tab=file("password.txt");
foreach($tab as $key=>$val){
list($l,$p)=explode("::",$val);
if($l==trim($login) && $p==trim($password)){
return true;
}
}
return false;
}
if(isset($_REQUEST["login"]))
$login=$_REQUEST["login"];
if(isset($_REQUEST["password"]))
$password=$_REQUEST["password"];
if(empty($login)||empty($password)){
header("location:index2.php");
}
if(checkPass($_POST["login"],$_POST["password"])){
$_SESSION["isPassValid"]=true;
die(header('location:show.php'));
}
if(!checkPass($login,$password)){
header("location:index2.php");
}
else{
$_SESSION["isPassValid"]=true;
echo "Bienvenue $login";
}
include("include/footer.inc.php");
?> |
Partager