Website Summary Files Commits Branches @commit @diff @stats
path: root / views / archive / index.php
diff options
context:
space:
mode:
1 files changed, 17 insertions, 12 deletions
-rw-r--r--views/archive/index.php29
diff --git a/views/archive/index.php b/views/archive/index.php
index 64d6a77..4195eb2 100644
--- a/views/archive/index.php
+++ b/views/archive/index.php
@@ -1,16 +1,21 @@
<?php
- $title = $_GET["page_url"] . ' archive';
- include '../meta.php';
-
+ $exists = null;
$page = null;
- runController('archive');
+
+ try {
+ $page = Database\Webpage::fromDB($url);
+ $page->incrementVisits();
+ }
+ catch(Exception $e) {
+ $exists = Controller\doesWebsiteExist($url);
+ }
?>
<?php if ($page !== null): ?>
<iframe src="<?= "/archives/{$page->WID}" ?>" scrolling="no"></iframe>
- <form action="/sample_archive/index.php" method="POST">
- <input type="hidden" name="page_url" value="<?= $_GET["page_url"] ?>">
+ <form action="#" method="POST">
+ <input type="hidden" name="page_url" value="<?= $url ?>">
<input type="submit" value="Archive Now!">
</form>
<!-- Button to add to list -->
@@ -39,16 +44,16 @@
</section>
<?php endforeach; ?>
-<?php elseif(!doesWebsiteExist($_GET["page_url"])): ?>
- <h2>"<?= $_GET["page_url"] ?>" Does not exist!</h2>
+<?php elseif(!$exists): ?>
+ <h2>"<?= $url ?>" Does not exist!</h2>
<p>Submit another request or check the spelling of the site and try again</p>
- <a href="/home/index.php">Go back!</a>
+ <a href="/">Go back!</a>
<?php else: ?>
- <h2>"<?= $_GET["page_url"] ?>" hasn't been archived yet!</h2>
- <form action="/sample_archive/index.php" method="POST">
- <input type="hidden" name="page_url" value="<?= $_GET["page_url"] ?>">
+ <h2>"<?= $url ?>" hasn't been archived yet!</h2>
+ <form action="#" method="POST">
+ <input type="hidden" name="page_url" value="<?= $url ?>">
<input type="submit" value="Archive Now!">
</form>