This commit is contained in:
S60W79 2025-04-26 23:11:43 +02:00
commit 42c4dea3dd
3 changed files with 106 additions and 0 deletions

33
rssvoucher.php Executable file
View file

@ -0,0 +1,33 @@
<?php
// Set the base API endpoint
header('Content-Type: application/rss+xml; charset=utf-8');
sleep(2);
echo '<?xml version="1.0" encoding="UTF-8"?> ';
echo '<rss version="2.0">';
echo '<channel>';
echo '<title>Ascii Voucher</title>';
echo '<link>https://ifsr.de</link>';
echo '<description>Über diesen feed wird informiert, ob du in der Verlosung einen Ascii Gutschein gewonnen hast.</description>';
include('valids.php');
if (in_array(intval($_GET["code"]), $valid)){
echo '<item>';
echo '<title>ASCII: Gewonnen!</title>';
echo '<description>Du hast für das Ausfüllen der ESE Umfrage einen Ascii Gutschein gewonnen. Zeige im Ascii einfach den Code "'.$_GET["code"].'". Der Gutscheincode ist bis zum Ende des Semesters für zwei Getränke gültig.</description>';
echo '<pubDate>' . $pubdate . '</pubDate>';
echo '<guid>' . $_GET["code"] . '</guid>';
echo '<link>https://users.ifsr.de/~marco.lehner/voucher.php?code='.$_GET["code"].'</link>';
echo '</item>';
}else{
echo '<item>';
echo '<title>ASCII: Verloren</title>';
echo '<description>Du hast in der Verlosung für die ESE Umfrage leider keinen Gutschein gewonnen. Sorry :/</description>';
echo '<pubDate>' . $pubdate . '</pubDate>';
echo '<guid>' . $_GET["code"] . '</guid>';
echo '<link>https://users.ifsr.de/~marco.lehner/voucher.php?code='.$_GET["code"].'</link>';
echo '</item>';
}
echo '</channel>';
echo '</rss>';
?>

6
valids.php Executable file
View file

@ -0,0 +1,6 @@
<?php
// in diesem Array einfach alle gutschein codes die valid bzw. explizit invalid sind auflisten
$valid = array();
$invalid = array();
$pubdate="Sat, 26 Oct 2024";
?>

67
voucher.php Executable file
View file

@ -0,0 +1,67 @@
<html>
<head>
<title>
Ascii Voucher
</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8">
<style>
body {
font-family: sans-serif;
margin: 5%;
}
.greenBack{
text-align: center;
color: white;
background-color: rgb(161,205,26);
}
.buttons{
background-color: rgb(181,225,45);
}
.piclist {
display: grid;
grid-template-columns: 1fr 1fr;
grid-gap: 2em;
}
.pic{
background-color: rgb(181,225,45);
border: 2px;
width: 100%;
height: auto;
}
</style>
</head>
</body>
<div class="greenback"><br><h1>Ascii Voucher</h1><br></div>
<div class="greenback"><h2>Status:</h2>
<?php
sleep(3);
include("valids.php");
if (in_array(intval($_GET["code"]), $valid)){
//code won
echo "<h3>===>Gewonnen!<===</h3>Du hast in der Verlosung gewonnen und kannst den Code im Ascii zeigen, um dort zwei Freigetränke zu erhalten: Ein Heißgetränk UND ein Kaltgetränk. Der Gutschein ist bis zum <b>Ende des Semesters</b> gültig.";
echo "</div><div class='greenback'><img style='max-width:30%; max-heigh:20%;' src='https://upload.wikimedia.org/wikipedia/commons/thumb/2/21/Eo_circle_blue-grey_white_checkmark.svg/240px-Eo_circle_blue-grey_white_checkmark.svg.png' alt=' A white-on-blue-grey circle icon with a(n) checkmark symbol from the Emoji One BW icon font.'></div>";
echo "<div class='greenback'><h2>Code: ".$_GET["code"]."</h2></div>";
}else{
//code won
echo "<h3>===>Verloren<===</h3>Du hast leider keinen Getränkegutschein gewonnen. Sorry :/";
echo "</div><div class='greenback'><img style='max-width:30%; max-heigh:20%;' src='https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Eo_circle_red_not-allowed.svg/240px-Eo_circle_red_not-allowed.svg.png' alt='A red circle icon with a(n) not-allowed symbol from the Emoji One BW icon font.'></div>";
}
?>
</div>
<br><div class="greenback">
<?php
echo "<a href='rssvoucher.php?code=".$_GET["code"]."'>";
?>
<img style="height:2%;" src='https://upload.wikimedia.org/wikipedia/commons/thumb/4/43/Feed-icon.svg/128px-Feed-icon.svg.png'>RSS Feed</a>
</div><div class="greenback">
<img style="height:15%; max-width:30%;" src="ifsr.svg" alt="ifsr logo: tropfen artige Skulptur mit Aufschrift fachschaftrat informatik, schwarz-weiß"><img style="height:15%; max-width:30%; padding:1%;" src="ascii.svg" alt="Logo des asciis: M ännchen, was eine Tasse umarmt">
</div>
</body>
</html>