Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Mindup Computer Werkplaats Test Website</title>
- <style>
- body {
- margin: 0px;
- }
- .banner {
- background-color: black;
- text-align: center;
- color: lime;
- margin: 0px auto;
- height: 100px;
- padding:5px;
- }
- a {color: #c8d401;text-decoration:none;}
- a:link {color: #c8d401;}
- a:visited {color: #c8d401;}
- a:hover {color: #FF0000;}
- </style>
- <?php
- function ldir($dir) {
- if ($dh = opendir($dir)){
- $c = "0";
- while (($file = readdir($dh)) !== false){
- $ctime = filectime($dir.$file).','.$file;
- $list[$ctime] = $file;
- }
- closedir($dh);
- asort($list);
- }
- if (!empty($_GET)) {
- foreach ($_GET as $num => $value) {
- foreach ($list as &$file) {
- $con = file_get_contents($dir.$file);
- if ($file !== "." and $file !== ".."){
- $c = $c + 1;
- }
- if ($c == $num) {
- echo "<h2 style='color:#c8d401'>".$file."</h2><br/>".$con;
- $fof = true;
- }
- }
- if ($fof !== true) {
- echo "<h1 style='text-align:center'>404 Document niet gevonden.</h1>";
- }
- }
- }
- else {
- foreach ($list as &$file) {
- $con = file_get_contents($dir.$file);
- if ($file !== "." and $file !== ".."){
- $c = $c + 1;
- echo "<h2><a href='index.php?".$c."'>".$file."</a></h2><br/>";
- if ($c < 6){
- if (strlen($con) > 300){
- $con = substr($con, 0, 300) . '...';
- }
- echo $con."<br/>";
- }
- }
- }
- }
- }
- ?>
- </head>
- <body>
- <div class="banner"><h1><a href="index.php" >MindUp Computer Werkplaats Drachten</a></h1></div>
- <div id="Content">
- <?php ldir("./content/"); ?>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement