Correction exercices les variables d’environnement en php: Série 01
Correction exercices les variables d’environnement : Série 01
-
Objectifs
-
Exercice 01
-
Énoncé
- Vous pouvez visualiser l’énoncé de l’activité
-
Solution
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<div class="container">
<?php
//echo phpinfo();
?>
<table class="table table-striped">
<caption align="top">Quelques variables d'environnement</caption>
<tr><th align="center">Variable</th><th align="center">Valeur</th></tr>
<tr><td>Adresse IP du serveur web</td>
<td><?php echo $_SERVER['SERVER_ADDR'] ?></td></tr>
<tr><td>Nom du serveur web</td>
<td><?php echo $_SERVER['HTTP_HOST'] ?></td></tr>
<tr><td>Adresse IP du client</td>
<td><?php echo $_SERVER['REMOTE_ADDR'] ?></td></tr>
<tr><td>Nom de la machine cliente</td>
<td><?php echo gethostbyAddr($_SERVER['REMOTE_ADDR']) ?></td></tr>
<tr><td>Navigateur du client</td>
<td><?php echo $_SERVER['HTTP_USER_AGENT'] ?></td></tr>
</div>
<div align="right"><font color="#003569" face="verdana" size="1">Webmaser © 2020</font></div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
</body>
</html>