All scaffolding now up
This commit is contained in:
1 parent
3a5093af5d
commit
bab3713f61
5 files changed
+98
-16
No files matched your search
@@ -0,0 +1,6 @@
|
||||
var page = require('webpage').create();
|
||||
page.open('http://localhost/nieuws/', function() {
|
||||
setTimeout(function(){
|
||||
phantom.exit();
|
||||
}, 1000);
|
||||
});
|
||||
+57
-1
@@ -1 +1,57 @@
|
||||
<script type="text/javascript">alert('De admin heeft een kijkje op deze pagina genomen');</script>
|
||||
<?php
|
||||
header('X-XSS-Protection: 0');
|
||||
session_start();
|
||||
|
||||
// Check if admin logged in
|
||||
if(@$_POST['email'] == 'admin@nieuws.nl' && @$_POST['password'] == 'sesame') {
|
||||
$_SESSION['admin'] = true;
|
||||
}
|
||||
|
||||
$connection = new mysqli('localhost', 'nieuws', 'pass', 'nieuws')
|
||||
or die('Kan geen verbinding maken met MySQL');
|
||||
|
||||
// Add a comment
|
||||
if(isset($_POST['addcomment'])) {
|
||||
$connection->query("INSERT INTO commentaar SET auteur='anoniem', bericht='".$connection->real_escape_string($_POST['comment'])."'");
|
||||
}
|
||||
?><!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>NIEUWS.nl</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Paul Wagener">
|
||||
|
||||
<link id="callCss" rel="stylesheet" href="/themes/css/bootstrap.min.css" media="screen"/>
|
||||
<link href="/themes/css/bootstrap-responsive.min.css" rel="stylesheet"/>
|
||||
<link rel="stylesheet" href="/themes/css/nieuws.css" media="screen"/>
|
||||
|
||||
<!-- De code in dit bestand is met opzet slecht en zeer onveilig opgezet.
|
||||
GEBRUIK DEZE CODE NIET als referentiemateriaal voor je eigen PHP projecten! -->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<img src="/themes/images/nieuws.png" id="logo">
|
||||
<section id="middle">
|
||||
<div id="datum"><?php setlocale(LC_ALL, 'nl_NL'); echo strftime("%A %e %B %Y"); ?>. Het laatste nieuws het eerst op NIEUWS.nl</div>
|
||||
|
||||
|
||||
<div id="admincheck">
|
||||
<?php
|
||||
|
||||
if($_POST) {
|
||||
shell_exec('phantomjs admincheck.js');
|
||||
echo '<div class="alert alert-warning">De administrator heeft op '.date('r').' een kijkje op de reactie pagina genomen</div>';
|
||||
}
|
||||
?>
|
||||
|
||||
Problemen met de website? Laat het de administrator weten en hij komt een kijkje nemen op de <a href="/nieuws/">reactie pagina</a>.
|
||||
<form method="POST">
|
||||
<button type="submit" name="submit" class="btn btn-primary">Stuur <?php if($_POST)echo 'nog';?> een berichtje naar de administrator</button>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
||||
+25
-15
@@ -1,10 +1,19 @@
|
||||
<?php
|
||||
header('X-XSS-Protection: 0');
|
||||
session_start();
|
||||
|
||||
// Check if admin logged in
|
||||
if(@$_POST['email'] == 'admin@nieuws.nl' && @$_POST['password'] == 'sesame') {
|
||||
$_SESSION['admin'] = true;
|
||||
}
|
||||
|
||||
$connection = new mysqli('localhost', 'nieuws', 'pass', 'nieuws')
|
||||
or die('Kan geen verbinding maken met MySQL');
|
||||
|
||||
// Add a comment
|
||||
if(isset($_POST['addcomment'])) {
|
||||
$connection->query("INSERT INTO commentaar SET auteur='anoniem', bericht='".$connection->real_escape_string($_POST['comment'])."'");
|
||||
}
|
||||
?><!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@@ -60,35 +69,36 @@ if(@$_SESSION['admin']) {
|
||||
|
||||
<div id="comments">
|
||||
<strong>Jouw reactie:</strong>
|
||||
<form method="POST" action="addcomment.php">
|
||||
<form method="POST">
|
||||
<textarea name="comment"></textarea><br />
|
||||
<button type="submit">Reageer op dit bericht</button>
|
||||
<button type="submit" name="addcomment">Reageer op dit bericht</button>
|
||||
</form>
|
||||
<?php
|
||||
$result = $connection->query("SELECT * FROM commentaar ORDER BY id DESC")
|
||||
or die('Query error: ' . $connection->error);
|
||||
|
||||
while ($row = $result->fetch_array()) {
|
||||
?>
|
||||
|
||||
<div class="comment">
|
||||
<div class="comment-header">
|
||||
een tijdje geleden door <span class="author">Paul Wagener</span>
|
||||
door <span class="author"><?php echo $row['auteur']; ?></span>
|
||||
</div>
|
||||
<p>Hoera!</p>
|
||||
<p><?php echo $row['bericht']; ?></p>
|
||||
</div>
|
||||
|
||||
<div class="comment">
|
||||
<div class="comment-header">
|
||||
een tijdje geleden door <span class="author">Paul Wagener</span>
|
||||
</div>
|
||||
<p>Hoera!</p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
$connection->close();
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div id="admincheck">
|
||||
Problemen met de website? Laat het de administrator weten en hij komt een kijkje nemen op deze pagina!
|
||||
<iframe name="iframe" style="display: none;"></iframe>
|
||||
<form method="POST" target="iframe" action="admincheck.php">
|
||||
<button type="btn btn-primary">Stuur een berichtje naar de admin.</button>
|
||||
</form>
|
||||
<a href="admincheck.php">Meld een probleem met deze website</a>
|
||||
</div>
|
||||
</section>
|
||||
</body>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
$connection = new mysqli('localhost', 'nieuws', 'pass', 'nieuws')
|
||||
or die('Kan geen verbinding maken met MySQL');
|
||||
|
||||
$connection->query("TRUNCATE commentaar");
|
||||
|
||||
?>
|
||||
Alle reacties weggehaald.
|
||||
Reference in new issue
Block a user