include_once 'init.inc.php'; if (isset($_REQUEST['id'])) { $p = new webpage("Iut Stage"); $p->appendToHead(<<<head \t <meta charset="utf-8"> \t <meta http-equiv="X-UA-Compatible" content="IE=edge"> \t <meta name="viewport" content="width=device-width, initial-scale=1"> \t <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> \t <meta name="description" content=""> \t <meta name="author" content=""> head ); $p->appendCssUrl("style/bootstrap-3.3.5-dist/css/bootstrap.min.css"); //inclusion de la barre de navigation include_once "navbar.inc.php"; $stage = Stage::creatFromId($_REQUEST['id']); $entreprise = Entreprise::creatFromId($stage->getEntreprise()); $titre = htmlspecialchars($stage->getTitre()); $nbPoste = htmlspecialchars($stage->getNbPoste()); $dateCreation = htmlspecialchars($stage->getDateCreation()); $ref = htmlspecialchars($stage->getId()); $nom = htmlspecialchars($entreprise->getNom()); $adresse = htmlspecialchars($entreprise->getAdresse()); $tel = htmlspecialchars($entreprise->getTel()); $description = nl2br(htmlspecialchars($stage->getDescription())); $codePostal = htmlspecialchars($entreprise->getCodePostal()); $adresse = htmlspecialchars($entreprise->getAdresse()); $ville = htmlspecialchars($entreprise->getVille()); $dateFin = htmlspecialchars($stage->getDateFin()); $dateDebut = htmlspecialchars($stage->getDateDebut()); $gratification = htmlspecialchars($stage->getGratification());
$email->isHTML(true); $email->Subject = $_REQUEST['titre']; $email->Body = $_REQUEST['contenu']; $email->Body .= <<<HTML \t\t<br/><br/> \t\t<p>-------------------- <br/> \t\t <a href="candidature.php?id={$id}&loginEtudiant={$user->getId()}">Cliquez ici</a> pour valider la candidature.<br/> \t\t <a href="candidature.php?id={$id}&loginEtudiant={$user->getId()}">https://candidature.php?id={$id}&loginEtudiant={$user->getId()}<br/> \t\t --------------------- \t\t</p> HTML; $dir = opendir("/home/Etudiants/pecca001/public_html/" . $dossier_pdf); $match = array(); while (false !== ($entry = readdir($dir))) { if (fnmatch($nomFichier . "*", $entry)) { $email->AddAttachment("../" . $dossier_pdf . "/" . $entry); $match[] = $entry; } } // envoi mail et suppression des pdf uploadés $email->Send(); foreach ($match as $key => $value) { unlink("../" . $dossier_pdf . "/" . $value); //Supprime le fichier } // mise à jour de la base de données $user->postulerStage(Stage::creatFromId($_REQUEST['id'])); header("Location: viewStage.php?id={$_GET['id']}&postuler=true"); } else { header("Location: viewStage.php?id={$_GET['id']}&postuler=false"); }