38 lines
914 B
PHP
38 lines
914 B
PHP
<?php
|
|
$dir = array_diff(scandir("./"), array('..','.','index.php','database.php','forberedelser.php'));
|
|
|
|
$modul = substr($_SERVER['REQUEST_URI'],-2,1);
|
|
|
|
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">
|
|
</head>
|
|
<body>
|
|
|
|
<h1>IS-115 - Webprogrammering i PHP</h1>
|
|
<h3>
|
|
Modul <?=$modul;?>
|
|
</h3>
|
|
<h5>
|
|
<strong><a href="../">Tilbake til alle moduler</a></strong>
|
|
</h5>
|
|
|
|
<?php
|
|
foreach($dir as $item){
|
|
if((stristr($item, '.php') || stristr($item, '.pdf')) && !stristr($item, '.inc.php')){
|
|
echo "<p><a href='$item'>".getModuleName($item)."</a></p>\n";
|
|
}
|
|
}
|
|
?>
|
|
|
|
</body>
|
|
</html>
|