Webpage for Games
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.8 KiB

<!DOCTYPE html>
<html lang="en">
<head>
2 years ago
<meta charset="utf-8">
<link href="styles.css" rel="stylesheet">
<title>Benjamin Kraft: Games</title>
</head>
<body>
<div id="content">
2 years ago
<h1>Benjamin Kraft: Games</h1>
<div id="projects-container">
<?php
require "php/mysql_connect.php";
2 years ago
$conn = new MySQLConnection();
2 years ago
$tag = array_key_exists("tag", $_GET) ? $conn->escape($_GET["tag"]) : null;
$sort = array_key_exists("sort", $_GET) ? $_GET["sort"] : "0";
$queryFiltered =
<<<SQL
SELECT P.name, P.display_name, P.version, P.info, P.date_updated
FROM projects P INNER JOIN project_tags PT ON P.name=PT.project_name
WHERE visible=1 AND PT.tag_name='$tag'
ORDER BY date_updated DESC
SQL;
$queryUnfiltered =
2 years ago
<<<SQL
SELECT name, display_name, version, info_text, date_updated
FROM projects
WHERE visible=1
ORDER BY date_updated DESC
SQL;
2 years ago
$result = $conn->query($queryUnfiltered);
while ($row = $result->fetch_assoc()) {
$name = $row["name"];
$displayName = $row["display_name"];
$version = $row["version"];
$info = $row["info_text"];
$dateUpdated = $row["date_updated"];
2 years ago
$imgAddress = "/projects/$name/thumbnail.png";
2 years ago
$nameDom = "<h3 class='project-name'>$displayName</h3>";
$versionDom = "<h4 class='project-version'>$version</h4>";
$infoDom = "<div class='project-info'>$info</div>";
$startDom = "<button class='project-start' onclick='window.location = \"projects/$name/\"'>Start</button>";
2 years ago
$imgDom = "<img class='project-image' src='$imgAddress' alt='Alternative image text'/>";
$descriptionDom = "<div class='project-description'>$nameDom$versionDom$infoDom$startDom</div>";
2 years ago
echo "<div class='project'>$imgDom$descriptionDom</div>";
}
?>
</div>
</div>
</body>
</html>