partie 1

<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
</head>
<body>
<button class="btn btn-primary" id="btn">Valider</button>
<div id="result"></div>
<script src="https://code.jquery.com/jquery-3.3.1.min.js" crossorigin="anonymous"></script>
<script src="ajax1.js"></script>
</body>
</html>
$( document ).ready(function() {
//click sur l'id btn
$('#btn').click(function(){ 
	$.ajax({       
	type: "GET",
	//appel de index.php sur le serveur web
	url: "http://localhost/ajax1.php",
		success: function(data){ 
		$("#result").html(data);
		}
	});
});
});
<?php 
echo "bonjour Ajax";
?>

partie 2 et 3 sans regex

<?php session_start();?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">

</head>
<body >
<div class="container">

<label for="example-text-input" class=" col-md-8 col-lg-6 col-form-label">Email</label>
<div class="col-md-8 col-lg-6">
<input class="form-control"  required="required" type="email"  value="" name="email"  id="email">
</div>
<br>
<div class="col-md-8 col-lg-6">
<button class="btn btn-danger btn-lg" id="btn" type="submit">Valider</button>
</div>
<br>
<div class="col-md-8 col-lg-6" id="result">
</div>
</div>

<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.bundle.min.js" integrity="sha384-lZmvU/TzxoIQIOD9yQDEpvxp6wEU32Fy0ckUgOH4EIlMOCdR823rg4+3gWRwnX1M" crossorigin="anonymous"></script>
<script
  src="https://code.jquery.com/jquery-3.3.1.min.js"
  integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
  crossorigin="anonymous"></script>



<script> 
$( document ).ready(function() {
//click sur l'id btn
$('#btn').click(function(){ 
  var email=$("#email").val();
 alert(email);
  
  $.ajax({       
   type: "GET",
   url: "http://localhost/ajax2.php?email="+email,
    success: function(data){ 
    $("#result").html(data);
    },
    error:function(httpObj, textStatus){ 
    if(httpObj.status==401){
      alert("mauvais email");
    }
    }
  });


});
});
  </script>

</html>


<?php session_start();
function connexion(){ 
$dsn ="mysql:host=localhost;dbname=email";
return $dbh = new PDO($dsn, 'root', '',array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));	 
}


function getEmail($email)
{

$dbh=connexion(); 
$req=$dbh->query('select count(*) as nb from mesemails where email="'.$email.'"');
$result=$req->fetchAll();
return $result[0]['nb']==1);

}


if (getEmail($_GET['email'])){
 echo "valide";
}else{
	http_response_code(401);
    exit;
}
?>

partie 5

<?php session_start();?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">

</head>
<body >
<div class="container">

<label for="example-text-input" class=" col-md-8 col-lg-6 col-form-label">Email</label>
<div class="col-md-8 col-lg-6">
<input class="form-control"  required="required" type="text"  value="" name="email"  id="email">
</div>


<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.bundle.min.js" integrity="sha384-lZmvU/TzxoIQIOD9yQDEpvxp6wEU32Fy0ckUgOH4EIlMOCdR823rg4+3gWRwnX1M" crossorigin="anonymous"></script>
<script
  src="https://code.jquery.com/jquery-3.3.1.min.js"
  integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
  crossorigin="anonymous"></script>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
   <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>

<script> 
$( document ).ready(function() {
      $( "#email" ).autocomplete({
            source: "http://localhost/ajax5.php"
      });
 });
  </script>

</html>


<?php
echo '["waza.wizi@sio-hautil.net","winie.lourson@sio-hautil.net","zorg.mechant@sio-hautil.net","zaza.lala@sio-hautil.net"]';


?>

Partie PHP à adapter avec la base de données.