BlindLaby/list/index.php

30 lines
971 B
PHP
Raw Permalink Normal View History

2020-08-04 12:22:09 +02:00
<?php
session_start();
$currentFile = !empty($_SESSION['file']) ? $_SESSION['file'] : null;
?>
<!DOCTYPE html>
<html lang="en">
2020-08-04 12:22:09 +02:00
<head>
<link rel="stylesheet" type="text/css" href="index.css" />
<style>
#board{width:300px;height:300px; margin:200px auto;}
#start{display:block;}
.current{background-color:yellow;}
</style>
<title>Blind Laby - Create your own</title>
2020-08-04 12:22:09 +02:00
</head>
<body>
<div id="board">
<?php
$folder = new DirectoryIterator('../custom/');
2020-08-04 12:22:09 +02:00
foreach($folder as $file){
if (!$file->isDir() && $file->getExtension() === 'js') {
2020-08-04 12:22:09 +02:00
echo '<a href="http://labs.shikiryu.com/experimental-games/2/?level='.substr($file->getFileName(), 0, -3).'" title="laby '.substr($file->getFileName(), 0, -3).'"';
if($currentFile !== null && $currentFile === $file->getFileName()) echo ' class="current"';
2020-08-04 12:22:09 +02:00
echo '>laby '.substr($file->getFileName(), 0, -3).'</a><br/>';
}
}
?></div>
</body>
</html>