This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
isset($_POST['submit']) && !empty($_FILES['pdf_file']['name'])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$_FILES['pdf_file']['error'] != 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$project_name = htmlspecialchars($_POST['project_name']); | |
$file_name = $_FILES['pdf_file']['name']; | |
$file_tmp = $_FILES['pdf_file']['tmp_name']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$pdf_blob = fopen($file_tmp, "rb") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
include __DIR__."/includes/DatabaseConnection.php"; | |
$insert_sql = "INSERT INTO `project_pdf` (`project_name`, `pdf_doc`) | |
VALUES(:project_name, :pdf_doc);"; | |
$stmt = $pdo->prepare($insert_sql); | |
$stmt->bindParam(':project_name', $project_name); | |
$stmt->bindParam(':pdf_doc', $pdf_blob, PDO::PARAM_LOB); | |
if ($stmt->execute() === FALSE) { | |
echo 'Could not save information to the database'; | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous"/> | |
<title><?=$title?></title> | |
<?=$output?> | |
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script> | |
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384–9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script> | |
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
</p><div class="d-flex justify-content-center align-self-center" style="margin-top: 100px;"> | |
<h5 class="text-center">Current PDF Projects</h5> | |
</div> | |
<div class="d-flex justify-content-center align-self-center" style="margin-top: 55px;"> | |
<ul> | |
<?php foreach ($records as $row):?> | |
<li><a href="display.php?id=<?=$row['id']?>" target="_blank"><?=$row['project_name']?></a></li> | |
<?php endforeach;?> | |
</ul> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
include __DIR__."/includes/DatabaseConnection.php"; | |
$sql = "SELECT id, project_name | |
FROM project_pdf | |
ORDER BY project_name ASC;"; | |
$result = $pdo->query($sql); | |
foreach ($result as $row) { | |
$records[] = [ | |
'id' => $row['id'], | |
'project_name' => $row['project_name'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT id, project_name | |
FROM project_pdf | |
ORDER BY project_name ASC; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include __DIR__."/templates/base.html.php"; |