* started adding basic php

This commit is contained in:
david 2025-09-17 11:08:20 +02:00
parent 3314abd73d
commit 9ec0afcee8
15 changed files with 76 additions and 9 deletions

View File

@ -8,3 +8,5 @@ autorestart=true
[program:apache2]
command=/usr/sbin/apache2ctl -D FOREGROUND
autorestart=true
# [program:mysql-server]

View File

@ -10,6 +10,7 @@ RUN apt update && apt upgrade -y && \
vim \
supervisor \
openssh-server \
mysql-server \
sudo \
cowsay \
&& rm -rf /var/lib/apt/lists/*

View File

@ -10,21 +10,24 @@
<body>
<div class="nav-bar">
<ol>
<a href="/"><li><img alt="logo" class="logo" src="static/img/logo.jpg"> Tux Gallery </li></a>
<a href="/view.html"><li>View</li></a>
<a href="/login.html"><li>Login</li></a>
<a href="/index.php"><li><img alt="logo" class="logo" src="static/img/logo.jpg">Tux Gallery </li></a>
<a href="/login.php"><li>Login</li></a>
</ol>
</div>
<div class="wrapper">
<section class="info-part">
<h1>Tux gallery</h1>
<p>Tux is awesome ! So I made this extremely secure gallery.</p>
<p>You can also add tux pictures to the gallery, first <a href="login.html">login</a> and then you should be able to upload a new image of tux.</p>
<p>You can also add tux pictures to the gallery, first <a href="login.php">login</a> and then you should be able to upload a new image of tux.</p>
</section>
<section class="gallery-part">
<div class="gallery">
<img alt="placeholder">
<img alt="placeholder2">
<?php
foreach (new DirectoryIterator('static/img/gallery') as $file) {
if($file->isDot()) continue;
print '<img src="static/img/gallery/'. $file->getFilename() . '">';
}
?>
</div>
</section>
</div>

View File

40
www/login.php Normal file
View File

@ -0,0 +1,40 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tux gallery !</title>
<link rel="stylesheet" href="static/css/stylesheet.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<body>
<div class="nav-bar">
<ol>
<a href="/index.php"><li><img alt="logo" class="logo" src="static/img/logo.jpg">Tux Gallery </li></a>
<a href="/login.php"><li>Login</li></a>
</ol>
</div>
<div class="wrapper">
<form id="loginForm" method="POST" action="login.php">
<h1>Login</h1>
<p>Note : The register feature is not implemented yet !</p>
<label for="username">Username</label>
<input type="text" id="username" name="username">
<label for="password">Password</label>
<input type="password" id="password" name="password">
<input type="button" class="btn btn-primary" value="Login">
</form>
</div>
<?php
if (! empty($_POST)) {
$name = $_POST['username'];
$password = $_POST['password'];
if (empty($name)) {
echo "Username is empty";
} else {
echo $name;
}
}
?>
</body>
</html>

View File

@ -39,9 +39,30 @@
.wrapper {
display:flex;
align-content: center;
justify-content: center;
display:block;
margin-left:15%;
margin-right:15%;
}
.info-part{
margin-left:25%;
margin-right:25%;
}
.gallery img{
max-width:250px;
max-height:250px;
}
.gallery{
padding:10px;
background-color:black;
display:grid;
grid-template-columns: auto auto auto auto;
}
#loginForm{
display:grid;
margin-right:30%;
margin-left:30%;
gap:5px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 483 KiB