Diff between 1274708d35f0ab7dcac384b8c051d34a996def8f and 9e68f21f75868f924609e2f90ad81641f39538a5

Changed Files

File Additions Deletions Status
public/admin.php +1 -0 modified
public/harjoittelupaikat.php +37 -14 modified
public/index.php +1 -7 modified
public/kirjautuminen.php +1 -5 modified
public/register.php +2 -6 modified
public/uusharjoittelupaikka.php +2 -6 modified
public/uusopiskelija.php +1 -5 modified
src/footer.php +7 -0 added
src/hae_harjoittelupaikat.php +0 -20 deleted

Full Patch

diff --git a/public/admin.php b/public/admin.php
index 69231e8..c15c669 100644
--- a/public/admin.php
+++ b/public/admin.php
@@ -83,5 +83,6 @@
             <?php endforeach; ?>
         </table>
     </main>
+	<?php include "../src/footer.php"; ?>
 </body>
 </html>
diff --git a/public/harjoittelupaikat.php b/public/harjoittelupaikat.php
index 99de0bb..d04c826 100644
--- a/public/harjoittelupaikat.php
+++ b/public/harjoittelupaikat.php
@@ -1,3 +1,21 @@
+<?php
+    include "../src/connect.php";
+
+    $sql = "SELECT * FROM harjoittelupaikat";
+    $result = $conn->query($sql);
+
+    $harjoittelupaikat = [];
+    if ($result->num_rows>0) {
+        while($row = $result->fetch_assoc()) {
+            $harjoittelupaikat[] = $row;
+        }
+    } else {
+        echo "Harjoittelupaikkoja ei löytynyt";
+    }
+
+    $conn->close();
+?>
+
 <html lang="en">
 <head>
     <meta charset="UTF-8">
@@ -10,20 +28,25 @@
     <h1>
         Harjoittelupaikat
     </h1>
-    <a href="../src/uusharjoittelupaikka.php">Lisää harjoittelupaikka</a>
+    <a href="../public/uusharjoittelupaikka.php">Lisää harjoittelupaikka</a>
     <main>
-        <section>
-            <div class="table-container">
-                <table>
-                    <tr>
-                        <th>Nimi</th>
-                        <th>Ohjaaja</th>
-                        <th>Yhteystiedot</th>
-                    </tr>
-                    <?php include "../public/hae_harjoittelupaikat.php"; ?>
-                </table> 
-            </div>
-        </section>
+        <table>
+            <tr>
+                 <th>Nimi</th>
+                 <th>Ohjaaja</th>
+                 <th>Yhteystiedot</th>
+             </tr>
+            <?php foreach ($harjoittelupaikat as $harjoittelupaikka): ?>
+                <tr>
+                    <?php 
+                        echo "<td>" . $harjoittelupaikka["nimi"] . "</td>";
+                        echo "<td>" . $harjoittelupaikka["ohjaaja"] . "</td>";
+                        echo "<td>" . $harjoittelupaikka["yhteystiedot"] . "</td>";
+                    ?>
+                </tr>
+            <?php endforeach; ?>
+        </table>
     </main>
+	<?php include "../src/footer.php"; ?>
 </body>
-</html>
\ No newline at end of file
+</html>
diff --git a/public/index.php b/public/index.php
index 0cf35fb..6e35456 100755
--- a/public/index.php
+++ b/public/index.php
@@ -120,13 +120,7 @@ if ($result->num_rows>0){
         </aside>
         -->
     </main>
-    <footer>
-        <hr>
-        <p>&copy; 🐟|🌱|👓👨‍💼|🍻🧊</p>
-		<p><p>&copy; Harjoittelupaikat</p>
-		
-        <a href="/public/index.php">Takaisin alkuun</a>
-	</footer>
+	<?php include "../src/footer.php"; ?>
 	<script>
 		var inputs = document.querySelectorAll('input'); // get the input element
 		inputs.forEach((input) => {
diff --git a/public/kirjautuminen.php b/public/kirjautuminen.php
index 516b726..f25a1d8 100644
--- a/public/kirjautuminen.php
+++ b/public/kirjautuminen.php
@@ -20,10 +20,6 @@
             </form>
         </section>
     </main>
-    <footer>
-        <hr>
-        <p>&copy; Harjoittelupaikat 2025</p>
-        <a href="../public/index.php">Takaisin alkuun</a>
-    </footer>
+	<?php include "../src/footer.php"; ?>
 </body>
 </html>
diff --git a/public/register.php b/public/register.php
index 74fe488..9921237 100644
--- a/public/register.php
+++ b/public/register.php
@@ -21,11 +21,7 @@
                 </fieldset>
             </form>
         </section>
-    </main>
-    <footer>
-        <hr>
-        <p>&copy; Harjoittelupaikat 2025</p>
-        <a href="../public/index.php">Takaisin alkuun</a>
-    </footer>
+	</main>
+	<?php include "../src/footer.php"; ?>
 </body>
 </html>
diff --git a/public/uusharjoittelupaikka.php b/public/uusharjoittelupaikka.php
index d52092f..6ee9830 100644
--- a/public/uusharjoittelupaikka.php
+++ b/public/uusharjoittelupaikka.php
@@ -28,11 +28,7 @@
 		<input type="submit" name="submit" value="Lisää">
 		</form>
 	</section>
-</main>
-  <footer>
-	<hr>
-	<p>&copy; Harjoittelupaikat 2025</p>
-	<a href="../public/index.php">Takaisin alkuun</a>
-</footer>
+	</main>
+	<?php include "../src/footer.php"; ?>
 </body>
 </html>      
diff --git a/public/uusopiskelija.php b/public/uusopiskelija.php
index 03bd1a6..72a5efc 100644
--- a/public/uusopiskelija.php
+++ b/public/uusopiskelija.php
@@ -60,10 +60,6 @@
 		</form>
 	</section>
 </main>
-  <footer>
-	<hr>
-	<p>&copy; Harjoittelupaikat 2025</p>
-	<a href="../public/index.php">Takaisin alkuun</a>
-</footer>
+<?php include "../src/footer.php"; ?>
 </body>
 </html>      
diff --git a/src/footer.php b/src/footer.php
new file mode 100644
index 0000000..3785548
--- /dev/null
+++ b/src/footer.php
@@ -0,0 +1,7 @@
+ <footer>
+        <hr>
+        <p>&copy; 🐟|🌱|👓👨‍💼|🍻🧊</p>
+		<p><p>&copy; Harjoittelupaikat</p>
+		
+        <a href="/public/index.php">Takaisin alkuun</a>
+	</footer>
\ No newline at end of file
diff --git a/src/hae_harjoittelupaikat.php b/src/hae_harjoittelupaikat.php
deleted file mode 100644
index 06b335a..0000000
--- a/src/hae_harjoittelupaikat.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-include "../src/connect.php";
-
-$sql = "SELECT * FROM harjoittelupaikat";
-$result = $conn->query($sql);
-
-if ($result->num_rows>0) {
-	while($row = $result->fetch_assoc()) {
-		echo "<tr>";
-			echo "<td>" . $row["nimi"] . "</td>";
-			echo "<td>" . $row["ohjaaja"] . "</td>";
-			echo "<td>" . $row["yhteystiedot"] . "</td>";
-		echo "</tr>";
-	}
-} else {
-	echo "Harjoittelupaikkoja ei löytynyt";
-}
-
-$conn->close();
-?>