"depot projets 2019"
This commit is contained in:
parent
83ebf9a87c
commit
6a1ce75149
89
TD1/index.php
Executable file
89
TD1/index.php
Executable file
@ -0,0 +1,89 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr-FR">
|
||||
<head>
|
||||
<?php
|
||||
$x = 2;
|
||||
$y = 4;
|
||||
$z = 0;
|
||||
$i = 0;
|
||||
$msg = "Bonjour à tous";
|
||||
define("AUTHOR", "JunkJumper");
|
||||
|
||||
$aj = "Applejack is best pony !";
|
||||
$p ='p';
|
||||
|
||||
$chaine1 = 'une chaine de charatères';
|
||||
$chaine2 = "deux chaines de charatères";
|
||||
$martin = "« Je m’appelle Martin »";
|
||||
|
||||
$voiture = array(
|
||||
"Renault" => array("Twingo", "Clio", "Megane", "Laguna"),
|
||||
"Peugeot" => array(107, 207, 308, 508),
|
||||
"Citroen" => array("C1", "C3", "C4", "C5"),
|
||||
"Volkswagen" => array("Lupo", "Polo", "Golf", "Passat")
|
||||
);
|
||||
|
||||
?>
|
||||
<meta charset ="utf-8" />
|
||||
<title>TD1</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Titre 1</h1>
|
||||
<p>Paragraphe. <?php echo $msg?>
|
||||
<br />
|
||||
<?php echo AUTHOR ?>
|
||||
<br />
|
||||
La différence entre <code>echo</code> et <code>print</code> est que echo ne renvoie rien alors que print renvoi un entier.
|
||||
|
||||
<?php
|
||||
|
||||
echo "x = " .$x;echo '<br />';
|
||||
echo "y = " .$y;echo '<br />';
|
||||
echo "z = " .$z;echo '<br />';
|
||||
echo "x * y = " .($x * $y);echo '<br />';
|
||||
|
||||
echo 'chaine avec \' pour ouvirer et fermer';echo '<br />';
|
||||
echo "chaine avec \" pour ouvirer et fermer";echo '<br />';
|
||||
|
||||
echo $martin;echo '<br />';
|
||||
echo "« Je m’appelle Martin »";echo '<br />';
|
||||
|
||||
echo "==================================$aj==================================";echo '<br />';
|
||||
|
||||
print('strlen() donne le nombre de char dans le String : ' .strlen($aj));echo '<br />';
|
||||
print('strpos() donne la posisition d\'un char, par exemple le \'k\' : ' .strpos($aj, 'k'));echo '<br />';
|
||||
print('strstr() trouve la première occurrence dans une chaîne : ' .strstr($aj, "jack"));echo '<br />';
|
||||
print('substr() retourne un segment de chaîne, par exemple du char[5] au char[5]+11 : ' .substr($aj, 5, 11));echo '<br />';
|
||||
print('str_replace() remplace toutes les occurrences dans une chaîne : ' .str_replace("Applejack", "Twilight Sparkle", $aj));echo '<br />';
|
||||
print('html_entity_decode() convertit les entités HTML à leurs caractères correspondant');echo '<br />';
|
||||
print('htmlentities() convertit tous les caractères éligibles en entités HTML');echo '<br />';
|
||||
//print('explode() scinde une chaîne de caractères en segments : ' .explode(" ", $aj));echo '<br />';
|
||||
print('addslashes() ajoute des antislashs dans une chaîne');echo '<br />';
|
||||
|
||||
/*
|
||||
foreach($voiture as $key=>$value) {
|
||||
foreach($value as $key2=>$valeur) {
|
||||
print($valeur);
|
||||
if(i == 4) {
|
||||
echo '<br />';
|
||||
$i = 0;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}*/
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<a href="https://linserv-info-01.iutnice.unice.fr/~sj801446/"><button class="favorite styled" type="button">Retour à laliste des sites.</button></a>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
73
TD2/index.php
Normal file
73
TD2/index.php
Normal file
@ -0,0 +1,73 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr-FR">
|
||||
<head>
|
||||
<meta charset ="utf-8" />
|
||||
<title>TD2 - Manipulation des boucles, expressions conditionnelles et introduction aux tables globales</title>
|
||||
<?php
|
||||
$aj = "Applejack is best pony.";
|
||||
$cmc = "Applebloom is Applejack's little sister. Scootaloo is Rainbow Dash's little filly. Sweatie Belle is Rarity's little sister.";
|
||||
?>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>TD2 - Manipulation des boucles, expressions conditionnelles et introduction aux tables globales.</h1>
|
||||
|
||||
<style>
|
||||
h1 {
|
||||
text-align: center;
|
||||
color : blue;
|
||||
}
|
||||
|
||||
h2 {
|
||||
text-align: left;
|
||||
color : DeepSkyBlue ;
|
||||
}
|
||||
|
||||
p {
|
||||
font-weight: bold;
|
||||
color : red;
|
||||
}
|
||||
</style>
|
||||
|
||||
<?php
|
||||
echo '<h2>1 - Manipulations des chaînes de caractères et tables</h2>';
|
||||
|
||||
echo '<p>1.1 :</p>';
|
||||
echo "Le nombre de mot dans la phrase \"" .$aj ."\" est " .sizeof(explode(" ", $aj)) ."." .'<br />';
|
||||
echo "Le nombre de mot dans la phrase \"" .$cmc ."\" est " .sizeof(explode(" ", $cmc)) ."." .'<br />'; echo '<br />';
|
||||
|
||||
echo '<p>1.2 :</p>';
|
||||
echo "Le nombre phrases dans le texte \"" .$aj ."\" est " .(sizeof(explode(".", $aj))-1) ."." .'<br />';
|
||||
echo "Le nombre phrases dans le texte \"" .$cmc ."\" est " .(sizeof(explode(".", $cmc))-1) ."." .'<br />';
|
||||
|
||||
echo '<p>1.3 :</p>';
|
||||
$temp = explode(" ", $aj);
|
||||
$aj2 = "";
|
||||
|
||||
for ($i=(sizeof($temp)-1); $i >= 0; $i--) {
|
||||
$aj2 = $aj2 .$temp[$i] ." ";
|
||||
}
|
||||
|
||||
$temp2 = explode(" ", $cmc);
|
||||
$cmc2 = "";
|
||||
|
||||
for ($i=(sizeof($temp2)-1); $i >= 0; $i--) {
|
||||
$cmc2 = $cmc2 .$temp2[$i] ." ";
|
||||
}
|
||||
|
||||
echo "Le texte \"" .$aj ."\", une fois inversé donne :\"" . substr($aj2, 0, -1)."\"." .'<br />';
|
||||
echo "Le texte \"" .$cmc ."\", une fois inversé donne :\"" . substr($cmc2, 0, -1)."\"." .'<br />';
|
||||
|
||||
echo '<p>1.4 :</p>';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
<a href="https://linserv-info-01.iutnice.unice.fr/~sj801446/"><button class="favorite styled" type="button">Retour à laliste des sites.</button></a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
72
TD3/anim.css
Executable file
72
TD3/anim.css
Executable file
@ -0,0 +1,72 @@
|
||||
.radial-timer {
|
||||
overflow: hidden;
|
||||
height: 144px;
|
||||
width: 144px;
|
||||
position: relative;
|
||||
}
|
||||
.radial-timer .radial-timer-half {
|
||||
height: 144px;
|
||||
width: 72px;
|
||||
border-radius: 72px 0 0 72px;
|
||||
background: red;
|
||||
position: absolute;
|
||||
}
|
||||
.radial-timer .radial-timer-half:nth-of-type(2) {
|
||||
z-index: 99999999;
|
||||
-webkit-transform-origin: center right;
|
||||
-webkit-transform: rotate(180deg);
|
||||
}
|
||||
.radial-timer .radial-timer-half:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 9px;
|
||||
left: 9px;
|
||||
height: 126px;
|
||||
width: 63px;
|
||||
border-radius: 67.5px 0 0 67.5px;
|
||||
background: rgb(255, 255, 255);
|
||||
}
|
||||
.radial-timer .radial-timer-half:after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
background: rgb(255, 255, 255);
|
||||
height: 288px;
|
||||
width: 216px;
|
||||
left: -144px;
|
||||
top: -72px;
|
||||
-webkit-transform-origin: center right;
|
||||
}
|
||||
.radial-timer.s-animate {
|
||||
-webkit-transform-origin: center right;
|
||||
}
|
||||
.radial-timer.s-animate .radial-timer-half:nth-of-type(1):after {
|
||||
-webkit-animation: rotateLeftMask 3s infinite linear;
|
||||
}
|
||||
.radial-timer.s-animate .radial-timer-half:nth-of-type(2):after {
|
||||
-webkit-animation: rotateRightMask 3s infinite linear;
|
||||
}
|
||||
|
||||
@-webkit-keyframes rotateLeftMask {
|
||||
0% {
|
||||
-webkit-transform: rotate(0deg);
|
||||
}
|
||||
50% {
|
||||
-webkit-transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
-webkit-transform: rotate(180deg);
|
||||
}
|
||||
}
|
||||
@-webkit-keyframes rotateRightMask {
|
||||
0% {
|
||||
-webkit-transform: rotate(0deg);
|
||||
}
|
||||
50% {
|
||||
-webkit-transform: rotate(180deg);
|
||||
visibility: hidden;
|
||||
}
|
||||
100% {
|
||||
-webkit-transform: rotate(180deg);
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
32
TD3/bak
Normal file
32
TD3/bak
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
if (! (isset($value["prenom"]) || isset($value["nom"])) ) {
|
||||
echo '<form action="./exo12.php" method="get" name="formulaire">
|
||||
Nom : <input type="text" name="formulaire[nom]"><br />
|
||||
Prenom : <input type="text" name="formulaire[prenom]"><br />
|
||||
Email : <input type="email" name="formulaire[email]"><br />
|
||||
Sexe : <input type="radio" name="formulaire[sexe]" value="Homme" />Homme
|
||||
<input type="radio" name="formulaire[sexe]" value="Femme" />Femme
|
||||
<input type="radio" name="formulaire[sexe]" value="Autre" />Autre(s)<br />
|
||||
Vin(s) Choisi(s) :
|
||||
<input type="checkbox" name ="formulaire[vins][st_emilion]" value="St_Emilion" />St Emilion
|
||||
<input type="checkbox" name ="formulaire[vins][chateau_hermitage]" value="Chateau_Hermitage" />Château l’Hermitage
|
||||
<input type="checkbox" name ="formulaire[vins][entre_les_deux_mers]" value="Entre_les_Deux_Mers" />Entre les Deux Mers
|
||||
<input type="checkbox" name ="formulaire[vins][fitou]" value="Fitou" />Fitou
|
||||
<input type="checkbox" name ="formulaire[vins][bandol]" value="Bandol" />Bandol
|
||||
<input type="checkbox" name ="formulaire[vins][cote_de_provence]" value="Cote_de_Provence" />Côte de Provence<br />
|
||||
<input type="submit" name ="formulaire[send]" value="Envoyer" />
|
||||
</form>';
|
||||
} else {
|
||||
|
||||
|
||||
echo "<h1>Valeurs renvoyées par ".$value["PHP_SELF"]."</h1>";
|
||||
echo "Prénom : ".$value["prenom"]."<br/>";
|
||||
echo "Nom : ".$value["nom"]."<br/>";
|
||||
echo "Civilité : ".$value["civilite"]."<br/>";
|
||||
echo "Email: ".$value["email"]."<br/>";
|
||||
echo "Vin(s) sélectioné(s): ";
|
||||
foreach($value["vin"] as $vaueur) {
|
||||
echo $t_vin[$valeur]." ";
|
||||
}
|
||||
}
|
||||
*/
|
67
TD3/check.php
Normal file
67
TD3/check.php
Normal file
@ -0,0 +1,67 @@
|
||||
<html>
|
||||
|
||||
<style>
|
||||
|
||||
p {
|
||||
font-weight: bold;
|
||||
color : grey;
|
||||
text-align : center;
|
||||
}
|
||||
|
||||
p#rep {
|
||||
font-weight: bold;
|
||||
color : red;
|
||||
text-align : center;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<link href="./anim.css" rel="stylesheet">
|
||||
<?php
|
||||
$checkN = false;
|
||||
$checkE = false;
|
||||
$tab = $_REQUEST['formulaire'];
|
||||
$vins = "";
|
||||
|
||||
if(preg_match("#[a-zA-Z_]#", $tab['nom']) && preg_match("#[a-zA-Z_]#",$tab['prenom'])) {
|
||||
$checkN = true;
|
||||
}
|
||||
|
||||
if(preg_match("#@#", $tab['email']) && preg_match("#.#",$tab['email']) && preg_match("#[a-zA-Z]{2}@#", $tab['email']) && preg_match("#@[a-zA-Z]{2}.#",$tab['email'])) {
|
||||
$checkE = true;
|
||||
}
|
||||
|
||||
if($checkN) {
|
||||
foreach ($tab['vins'] as $key => $valeur) {
|
||||
$vins = $valeur .' , ';
|
||||
}
|
||||
|
||||
echo '<p>Votre nom est : ' .$tab['nom'] .'</p>';
|
||||
echo '<p>Votre prenom est : ' .$tab['prenom'] .'</p>';
|
||||
if ($tab['sexe'] != null) {echo '<p>Votre sexe est : ' .$tab['sexe'] .'</p>';}
|
||||
if ($vins != null) {echo '<p>Votre sélection de vin(s) est : ' .$vins .'</p>';}
|
||||
} else {
|
||||
echo '<p>Votre nom ou prénom n\'est pas correct.</p>';
|
||||
}
|
||||
|
||||
if($checkE) {
|
||||
echo '<p>Votre mail est : ' .$tab['email'] .'</p>';
|
||||
} else {
|
||||
echo '<p>Votre email n\'est pas correct.</p>';
|
||||
}
|
||||
|
||||
if($checkE && $checkN) {
|
||||
echo '<p id="rep">Bonjour ' .$tab['nom'] .' ' .$tab['prenom'] .',<br />
|
||||
Nous vous remercions d’avoir commandé ' .$vins .'<br />'
|
||||
.'Un mail de conformation vous a été envoyé à l’adresse : ' .$tab['email'] .'</p>';
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<br /><br /><br /><br /> <center><div class="radial-timer s-animate"> <div class="radial-timer-half"></div> <div class="radial-timer-half"></div></center>
|
||||
<script>
|
||||
setTimeout(function () {
|
||||
window.location.href = "./index.php";
|
||||
}, 3000);
|
||||
</script>
|
||||
</html>
|
93
TD3/exo12.php
Executable file
93
TD3/exo12.php
Executable file
@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
$send = false;
|
||||
|
||||
if ($_REQUEST != null) {
|
||||
$send = true;
|
||||
}
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr-FR">
|
||||
<head>
|
||||
<meta charset ="utf-8" />
|
||||
<title>TD3 - Génération et traitement des formulaires HTML</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>TD3 - Génération et traitement des formulaires HTML</h1>
|
||||
|
||||
<style>
|
||||
h1 {
|
||||
text-align: center;
|
||||
color : blue;
|
||||
}
|
||||
|
||||
h2 {
|
||||
text-align: left;
|
||||
color : DeepSkyBlue ;
|
||||
}
|
||||
|
||||
p {
|
||||
font-weight: bold;
|
||||
color : grey;
|
||||
}
|
||||
|
||||
br {
|
||||
line-height : 3em;
|
||||
}
|
||||
|
||||
br#long {
|
||||
line-height : 10em;
|
||||
}
|
||||
|
||||
strong.mandatory {
|
||||
color : red;
|
||||
}
|
||||
</style>
|
||||
|
||||
<?php
|
||||
//Array ( [formulaire] => Array ( [nom] => srifi [prenom] => jose [email] => jose.srifi@gmail.com [sexe] => Homme [vins] => Array ( [st_emilion] => St_Emilion ) ) )
|
||||
|
||||
if($send) {
|
||||
|
||||
echo 'Votre nom est : ' .$_REQUEST['formulaire']['nom'] .'<br />';
|
||||
echo 'Votre prenom est : ' .$_REQUEST['formulaire']['prenom'] .'<br />';
|
||||
echo 'Votre mail est : ' .$_REQUEST['formulaire']['email'] .'<br />';
|
||||
echo 'Votre sexe est : ' .$_REQUEST['formulaire']['sexe'] .'<br />';
|
||||
echo 'Votre sélection de vin(s) est : ' ;
|
||||
foreach ($_REQUEST['formulaire']['vins'] as $key => $valeur) {
|
||||
echo "$valeur" .' , ';
|
||||
}
|
||||
|
||||
echo '<br id="long" /><a href="./exo12.php"><button class="favorite styled" type="button">Reset</button></a>';
|
||||
} else {
|
||||
|
||||
echo ' <p>Les champs marqués d\'une <strong class="mandatory">*</strong> sont obligatoires</p>
|
||||
<form action="./exo12.php" method="post" name="formulaire">
|
||||
<strong class="mandatory">*</strong>Nom : <input type="text" name="formulaire[nom]"><br />
|
||||
<strong class="mandatory">*</strong>Prenom : <input type="text" name="formulaire[prenom]" required /><br />
|
||||
<strong class="mandatory">*</strong>Email : <input type="email" name="formulaire[email]"required /><br />
|
||||
Sexe : <input type="radio" name="formulaire[sexe]" value="Homme" />Homme
|
||||
<input type="radio" name="formulaire[sexe]" value="Femme" />Femme
|
||||
<input type="radio" name="formulaire[sexe]" value="Autre" />Autre(s)<br />
|
||||
Vin(s) Choisi(s) :
|
||||
<input type="checkbox" name ="formulaire[vins][st_emilion]" value="St_Emilion" />St Emilion
|
||||
<input type="checkbox" name ="formulaire[vins][chateau_hermitage]" value="Chateau_Hermitage" />Château l’Hermitage
|
||||
<input type="checkbox" name ="formulaire[vins][entre_les_deux_mers]" value="Entre_les_Deux_Mers" />Entre les Deux Mers
|
||||
<input type="checkbox" name ="formulaire[vins][fitou]" value="Fitou" />Fitou
|
||||
<input type="checkbox" name ="formulaire[vins][bandol]" value="Bandol" />Bandol
|
||||
<input type="checkbox" name ="formulaire[vins][cote_de_provence]" value="Cote_de_Provence" />Côte de Provence<br />
|
||||
<input type="submit" value="Envoyer" />
|
||||
</form>';
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<br id="long" /><a href="./.."><button class="favorite styled" type="button">Retour à la liste des sites.</button></a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
63
TD3/index.php
Executable file
63
TD3/index.php
Executable file
@ -0,0 +1,63 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr-FR">
|
||||
<head>
|
||||
<meta charset ="utf-8" />
|
||||
<title>TD3 - Génération et traitement des formulaires HTML</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>TD3 - Génération et traitement des formulaires HTML</h1>
|
||||
|
||||
<style>
|
||||
h1 {
|
||||
text-align: center;
|
||||
color : blue;
|
||||
}
|
||||
|
||||
h2 {
|
||||
text-align: left;
|
||||
color : DeepSkyBlue ;
|
||||
}
|
||||
|
||||
p {
|
||||
font-weight: bold;
|
||||
color : grey;
|
||||
}
|
||||
|
||||
br {
|
||||
line-height : 3em;
|
||||
}
|
||||
|
||||
br#long {
|
||||
line-height : 10em;
|
||||
}
|
||||
|
||||
strong.mandatory {
|
||||
color : red;
|
||||
}
|
||||
</style>
|
||||
|
||||
<p>Les champs marqués d'une <strong class="mandatory">*</strong> sont obligatoires</p>
|
||||
<form action="./check.php" method="post" name="formulaire">
|
||||
<strong class="mandatory">*</strong>Nom : <input type="text" name="formulaire[nom]"><br />
|
||||
<strong class="mandatory">*</strong>Prenom : <input type="text" name="formulaire[prenom]" required /><br />
|
||||
<strong class="mandatory">*</strong>Email : <input type="email" name="formulaire[email]"required /><br />
|
||||
Sexe : <input type="radio" name="formulaire[sexe]" value="Homme" />Homme
|
||||
<input type="radio" name="formulaire[sexe]" value="Femme" />Femme
|
||||
<input type="radio" name="formulaire[sexe]" value="Autre" />Autre(s)<br />
|
||||
Vin(s) Choisi(s) :
|
||||
<input type="checkbox" name ="formulaire[vins][st_emilion]" value="St_Emilion" />St Emilion
|
||||
<input type="checkbox" name ="formulaire[vins][chateau_hermitage]" value="Chateau_Hermitage" />Château l’Hermitage
|
||||
<input type="checkbox" name ="formulaire[vins][entre_les_deux_mers]" value="Entre_les_Deux_Mers" />Entre les Deux Mers
|
||||
<input type="checkbox" name ="formulaire[vins][fitou]" value="Fitou" />Fitou
|
||||
<input type="checkbox" name ="formulaire[vins][bandol]" value="Bandol" />Bandol
|
||||
<input type="checkbox" name ="formulaire[vins][cote_de_provence]" value="Cote_de_Provence" />Côte de Provence<br />
|
||||
<input type="submit" value="Envoyer" />
|
||||
</form>
|
||||
|
||||
<br id="long" /><a href="./.."><button class="favorite styled" type="button">Retour à la liste des sites.</button></a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
15
TD3/post.php
Normal file
15
TD3/post.php
Normal file
@ -0,0 +1,15 @@
|
||||
<html>
|
||||
<link href="./anim.css" rel="stylesheet">
|
||||
<?php
|
||||
print_r($_REQUEST);
|
||||
|
||||
|
||||
|
||||
?>
|
||||
<br /><br /><br /><br /> <center><div class="radial-timer s-animate"> <div class="radial-timer-half"></div> <div class="radial-timer-half"></div></center>
|
||||
<script>
|
||||
setTimeout(function () {
|
||||
window.location.href = "./index.php";
|
||||
}, 3000);
|
||||
</script>
|
||||
</html>
|
82
TD3/voitures.php
Executable file
82
TD3/voitures.php
Executable file
@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
$voiture = array(
|
||||
"Renault" => array(
|
||||
"Twingo" => 9999,
|
||||
"Clio" => 11999,
|
||||
"Megane" => 13999,
|
||||
"Laguna"=> 18999
|
||||
),
|
||||
|
||||
"Peugeot" => array(
|
||||
"107" => 8999,
|
||||
"207" => 12499,
|
||||
"308" => 14999,
|
||||
"508" => 19999
|
||||
),
|
||||
|
||||
"Citroen" => array(
|
||||
"C1" => 11999,
|
||||
"C3" => 16549,
|
||||
"C4" => 22549,
|
||||
"C5" => 18999
|
||||
),
|
||||
|
||||
"Volkswagen" => array(
|
||||
"Lupo" => 8549,
|
||||
"Polo" => 11549,
|
||||
"Golf" => 16549,
|
||||
"Passat" => 22549
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr-FR">
|
||||
<head>
|
||||
<meta charset ="utf-8" />
|
||||
<title>TD3 - Génération et traitement des formulaires HTML</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>TD3 - Génération et traitement des formulaires HTML</h1>
|
||||
|
||||
<style>
|
||||
h1 {
|
||||
text-align: center;
|
||||
color : blue;
|
||||
}
|
||||
|
||||
h2 {
|
||||
text-align: left;
|
||||
color : DeepSkyBlue ;
|
||||
}
|
||||
|
||||
p {
|
||||
font-weight: bold;
|
||||
color : grey;
|
||||
}
|
||||
|
||||
br {
|
||||
line-height : 3em;
|
||||
}
|
||||
|
||||
br#long {
|
||||
line-height : 10em;
|
||||
}
|
||||
|
||||
strong.mandatory {
|
||||
color : red;
|
||||
}
|
||||
</style>
|
||||
|
||||
<p>Les champs marqués d'une <strong class="mandatory">*</strong> sont obligatoires</p>
|
||||
|
||||
|
||||
<br id="long" /><a href="./.."><button class="favorite styled" type="button">Retour à la liste des sites.</button></a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
5
TD4/Voitures.txt
Normal file
5
TD4/Voitures.txt
Normal file
@ -0,0 +1,5 @@
|
||||
Renault Peugeot Citroen Volkswagen
|
||||
Twingo 107 C1 Lupo
|
||||
Clio 207 C3 Polo
|
||||
Megane 308 C4 Golf
|
||||
Laguna 508 C5 Passat
|
85
TD4/index.php
Normal file
85
TD4/index.php
Normal file
@ -0,0 +1,85 @@
|
||||
<?php
|
||||
$entree = "Voitures.txt";
|
||||
$voitures = fopen("Voitures.txt", "r");
|
||||
$lecture = file("Voitures.txt");
|
||||
|
||||
|
||||
foreach ($lecture as $i => $lecture) {
|
||||
echo $lecture . '<br class="short" />';
|
||||
}
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr-FR">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>TD4 – Manipulation de fichiers</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>TD4 – Manipulation de fichiers</h1>
|
||||
<style>
|
||||
h1 {
|
||||
text-align: center;
|
||||
color: blue;
|
||||
}
|
||||
|
||||
h2 {
|
||||
text-align: left;
|
||||
color: DeepSkyBlue;
|
||||
}
|
||||
|
||||
p {
|
||||
font-weight: bold;
|
||||
color: grey;
|
||||
}
|
||||
|
||||
p.table {
|
||||
font-weight: inherit;
|
||||
color: black;
|
||||
}
|
||||
|
||||
br {
|
||||
line-height: 3em;
|
||||
}
|
||||
|
||||
br.short {
|
||||
line-height: 1em;
|
||||
}
|
||||
|
||||
br#long {
|
||||
line-height: 10em;
|
||||
}
|
||||
|
||||
strong.mandatory {
|
||||
color: red;
|
||||
}
|
||||
|
||||
div {
|
||||
border: 1px;
|
||||
border-color: black;
|
||||
border-style: solid;
|
||||
width: 20%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div>
|
||||
<form method="post" action="upload.php">
|
||||
<ul>
|
||||
<li>
|
||||
<input type="file" name="upload" value="30000" />
|
||||
</li>
|
||||
<br class="short" />
|
||||
<li>
|
||||
<input type="submit" name="envoyer" value="Envoyer" />
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
63
TD4/test.html
Normal file
63
TD4/test.html
Normal file
@ -0,0 +1,63 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr-FR">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>TD4 – Manipulation de fichiers</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p class="table">
|
||||
Renault Peugeot Citroen Volkswagen<br class="short" /> Twingo 107 C1 Lupo<br class="short" /> Clio 207 C3 Polo<br class="short" /> Megane 308 C4 Golf<br class="short" /> Laguna 508 C5 Passat <br class="short" />
|
||||
</p>
|
||||
<h1>TD4 – Manipulation de fichiers</h1>
|
||||
<style>
|
||||
h1 {
|
||||
text-align: center;
|
||||
color: blue;
|
||||
}
|
||||
|
||||
h2 {
|
||||
text-align: left;
|
||||
color: DeepSkyBlue;
|
||||
}
|
||||
|
||||
p {
|
||||
font-weight: bold;
|
||||
color: grey;
|
||||
}
|
||||
|
||||
p.table {
|
||||
font-weight: inherit;
|
||||
color: black;
|
||||
}
|
||||
|
||||
br {
|
||||
line-height: 3em;
|
||||
}
|
||||
|
||||
br.short {
|
||||
line-height: 1em;
|
||||
}
|
||||
|
||||
br#long {
|
||||
line-height: 10em;
|
||||
}
|
||||
|
||||
strong.mandatory {
|
||||
color: red;
|
||||
}
|
||||
|
||||
div {
|
||||
border: 1px;
|
||||
border-color: black;
|
||||
border-style: solid;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
29
TD4/upload.php
Normal file
29
TD4/upload.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
print_r($_FILES["upload"]["name"]);
|
||||
if(preg_match("\Aimg[.*]\Z", $_FILES["upload"])) {
|
||||
echo "yes";
|
||||
} else {
|
||||
echo "no";
|
||||
}
|
||||
|
||||
/**
|
||||
* $target_dir = "upload/";
|
||||
* $target_file = $target_dir . basename($_FILES["upload"]["name"]);
|
||||
* $uploadOk = 1;
|
||||
* $imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
|
||||
* // Check if image file is a actual image or fake image
|
||||
* if(isset($_POST["submit"])) {
|
||||
* $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
|
||||
* if($check !== false) {
|
||||
* echo "File is an image - " . $check["mime"] . ".";
|
||||
* $uploadOk = 1;
|
||||
* } else {
|
||||
* echo "File is not an image.";
|
||||
* $uploadOk = 0;
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
|
||||
|
||||
?>
|
1
TD5/a.txt
Executable file
1
TD5/a.txt
Executable file
@ -0,0 +1 @@
|
||||
Applejack is best ponyApplejack is best ponyApplejack is best pony
|
63
TD5/index.php
Normal file
63
TD5/index.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
$retour = true;
|
||||
function mkd(String $s) {
|
||||
mkdir ($s);
|
||||
echo "Répertoire " .$s ." créé avec succes\n";
|
||||
}
|
||||
|
||||
function rmd(string $s) {
|
||||
rmdir($s);
|
||||
echo "Répertoire " .$s ." supprimé avec succes\n";
|
||||
}
|
||||
|
||||
function mvd(string $s, String $d) {
|
||||
rename($s, $d);
|
||||
echo "Répertoire " .$s ." renommé en " .$d ." avec succes\n";
|
||||
}
|
||||
|
||||
function listD(String $s) {
|
||||
echo 'Affichage de tous les fichier en ' .$s .': <br />';
|
||||
$file = glob("./*" .$s);
|
||||
foreach($file as $filename) {
|
||||
print_r(substr($filename, 2) .'<br />');
|
||||
}
|
||||
}
|
||||
|
||||
function ecrit(String $f,String $s) {
|
||||
$write = fopen($f,'a');
|
||||
fputs($write, $s);
|
||||
fclose($write);
|
||||
}
|
||||
|
||||
function perms(String $f , int $m) {
|
||||
chmod($f, $m);
|
||||
}
|
||||
|
||||
function tree(String $s) {
|
||||
$dir = scandir($s);
|
||||
|
||||
for ($i=0; $i < count($dir); $i++) {
|
||||
if (is_file($dir[$i])) {
|
||||
echo $dir[$i] .'<br />';
|
||||
}
|
||||
}
|
||||
/**
|
||||
* else {
|
||||
tree($dir[$i]);
|
||||
}
|
||||
*/
|
||||
//print_r($dir);
|
||||
}
|
||||
|
||||
//rmd("oc1");
|
||||
//mkd("oc");
|
||||
//mvd("oc", "oc1");
|
||||
//rmd("oc1");
|
||||
|
||||
listD("txt");
|
||||
//ecrit("./a.txt", "Applejack is best pony");
|
||||
perms("a.txt", 0700);
|
||||
|
||||
echo '<br /><br /><br /><br /><br />';
|
||||
|
||||
tree(".");
|
16
TD8/ajout.html
Normal file
16
TD8/ajout.html
Normal file
@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Ajout d'une entrée</title>
|
||||
</head>
|
||||
<body>
|
||||
<form method="post" action="ajoutEntree.php">
|
||||
<label>Nom</label><input id="nom" type="text" name="nom" required><br/>
|
||||
<label>Prenom</label><input id="prenom" type="text" name="prenom" required><br/>
|
||||
<label>NumPost</label><input id="numpost" type="text" name="numpost" required><br/>
|
||||
<input type="submit" name="submit">
|
||||
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
12
TD8/ajoutEntree.php
Normal file
12
TD8/ajoutEntree.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
$connect = new mysqli($servername, $username, $password, $dbname);
|
||||
if($connect->connect_errno){
|
||||
die("Connexion impossible");
|
||||
}else{
|
||||
echo "Connexion OK";
|
||||
}
|
||||
|
||||
$insert = "INSERT INTO ANNUAIRE (nom,prenom,numPost) VALUES (?,?,?)";
|
||||
$stmt = $connect->prepare($insert);
|
||||
$stmt->bind_param("sss",$_POST["nom"],$_POST["prenom"],$_POST["numpost"]);
|
||||
$stmt->execute();
|
15
TD8/createTable.php
Normal file
15
TD8/createTable.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
$connect = new mysqli($servername, $username, $password, $dbname);
|
||||
if ($connect->connect_errno) {
|
||||
die("Connexion impossible");
|
||||
} else {
|
||||
echo "Connexion OK";
|
||||
}
|
||||
$nom = "Bar";
|
||||
$rechercheNom = "SELECT * from ANNUAIRE WHERE nom like'" . $nom . "%'";
|
||||
$SearchPrenome = "SELECT * from ANNUAIRE WHERE nom like'" . $prenom . "%'";
|
||||
$result = $connect->query($rechercheNom);
|
||||
while ($r = $result->fetch_assoc()) {
|
||||
echo '<br/>' . $r["nom"] . " " . $r["prenom"] . " " . $r["numPost"] . " " . $r["id"];
|
||||
}
|
||||
$connect->close();
|
23
TD8/database.php
Executable file
23
TD8/database.php
Executable file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* ----------------------------------------------------------------------------
|
||||
* | database.php |
|
||||
* | Objectif : paramétrer la base de données |
|
||||
* | |
|
||||
* | @author JunkJumper |
|
||||
* | @copyright 2019 - JunkJumper |
|
||||
* | @license https://creativecommons.org/licenses/by/4.0/ License CC BY 4.0|
|
||||
* | @since File available since 10/08/2019 |
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* Le but de ce script est de définir les variables pour vos connexions à vos BDD
|
||||
*/
|
||||
|
||||
$servername = "linserv-info-01.iutnice.unice.fr"; //Vous devez remplacer ici le "localhost" par l'adresse de votrebase de données
|
||||
$username = "sj801446"; //Vous devez indiquer votre nom d'utilisateur pour accèder à la base de données
|
||||
$password = "sj801446"; //Vous devez indiquer ici le mot de passe
|
||||
$dbname = "sj801446_"; //Vous devez remplace le "database" par le nom de votre base de données.
|
||||
|
||||
|
||||
|
||||
?>
|
14
TD8/index.html
Normal file
14
TD8/index.html
Normal file
@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Menu</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Que voulez vous faire</h1>
|
||||
<a href="recherche.html">Recehercher une entrée</a>
|
||||
<a href="ajout.html">Ajouter une entrée</a>
|
||||
<a href="modifnumpost.html">Modifier numero de poste</a>
|
||||
<a href="supprimer.html">Supprimer une entrée</a>
|
||||
</body>
|
||||
</html>
|
15
TD8/modifier.php
Normal file
15
TD8/modifier.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
$connect = new mysqli($servername, $username, $password, $dbname);
|
||||
if($connect->connect_errno){
|
||||
die("Connexion impossible");
|
||||
}else{
|
||||
echo "Connexion OK".'<br/>';
|
||||
}
|
||||
|
||||
$sql ="UPDATE ANNUAIRE SET numPost='".$_POST["numpost"]."' WHERE nom='".$_POST["nom"]."' and prenom='".$_POST["prenom"]."'";
|
||||
if($connect->query($sql)===TRUE && $connect->affected_rows>0){
|
||||
echo "Mise à jour OK".'<br/>';
|
||||
}
|
||||
else{
|
||||
echo "Erreur lors de la mise à jour : ".$connect->error;
|
||||
}
|
16
TD8/modifnumpost.html
Normal file
16
TD8/modifnumpost.html
Normal file
@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Modifier un numero de poste</title>
|
||||
</head>
|
||||
<body>
|
||||
<form method="post" action="modifier.php">
|
||||
<label>Nom </label><input id="nom" type="text" name="nom" ><br/>
|
||||
<label>Prenom</label><input id="prenom" type="text" name="prenom" ><br/>
|
||||
<label>Nouveau numéro de poste</label><input id="numpost" type="text" name="numpost" ><br/>
|
||||
<input type="submit" name="submit">
|
||||
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
15
TD8/recherche.html
Normal file
15
TD8/recherche.html
Normal file
@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>recherche dans table ANNUAIRE</title>
|
||||
</head>
|
||||
<body>
|
||||
<form method="post" action="rechercheTable.php">
|
||||
<label>Par nom</label><input id="nom" type="text" name="nom" ><br/>
|
||||
<label>Par prenom</label><input id="prenom" type="text" name="prenom" ><br/>
|
||||
<input type="submit" name="submit">
|
||||
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
29
TD8/rechercheTable.php
Normal file
29
TD8/rechercheTable.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
$connect = new mysqli($servername, $username, $password, $dbname);
|
||||
if($connect->connect_errno){
|
||||
die("Connexion impossible");
|
||||
}else{
|
||||
echo "Connexion OK";
|
||||
}
|
||||
$nom="Bar";
|
||||
$rechercheNom = "SELECT * from ANNUAIRE WHERE nom like'". $_POST["nom"]."%'";
|
||||
$recherchePrenom = "SELECT * from ANNUAIRE WHERE nom like'".$_POST["prenom"]."%'";
|
||||
$rechercheNomEtPrenom= "SELECT * from ANNUAIRE WHERE prenom like'".$_POST["prenom"]."%' and nom like'". $_POST["nom"]."%'";
|
||||
if(!empty($_POST["prenom"]) && !empty($_POST["nom"])){
|
||||
$result = $connect->query($rechercheNomEtPrenom);
|
||||
}
|
||||
elseif (!empty ($_POST["prenom"])) $result = $connect->query($recherchePrenom);
|
||||
elseif ( !empty ($_POST["nom"])) $result = $connect->query($rechercheNom);
|
||||
echo '<br/>'."Resultat de la recherche";
|
||||
while($r=$result->fetch_assoc()) {
|
||||
echo '<br/>'.$r["nom"]." ".$r["prenom"]." ".$r["numPost"]." ".$r["id"];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$connect->close();
|
||||
|
15
TD8/supprimer.html
Normal file
15
TD8/supprimer.html
Normal file
@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Supprimer une entrée</title>
|
||||
</head>
|
||||
<body>
|
||||
<form method="post" action="supprimer.php">
|
||||
<label>Nom</label><input id="nom" type="text" name="nom" ><br/>
|
||||
<label>Prenom</label><input id="prenom" type="text" name="prenom" ><br/>
|
||||
<input type="submit" name="submit">
|
||||
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
14
TD8/supprimer.php
Normal file
14
TD8/supprimer.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
$connect = new mysqli($servername, $username, $password, $dbname);
|
||||
if ($connect->connect_errno) {
|
||||
die("Connexion impossible");
|
||||
} else {
|
||||
echo "Connexion OK" . '<br/>';
|
||||
}
|
||||
|
||||
$sql = "DELETE FROM ANNUAIRE WHERE nom='" . $_POST["nom"] . "' and prenom='" . $_POST["prenom"] . "'";
|
||||
if ($connect->query($sql) === TRUE && $connect->affected_rows > 0) {
|
||||
echo "Suppression OK" . '<br/>';
|
||||
} else {
|
||||
echo "Erreur lors suppression : " . $connect->error;
|
||||
}
|
64
index.php
Normal file
64
index.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
$dirT = getcwd();
|
||||
$dir = basename(($dirT));
|
||||
|
||||
?>
|
||||
|
||||
<!doctype html>
|
||||
<html lang="en" class="no-js">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title><?php echo "Displaying content of " .$dir?></title>
|
||||
<link href="https://www.junkjumper-projects.com/images/ls/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://www.junkjumper-projects.com/images/ls/css/sticky-menu.css" rel="stylesheet">
|
||||
</head>
|
||||
<body data-spy="scroll" data-target=".navbar-fixed-top">
|
||||
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
|
||||
<div class="container">
|
||||
<div class="navbar-header page-scroll">
|
||||
<a class="navbar-brand page-scroll" href="..">Localhost</a>
|
||||
</div>
|
||||
|
||||
<div class="collapse navbar-collapse navbar-ex1-collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="hidden">
|
||||
<a class="page-scroll" href="#page-top"></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div> <!-- .navbar-collapse -->
|
||||
</div> <!-- .container -->
|
||||
</nav>
|
||||
<!-- Welcome -->
|
||||
<section id="welcome" class="welcome-section">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<img src="https://www.junkjumper-projects.com/images/ls/img/banner.png" alt="content" id="h2" />
|
||||
|
||||
|
||||
<br />
|
||||
<?php
|
||||
$path = ".";
|
||||
$dh = opendir($path);
|
||||
$i=1;
|
||||
while (($file = readdir($dh)) !== false) {
|
||||
if($file != "." && $file != ".." && $file != "index.php" && $file != ".htaccess" && $file != "error_log" && $file != "src" && $file != "cgi-bin") {
|
||||
if (filetype($file) == "dir")
|
||||
{
|
||||
echo "<a href='$path/$file' class='ls-s'><img src='./src/folder.png' alt='folder' class='icon' />$file</a><br />";
|
||||
} else {
|
||||
echo "<a href='$path/$file' class='ls-s'><img src='./src/file.png' alt='folder' class='icon' />$file</a><br />";
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</body>
|
||||
|
||||
</html>
|
BIN
src/banner.png
Normal file
BIN
src/banner.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 136 KiB |
BIN
src/file.png
Normal file
BIN
src/file.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 181 KiB |
BIN
src/folder.png
Normal file
BIN
src/folder.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 170 KiB |
Loading…
x
Reference in New Issue
Block a user