gewinnspiel-1.php
Quell Code
<?php
error_reporting(E_ALL);
ini_set('display_errors', true);
$runde_1='2.2';
$runde_2='4.5';
if(isset($_GET['level'])){
$level=$_GET['level'];
}else{
$level='Error';
}
if(isset($_GET['link'])){
$link=$_GET['link'];
}else{
$link='Error';
}
$pfad_this_datei=$_SERVER['PHP_SELF'];
?>
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta name="description" content="Gewinnspiel Level <?php echo $level; ?> und Link <?php echo $link; ?>">
<title>Gewinnspiel Level <?php echo $level; ?> und Link <?php echo $link; ?></title>
<style>
*{
margin: 0;
padding: 0;
}
nav{
position: fixed;
top: 0;
background: #eee;
height: 60px;
width: 100%;
background:grey;
}
.navbar-list {
list-style: none;
display:flex;
}
.navbar-item {
display:block;
flex:1;
text-align:center;
}
.navbar-link {
line-height: 60px;
color:white;
text-decoration: none;
font-weight: 600;
font-size: 16px;
}
.navbar-submenu {
display: none;
position: absolute;
list-style: none;
width:calc(100% / 3);
margin-left: -10px;
text-align:center;
}
.navbar-item:hover > .navbar-submenu {
display: block;
}
li{
background:grey;
color:white;
width:100%;
cursor: pointer;
}
a{
text-decoration: none;
line-height: 30px;
color:white;
font-size: 14px;
}
main{
margin-top:100px;
}
main a{
font-size:50px;
color:green;
}
#info{
width:100%;
text-align:center;
}
main *{
text-align:center;
margin:50px auto;
}
</style>
</head>
<body>
<nav class="navbar">
<ul id="nav" class="navbar-list">
<?php
if(isset($_GET['level'])){
$level=$_GET['level'];
if($level==1){
$aend=5;
$bend=5;
}
if($level==2){
$aend=8;
$bend=15;
}
$ausgabe="<h1>Gewinnspiel Level $level </h1>";
for($a=1;$a<$aend;$a++){
echo "<li class='navbar-item'><a href='#' class='navbar-link'>Menue $a</a>";
echo '<ul class="navbar-submenu">';
for($b=1;$b<$bend;$b++){
echo "<li><a href='$pfad_this_datei?level=$level&link=$a.$b'>Item $b</a></li>";
}
echo '</ul></li>';
}
}else{
$ausgabe="<div id='info'><h2>Klick hier um das Game zu begionnen</h2><br>
<a href='$pfad_this_datei?level=1'>Starte das Game</a></div>";
}
if(isset($_GET['link']) and isset($_GET['level'])){
if($_GET['link']==$runde_1){
$ausgabe="<div id='info'><h2>Glückwunsch</h2>
<a href='$pfad_this_datei?level=2'>hier geht es weiter zu Level 2</a>
</div>";
}
}
if(isset($_GET['link']) and isset($_GET['level'])){
if($_GET['link']==$runde_2){
$ausgabe="<div id='info'><h2><a style='font-size:100px;color:red'>Glückwunsch<br> du hast gewonnen</a></div>";
}
}
?>
</ul>
</nav>
<main>
<h1><?php echo $ausgabe; ?></h1>
<p>klicke durch die Links bis du hinweiss zum nächsten Level hast</p>
</main>
</body>
</html>