is115-php/modul1/index.php

38 lines
914 B
PHP
Raw Permalink Normal View History

2021-08-23 10:41:53 +02:00
<?php
2021-11-17 08:02:45 +01:00
$dir = array_diff(scandir("./"), array('..','.','index.php','database.php','forberedelser.php'));
2021-08-23 10:41:53 +02:00
$modul = substr($_SERVER['REQUEST_URI'],-2,1);
2021-08-23 10:41:53 +02:00
function getModuleName($input): string {
$oppg = substr($input, -5, 1);
if(is_numeric($oppg)){
return "Oppgave $oppg";
}
return explode('.', $input)[0];
}
?><!DOCTYPE html>
<html lang="no">
<head>
<title>IS-115 - Webprogrammering i PHP</title>
<link rel="stylesheet" href="../index.css">
2021-08-23 10:41:53 +02:00
</head>
<body>
<h1>IS-115 - Webprogrammering i PHP</h1>
<h3>
Modul <?=$modul;?>
</h3>
<h5>
<strong><a href="../">Tilbake til alle moduler</a></strong>
</h5>
2021-08-23 10:41:53 +02:00
<?php
foreach($dir as $item){
2021-11-22 16:33:46 +01:00
if((stristr($item, '.php') || stristr($item, '.pdf')) && !stristr($item, '.inc.php')){
2021-08-23 10:41:53 +02:00
echo "<p><a href='$item'>".getModuleName($item)."</a></p>\n";
}
}
?>
</body>
</html>