-RewriteEngine on
-#redirect /file.php to /file
+RewriteEngine on
+
RewriteCond %{THE_REQUEST} \s/([^.]+)\.php [NC]
RewriteRule ^ /%1 [NE,L,R]
-# now we will internally map /file to /file.php
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)/?$ /$1.php [L]
-RewriteEngine on
-#redirect /file.html to /file
+
RewriteCond %{THE_REQUEST} \s/([^.]+)\.html [NC]
RewriteRule ^ /%1 [NE,L,R]
-# now we will internally map /file to/ file.html
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*)/?$ /$1.html [L]
+
+RewriteCond %{REQUEST_URI} !^/blogs/ [NC]
+RewriteCond %{REQUEST_FILENAME} !-f
+RewriteCond %{REQUEST_FILENAME} !-d
+RewriteRule ^(.*)$ blogs/$1 [L]
+
my-website
+A simple website that I run. Check it out on https://dpolakovic.space
Copyright 2023, David Polakovic
ABOUT:
-This is simple website that I run. You can copy it for sure,
-but read the licence first.
+This is my static, old school, 90's, web 1.0 website. I despise the responsiveness,
+mobile design and client side computing. So I made html/php site to occupy little
+piece of cyberspace. Here is description of the files:
+
+.htaccess - hides file extensions in address bar
+index.php - the "About page" with contacts (not much going on here)
+blog.php - here I place my toughts which could be sorted by form (blogs or tweets)
+lib.php - my book library in one table
+gpg.html - page with my email gpg key
+test.html - default test page for troubleshooting new features
+both .txt files are sources for php sites with hand written content.
+blog/pics/ - pictures for blogs
+blogs/blog-list.html - source for tweets and links to blogs for blog.php
+blogs/blog-template.html - default template for new blogs
+Pictures/ - directory with all pictures for sites (except the blogs)
+Styles/* - dir with font I use and CSS style file
LICENSE:
https://www.gnu.org/licenses/gpl-3.0.en.html
+
/* Styles.css
this is a file for setting visual styles of the web page
I am no webdesigner so the comments are rather simple
color: inherit;
text-decoration: inherit;
}
+/* styles.css */
+
<ul>
<li><a href="https://dpolakovic.space">About</a></li>
<li><a href="https://dpolakovic.space/blog.php">Blog</a></li>
- <li><a href="https://dpolakovic.space/dir.html">My web directory</a></li>
+ <li><a href="https://dpolakovic.space/lib.php">My library</a></li>
<li><a class="gitserver" href="https://git.dpolakovic.space">Git server</a>
</li>
</ul>
<br>
After eating and breathing, expressing opinions on the internet is the
most important human need. Here are some of mine that occupied my mind
- for more than few seconds.
+ for more than few seconds (but not much more). You can sort them to see
+ bigger blogs or smaller, more random "tweets".
</p>
<?php
- $sort = 'new';
+ $sort = 'all';
// check if hyperlink has been clicked
if (isset($_GET['sort']))
{
$sort = $_GET['sort'];
}
-
- // function to print file line by line
- function printFile($filename)
- {
- $lines = file($filename);
- foreach ($lines as $line)
- {
- echo $line . '<br>';
- }
- }
-
- // function to print file line by line in reverse order
- function printFileReversed($filename)
- {
- $lines = file($filename);
- $reversedLines = array_reverse($lines);
- foreach ($reversedLines as $line)
- {
- echo $line . '<br>';
- }
- }
-
- // function to print file line by line which has "Edit" in them
- function printFileEdited($filename)
- {
- $file = fopen($filename, "r");
+
+
+ // Function for front page, shows latest 5 entries
+ function printFile($filename) {
+ $lines = file($filename);
+ $count = 0; // counter for lines
+ echo '<div>'; // a container for the lines
+
+ foreach ($lines as $line) {
+ echo $line . '<br>';
+ $count++;
+
+ // break the loop after displaying 5 lines
+ if ($count >= 5) {
+ break;
+ }
+ }
+
+ echo '</div>';
+ }
+
+
+ // Prints latest 15 tweets and offers user to see them all
+ function printFileTweets($filename) {
+ $lines = file($filename);
+ $count = 0;
+ echo '<div>';
+
+ foreach ($lines as $line) {
+ // check for word "tweet" in the lines
+ if (strpos($line, 'tweet') !== false) {
+ echo $line . '<br>'; // Display the line if it contains 'foo'
+ $count++;
+
+ if ($count >= 15) {
+ break; // Break the loop after displaying 15 matching lines
+ }
+ }
+ }
+
+ if ($count >= 15) {
+ // Display a clickable link if there are more than 15 matching lines
+ echo '<center><a href="https://dpolakovic.space/blog.php?sort=tweetsfull">Check the rest...</a></center>';
+ }
+
+ echo '</div>';
+ }
+
+ // Prints all tweets
+ function printFileAllTweets($filename) {
+ $file = fopen($filename, "r");
+
while (($line = fgets($file)) !== false) {
- if (strpos($line, 'Edited') !== false)
- {
+ // check for word "tweet" in the lines
+ if (strpos($line, 'tweet') !== false) {
echo $line . '<br>';
- }
- }
- fclose($file);
- }
+ }
+ }
+ fclose($file);
+ }
+
+
+ // Prints latest 15 blogs and offers user to see them all
+ function printFileBlogs($filename) {
+ $lines = file($filename);
+ $count = 0;
+ echo '<div>';
+
+ foreach ($lines as $line) {
+ // check for word "blog-prev" in the lines
+ if (strpos($line, 'blog-prev') !== false) {
+ echo $line . '<br>'; // Display the line if it contains 'foo'
+ $count++;
+
+ if ($count >= 15) {
+ break; // Break the loop after displaying 15 matching lines
+ }
+ }
+ }
+
+ if ($count >= 15) {
+ // Display a clickable link if there are more than 15 matching lines
+ echo '<center><a href="https://dpolakovic.space/blog.php?sort=blogsfull">Check the rest...</a></center>';
+ }
+ echo '</div>';
+ }
+
+
+ // Prints all blogs
+ function printFileAllBlogs($filename) {
+ $file = fopen($filename, "r");
+
+ while (($line = fgets($file)) !== false) {
+ // check for word "blog-prev" in the lines
+ if (strpos($line, 'blog-prev') !== false) {
+ echo $line . '<br>';
+ }
+ }
+ fclose($file);
+ }
?>
<p>
<center>
Sort:
- <a href="?sort=new">New first</a>
- <a href="?sort=old">Old first</a>
- <a href="?sort=edit">Edited only</a>
+ <!-- <a href="?sort=all">All</a> -->
+ <a href="?sort=tweets">Tweets</a>
+ <a href="?sort=blogs">Blogs</a>
</center>
- </p>
- <p>
+ </p><br>
<?php
- //debug
- //echo "<br>Current value of key: $key <br>";
- if ($sort == "new")
- {
- printFile("./blogs/blog-list.html");
+ //debug
+ //echo "<br>Current value of key: $key <br>";
+
+ // Print file sorted by user input
+
+ // save path to the file into variable...
+ $filename = './blogs/blog-list.html';
+
+ // default - main page
+ if ($sort == "all") {
+ printFile($filename);
+ }
+
+ // show first 15 tweets
+ if ($sort == "tweets") {
+ printFileTweets($filename);
+ }
+
+ // show first 15 blogs
+ if ($sort == "blogs") {
+ printFileBlogs($filename);
}
- if ($sort == "old")
- {
- printFileReversed("./blogs/blog-list.html");
+
+ // show all tweets
+ if ($sort == "tweetsfull") {
+ printFileAllTweets($filename);
+ }
+
+ // show all blogs
+ if ($sort == "blogsfull"){
+ printFileAllBlogs($filename);
}
- if ($sort == "edit")
- {
- printFileEdited("./blogs/blog-list.html");
- }
?>
- </p>
<br>
</main>
<a href="https://creativecommons.org/licenses/by-nc-nd/3.0/">CC BY-NC-ND 3.0</a>
- <a href="https://git.dpolakovic.space/?p=my-website;a=tree">this site is free software</a>
</footer>
+ <br><br>
</body>
</html>
+<div class="tweet">01.01.2000<br>blah blah blah</div>
<div class="blog-prev"><div class="blog-prev-img"><a href="https://dpolakovic.space/blogs/blog-template.html"><img src="https://dpolakovic.space/blogs/pics/bug.jpg" alt="text" style="object-position: 100% 0;"></a></div><div class="blog-prev-text"> <a href="https://dpolakovic.space/blogs/blog-template.html">BLOG TITLE</a><br> DATE<br><i> text text text</i></div></div>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Y2K38 bug</title>
+ <title>TITLE HERE</title>
<link rel="icon" href="../Pictures/dot.png">
<link rel="stylesheet" href="../Styles/styles.css?v=1.1">
<link rel="author" href="mailto:email@dpolakovic.space">
<!-- page content -->
<main class="content">
<p>
- <h2>Y2K38 bug</h2>
+ <h2>TITLE HERE</h2>
<i>00.00.0000 - text text text</i>
<br>
<p>
--- /dev/null
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>dpolakovic.space</title>
+ <link rel="icon" href="./Pictures/dot.png">
+ <link rel="stylesheet" href="./Styles/styles.css?v=1.1">
+ <link rel="author" href="mailto:email@dpolakovic.space">
+ <meta name="description" content="personal website and git server">
+ <meta name="author" content="David Polakovic, 2023">
+
+ </head>
+ <body>
+
+ <!-- show pictures (banner) on top of the page -->
+ <div class="banner">
+ <p>
+ <img src="./Pictures/dpolakovic.png" alt="simple">
+ <img src="./Pictures/dot.png" alt="website">
+ <img src="./Pictures/space.png" alt="banner">
+ </p>
+ </div>
+
+ <!-- navigation bar -->
+ <nav class="nav-bar">
+ <ul>
+ <li><a href="https://dpolakovic.space">About</a></li>
+ <li><a href="https://dpolakovic.space/blog.php">Blog</a></li>
+ <!-- <li><a href="https://dpolakovic.space/dir.html">My web directory</a></li> -->
+ <li><a href="https://dpolakovic.space/lib.php">My library</a></li>
+ <li><a href="https://dpolakovic.space/cypher.html">?</a></li>
+ <li><a class="gitserver" href="https://git.dpolakovic.space">Git server</a>
+ </li>
+ </ul>
+ </nav>
+
+ <!-- page content -->
+ <main class="content">
+ <p>
+ <h2> My library </h2>
+ <i> Tell me what you read and I will tell you who you are. </i>
+ <br>
+ <br>
+ These are books I own and read. I tend to organize my library by topics
+ of the books, time I bought them, color of the cover, mood and other
+ subjective, chaotic and random rules. All of these are physical copies
+ of which almost half is from used bookstores.
+ </p>
+ <p>
+ Also, only ~5 million people speak my mother tongue, <i>Slovak</i>, so I
+ deeply value every opportunity I get to read a translated book. And since
+ most of my books are in Slovak language the table includes both English
+ title and traslation title as well.
+ </p>
+ <br>
+ <?php
+ // Read the contents of the lib.txt file
+ $fileContents = file_get_contents('lib.txt');
+
+ // Set the "*" as escape char for new table line
+ $rows = explode('*', $fileContents);
+
+ // Create the table
+ // the styles must be set here because the css won't work
+ // properly with this php monster
+ echo '<table border="1" style="border-collapse: collapse; border: 1px solid grey; width: 100%;">';
+
+ // Process each row
+ foreach ($rows as $key => $row) {
+
+ // Set the "-" as escape char for new column
+ $columns = explode('-', $row);
+
+ // Determine whether this is the first row
+ $isFirstRow = ($key === 0);
+
+ // Start a new table row
+ echo '<tr>';
+
+ // Process each column and create table cells
+ foreach ($columns as $column) {
+
+ // Use <th> for the first row, <td> for the rest
+ $cellTag = $isFirstRow ? 'th' : 'td';
+ // again... sorry for the styles
+ echo '<' . $cellTag . ' style="padding: 2px; border: 1px solid grey">' . htmlspecialchars($column) . '</' . $cellTag . '>';
+ }
+
+ // End the table row
+ echo '</tr>';
+ }
+
+ // End the HTML table
+ echo '</table>';
+ ?>
+ <br><br>
+ </main>
+
+ <!-- footer -->
+ <footer class="footer">
+ copyright 2023 David Polakovic
+ - content of this web is licensed under
+ <a href="https://creativecommons.org/licenses/by-nc-nd/3.0/">CC BY-NC-ND 3.0</a>
+ - <a href="https://git.dpolakovic.space/?p=my-website;a=tree">this site is free software</a>
+ </footer>
+ <br><br>
+
+ </body>
+ </html>
--- /dev/null
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>?</title>
+ <link rel="stylesheet" href="./Styles/styles.css?v=1.1">
+ </head>
+
+ <body>
+ <main class="content">
+ <br><br><br><br><br><br><br>
+ <center>
+ <h2>///revives.hours.hardly</h2>
+ </center>
+ </main>
+ </body>
+
+ </html>
+++ /dev/null
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>dpolakovic.space</title>
- <link rel="icon" href="./Pictures/dot.png">
- <link rel="stylesheet" href="./Styles/styles.css?v=1.1">
- <link rel="author" href="mailto:email@dpolakovic.space">
- <meta name="description" content="personal website and git server">
- <meta name="author" content="David Polakovic, 2023">
-
- </head>
- <body>
-
- <!-- show pictures (banner) on top of the page -->
- <div class="banner">
- <p>
- <img src="./Pictures/dpolakovic.png" alt="simple">
- <img src="./Pictures/dot.png" alt="website">
- <img src="./Pictures/space.png" alt="banner">
- </p>
- </div>
-
- <!-- navigation bar -->
- <nav class="nav-bar">
- <ul>
- <li><a href="https://dpolakovic.space">About</a></li>
- <li><a href="https://dpolakovic.space/blog.php">Blog</a></li>
- <li><a href="https://dpolakovic.space/dir.html">My web directory</a></li>
- <li><a class="gitserver" href="https://git.dpolakovic.space">Git server</a>
- </li>
- </ul>
- </nav>
-
- <!-- page content -->
- <main class="content">
- <p>
- <h2> My web directory </h2>
- <i> Let's explore the Web. </i>
- <br>
- <br>
- Since the online space is vast and still expanding, it is good practice for
- surfers to share links between each other in web directories like this one.
- So here are links I thought you might find useful.
- </p>
- <p>
- <a href="https://directory.fsf.org/wiki/Main_Page">Free software directory</a>
- - a collaborative catalog of free software<br>
- <a href="https://cidr.xyz/">Cidr.xyz</a>
- - when you are setting up network and you don't want to die over subnet
- tables [3]<br>
- <a href="https://tube.cadence.moe/">CloudTube</a>
- - free software instance of youtube.com<br>
- <a href="https://www.floppydisk.com">Floppydisk.com</a>
- - new and refurbished floppies for okay prices [3]<br>
- <a href="https://perlmonks.org/">Perl monks</a>
- - best place to seek help and wisdom in Perl<br>
- <a href="https://cyber.dabamos.de/88x31/index.html">Web buttons</a>
- - here is list of 4000+ web buttons from Cyber Vanguards website<br>
- <a href="https://winworldpc.com/home">WinWorld</a>
- - online museum/library of vintage software<br>
- <a href="https://en.uesp.net/wiki/Main_Page">UESP Wiki</a>
- - everything I ever needed for TES III Morrowind I found here [2]<br>
- </p>
- <p>
- Some of these websites contains "allergens"<br>
- [1] - advertisements,
- [2] - unnecessary cookies,
- [3] - proprietary javascript
- </p>
- <br>
- </main>
-
- <!-- footer -->
- <footer class="footer">
- copyright 2023 David Polakovic
- - content of this web is licensed under
- <a href="https://creativecommons.org/licenses/by-nc-nd/3.0/">CC BY-NC-ND 3.0</a>
- - <a href="https://git.dpolakovic.space/?p=my-website;a=tree">this site is free software</a>
- </footer>
- <br><br>
-
- </body>
- </html>
<ul>
<li><a href="https://dpolakovic.space">About</a></li>
<li><a href="https://dpolakovic.space/blog.php">Blog</a></li>
- <li><a href="https://dpolakovic.space/dir.html">My web directory</a></li>
+ <!-- <li><a href="https://dpolakovic.space/dir.html">My web directory</a></li> -->
+ <li><a href="https://dpolakovic.space/lib.html">My library</a></li>
<li><a class="gitserver" href="https://git.dpolakovic.space">Git server</a>
</li>
</ul>
<a href="./Pictures/david.jpg" class="hide-link">David</a>
and <?php
- $file = "./rnd.html";
+ $file = "./rnd.txt";
// Read all lines from the file into an array
$lines = file($file, FILE_IGNORE_NEW_LINES);
<a href="https://creativecommons.org/licenses/by-nc-nd/3.0/">CC BY-NC-ND 3.0</a>
<br>
<a href="https://git.dpolakovic.space/?p=my-website;a=tree">this site is free software</a>
- </footer>
+ </footer>
+ <div class="what-is-this">
+ <center>
+ ..-. .. -. -.. / - .... . / -... .. --. --. . ... - / -.. --- - / .. -. / .-.. .. -... .-. .- .-. -.--
+ </center>
+ </div>
</body>
</html>
--- /dev/null
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>dpolakovic.space</title>
+ <link rel="icon" href="./Pictures/dot.png">
+ <link rel="stylesheet" href="./Styles/styles.css?v=1.1">
+ <link rel="author" href="mailto:email@dpolakovic.space">
+ <meta name="description" content="personal website and git server">
+ <meta name="author" content="David Polakovic, 2023">
+
+ </head>
+ <body>
+
+ <!-- show pictures (banner) on top of the page -->
+ <div class="banner">
+ <p>
+ <img src="./Pictures/dpolakovic.png" alt="simple">
+ <a href="https://dpolakovic.space/clue.php">
+ <img src="./Pictures/dot.png" alt="website">
+ </a>
+ <img src="./Pictures/space.png" alt="banner">
+ </p>
+ </div>
+
+ <!-- navigation bar -->
+ <nav class="nav-bar">
+ <ul>
+ <li><a href="https://dpolakovic.space">About</a></li>
+ <li><a href="https://dpolakovic.space/blog.php">Blog</a></li>
+ <!-- <li><a href="https://dpolakovic.space/dir.html">My web directory</a></li> -->
+ <li><a href="https://dpolakovic.space/lib.php">My library</a></li>
+ <li><a class="gitserver" href="https://git.dpolakovic.space">Git server</a>
+ </li>
+ </ul>
+ </nav>
+
+ <!-- page content -->
+ <main class="content">
+ <p>
+ <h2> My library </h2>
+ <i> Tell me what you read and I will tell you who you are. </i>
+ <br>
+ <br>
+ These are books I own and read. I tend to organize my library by topics
+ of the books, time I bought them, color of the cover, mood and other
+ subjective, chaotic and random rules. All of these are physical copies
+ of which almost half is from used bookstores.
+ </p>
+ <p>
+ Also, only ~5 million people speak my mother tongue, <i>Slovak</i>, so I
+ deeply value every opportunity I get to read a translated book. And since
+ most of my books are in Slovak language the table includes both English
+ title and traslation title as well.
+ </p>
+ <br>
+ <?php
+ // Read the contents of the lib.txt file
+ $fileContents = file_get_contents('lib.txt');
+
+ // Set the "*" as escape char for new table line
+ $rows = explode('*', $fileContents);
+
+ // Create the table
+ // the styles must be set here because the css won't work
+ // properly with this php monster
+ echo '<table border="1" style="border-collapse: collapse; border: 1px solid grey; width: 100%;">';
+
+ // Process each row
+ foreach ($rows as $key => $row) {
+
+ // Set the "-" as escape char for new column
+ $columns = explode('-', $row);
+
+ // Determine whether this is the first row
+ $isFirstRow = ($key === 0);
+
+ // Start a new table row
+ echo '<tr>';
+
+ // Process each column and create table cells
+ foreach ($columns as $column) {
+
+ // Use <th> for the first row, <td> for the rest
+ $cellTag = $isFirstRow ? 'th' : 'td';
+ // again... sorry for the styles
+ echo '<' . $cellTag . ' style="padding: 2px; border: 1px solid grey">' . htmlspecialchars($column) . '</' . $cellTag . '>';
+ }
+
+ // End the table row
+ echo '</tr>';
+ }
+
+ // End the HTML table
+ echo '</table>';
+ ?>
+ <br><br>
+ </main>
+
+ <!-- footer -->
+ <footer class="footer">
+ copyright 2023 David Polakovic
+ - content of this web is licensed under
+ <a href="https://creativecommons.org/licenses/by-nc-nd/3.0/">CC BY-NC-ND 3.0</a>
+ - <a href="https://git.dpolakovic.space/?p=my-website;a=tree">this site is free software</a>
+ </footer>
+ <br><br>
+
+ </body>
+ </html>
--- /dev/null
+Lng - Author - English title - Translation title (if different) *
+AA - Jon Doe - A book - Kniha *
+++ /dev/null
-my favorite junk food is fish sticks.
-my favorite dinosaur is pterodactyl.
-my favorite drink is White russian (and yes, it happened after I've seen Big Lebowsky).
-my favorite color is yellow.
-I still write "www" in address bar.
-I unironically liked The Phantom Menace.
-I have one tomcat.
-I enjoy hacking board games.
-I willingly play healers in D&D.
-I prefer Star Trek TNG over the Original Series.
-I <i>bn gbo pg dszquphsbgz</i> ;-) .
-I still use shortcuts on desktop.
-I prefer pencils over pens.
-I still use floppy disks for backups.
-I don't drink coffe, but sometimes I drink mate tea.
-I use everything except bookmarks for bookmarking.
-I think way too much about time travel.
-I own ~200g of meteorites.
-I never sit on swivel chairs.
-I don't use Arch btw (I use Trisquel!).
-my favorite ice cream flavor is vanilla.
--- /dev/null
+example.
+and here is another example.
<ul>
<li><a href="https://dpolakovic.space">About</a></li>
<li><a href="https://dpolakovic.space/blog.php">Blog</a></li>
- <li><a href="https://dpolakovic.space/dir.html">My web directory</a></li>
+ <!-- <li><a href="https://dpolakovic.space/dir.html">My web directory</a></li> -->
+ <li><a href="https://dpolakovic.space/lib.html">My library</a></li>
<li><a href="https://dpolakovic.space/test.html">TEST</a></li>
<li><a class="gitserver" href="https://git.dpolakovic.space">Git server</a>
</li>