2022-10-21 10:57:50 +02:00

46 lines
1.6 KiB
PHP

<?php
$ok = false;
$filesNotUploaded = true;
require('./config.php');
if(isset($_POST['Envoyer'])) {
if(!empty($_FILES['File'])) {
$fichier = $_FILES['File'];
$uploadDirectory = "./e/"; // fichier d'upload
$fileInfoF = new SplFileInfo($_FILES['File']['name']); // préparation du fichier pour upload
$fileInfoS = new SplFileInfo($_FILES['Signature']['name']); // préparation du fichier pour upload
$nouveauFichierF = $fileInfoF->getFilename();
$nouveauFichierS = $fileInfoS->getFilename();
$pathToSaveF = $uploadDirectory.$nouveauFichierF;
$pathToSaveS = $uploadDirectory.$nouveauFichierS;
move_uploaded_file($_FILES['File']['tmp_name'], $pathToSaveF);
move_uploaded_file($_FILES['Signature']['tmp_name'], $pathToSaveS);
$resCheck = openssl_verify(file_get_contents($pathToSaveF),file_get_contents($pathToSaveS),openssl_csr_get_public_key(file_get_contents("./b/requete")));
$ok = true;
}
}
?>
<html>
<form method="POST" action="e.php" enctype="multipart/form-data">
<label for="File">Fichier : </label><input type="file" id="File" name="File" value=""/><br />
<label for="File">Signature : </label><input type="file" id="Signature" name="Signature" value=""/><br />
<input id="Envoyer" type="submit" name="Envoyer" value="Envoyer" />
</form>
<?php
if($ok) {
echo '<h2 style="color:#0000ff">Document intègre : ' . $resCheck . '</h2>';
} else {
echo '';
}
?>
</html>