diff options
| author | Horus | 2016-09-27 22:03:13 +0200 |
|---|---|---|
| committer | Horus | 2016-09-27 22:03:13 +0200 |
| commit | 4d89a18e0579783bb9a221f71d42630c6d79d3f6 (patch) | |
| tree | 9700b065cd4cc2e343c6467379323ebc49cf9751 /intern.gospeladlershof.de | |
| parent | 350f1679eee7969cf1cf46c35488201619fc2ae0 (diff) | |
| download | gospeladlershof.de-4d89a18e0579783bb9a221f71d42630c6d79d3f6.tar.gz | |
Login gebaut + Seite sieht schöner aus.
Diffstat (limited to 'intern.gospeladlershof.de')
| -rw-r--r-- | intern.gospeladlershof.de/code/login.php | 33 | ||||
| -rw-r--r-- | intern.gospeladlershof.de/code/logout.php | 9 | ||||
| -rw-r--r-- | intern.gospeladlershof.de/code/session.php | 8 | ||||
| -rw-r--r-- | intern.gospeladlershof.de/css/signin.css | 40 | ||||
| -rw-r--r-- | intern.gospeladlershof.de/header.php | 34 | ||||
| -rw-r--r-- | intern.gospeladlershof.de/index.php | 19 | ||||
| -rw-r--r-- | intern.gospeladlershof.de/konzert.php | 3 | ||||
| -rw-r--r-- | intern.gospeladlershof.de/login.php | 48 | ||||
| -rw-r--r-- | intern.gospeladlershof.de/proben.php | 4 |
9 files changed, 184 insertions, 14 deletions
diff --git a/intern.gospeladlershof.de/code/login.php b/intern.gospeladlershof.de/code/login.php new file mode 100644 index 0000000..efe259d --- /dev/null +++ b/intern.gospeladlershof.de/code/login.php @@ -0,0 +1,33 @@ +<?php + +define("LOGIN_SITE", true); +require_once __DIR__ . '/session.php'; + +$mail = $_REQUEST["email"]; +$passwd = hash("sha512", $_REQUEST["password"]); + +$addresses= file(__DIR__ . "/../../intern/chor_list_member.txt", FILE_IGNORE_NEW_LINES); + +if ( "2397be3187f0ab864802fbe2b6c3207a01328988d524973d4eeaa48928410a2588263882e37e68363691fd8d7c3c83e8ebe46166bee13404ae61484c13b55e1f" === $passwd || + "319e789e0fa1867bb08b197b306cc48aa0a109511f5e36dbdd1ed642cda8b7f222b0b6a31a43d2302d17562734d40eeb1f85cb99b4bf3101b3c7cef490d89ed2" === $passwd ) { + + foreach($addresses as $a) { + if ( strtolower($mail) === strtolower($a) ) { + $_SESSION["login"] = true; + $_SESSION["success"] = "Erfolgreich eingeloggt."; + + $_SESSION["dontdisplaydeploybutton"] = 1; + + header($_SERVER["SERVER_PROTOCOL"] . " 302 Redirect"); + header("Location: /"); + + exit; + } + } +} + +$_SESSION["login"] = false; +$_SESSION["error"] = "E-Mail oder Passwort stimmmen nicht überein."; + +header($_SERVER["SERVER_PROTOCOL"] . " 302 Redirect"); +header("Location: /login.php"); diff --git a/intern.gospeladlershof.de/code/logout.php b/intern.gospeladlershof.de/code/logout.php new file mode 100644 index 0000000..c292bc8 --- /dev/null +++ b/intern.gospeladlershof.de/code/logout.php @@ -0,0 +1,9 @@ +<?php + +define("LOGIN_SITE", true); +require_once __DIR__ . '/session.php'; + +session_destroy(); + +header($_SERVER["SERVER_PROTOCOL"] . " 302 Redirect"); +header("Location: https://www.gospeladlershof.de/"); diff --git a/intern.gospeladlershof.de/code/session.php b/intern.gospeladlershof.de/code/session.php index f991aed..f9f4755 100644 --- a/intern.gospeladlershof.de/code/session.php +++ b/intern.gospeladlershof.de/code/session.php @@ -2,3 +2,11 @@ session_name("gospelchor"); session_start(); + +if ( ! defined("LOGIN_SITE") || ! LOGIN_SITE ) { + if ( ! isset($_SESSION["login"]) || ! $_SESSION["login"] ) { + header($_SERVER["SERVER_PROTOCOL"] . " 302 Redirect"); + header("Location: /login.php"); + exit; + } +} diff --git a/intern.gospeladlershof.de/css/signin.css b/intern.gospeladlershof.de/css/signin.css new file mode 100644 index 0000000..995df48 --- /dev/null +++ b/intern.gospeladlershof.de/css/signin.css @@ -0,0 +1,40 @@ +body { + padding-top: 40px; + padding-bottom: 40px; + background-color: #eee; +} + +.form-signin { + max-width: 330px; + padding: 15px; + margin: 0 auto; +} +.form-signin .form-signin-heading, +.form-signin .checkbox { + margin-bottom: 10px; +} +.form-signin .checkbox { + font-weight: normal; +} +.form-signin .form-control { + position: relative; + height: auto; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + padding: 10px; + font-size: 16px; +} +.form-signin .form-control:focus { + z-index: 2; +} +.form-signin input[type="email"] { + margin-bottom: -1px; + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; +} +.form-signin input[type="password"] { + margin-bottom: 10px; + border-top-left-radius: 0; + border-top-right-radius: 0; +} diff --git a/intern.gospeladlershof.de/header.php b/intern.gospeladlershof.de/header.php index 8eac02c..b522958 100644 --- a/intern.gospeladlershof.de/header.php +++ b/intern.gospeladlershof.de/header.php @@ -22,8 +22,18 @@ require_once __DIR__ . '/code/session.php'; <link href="/assets/css/ie10-viewport-bug-workaround.css" rel="stylesheet"> <!-- Custom styles for this template --> +<?php +if ( defined("LOGIN_SITE") && LOGIN_SITE ) { +?> + <link href="/css/signin.css" rel="stylesheet"> +<?php +} else { +?> <link href="/css/navbar.css" rel="stylesheet"> <link href="/css/bootstrap-datepicker.min.css" rel="stylesheet"> +<?php +} +?> <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> <!--[if lt IE 9]><script src="/assets/js/ie8-responsive-file-warning.js"></script><![endif]--> @@ -35,6 +45,9 @@ require_once __DIR__ . '/code/session.php'; <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> +<?php +if ( ! defined("LOGIN_SITE") || ! LOGIN_SITE ) { +?> <body> <div class="container"> @@ -53,11 +66,11 @@ require_once __DIR__ . '/code/session.php'; </div> <div id="navbar" class="navbar-collapse collapse"> <ul class="nav navbar-nav"> - <li class="active"><a href="/">Start</a></li> - <li><a href="/proben.php">Termine</a></li> - <li><a href="/konzert.php">Konzerte</a></li> - <li><a href="/mailman/listinfo/chor/">E-Mail Verteiler</a></li> - <li><a href="/mailman/private/chor/">E-Mail Archiv</a></li> + <li <?php echo $class_index; ?>><a href="/"><span class="glyphicon glyphicon-home"></span> Start</a></li> + <li <?php echo $class_proben; ?>><a href="/proben.php"><span class="glyphicon glyphicon-th-list"></span> Termine</a></li> + <li <?php echo $class_konzert; ?>><a href="/konzert.php"><span class="glyphicon glyphicon-music"></span> Konzert</a></li> + <li><a href="/mailman/listinfo/chor/"><span class="glyphicon glyphicon-envelope"></span> E-Mail Verteiler</a></li> + <li><a href="/mailman/private/chor/"><span class="glyphicon glyphicon-send"></span> E-Mail Archiv</a></li> <!--li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a> <ul class="dropdown-menu"> @@ -69,13 +82,14 @@ require_once __DIR__ . '/code/session.php'; <li><a href="#">Separated link</a></li> <li><a href="#">One more separated link</a></li> </ul> - </li> + </li--> </ul> <ul class="nav navbar-nav navbar-right"> - <li class="active"><a href="./">Default <span class="sr-only">(current)</span></a></li> - <li><a href="../navbar-static-top/">Static top</a></li> - <li><a href="../navbar-fixed-top/">Fixed top</a></li> - </ul--> + <!--li class="active"><a href="./">Default <span class="sr-only">(current)</span></a></li--> + <li><a href="/code/logout.php"><span class="glyphicon glyphicon-off"></span> Abmelden</a></li> + </ul> </div><!--/.nav-collapse --> </div><!--/.container-fluid --> </nav> +<?php +} diff --git a/intern.gospeladlershof.de/index.php b/intern.gospeladlershof.de/index.php index b62ea3b..ded0435 100644 --- a/intern.gospeladlershof.de/index.php +++ b/intern.gospeladlershof.de/index.php @@ -1,5 +1,8 @@ <?php $title="Gospelchor Adlershof"; +$class_index = 'class="active"'; +$class_konzert= ''; +$class_proben= ''; require_once __DIR__ . '/header.php'; ?> @@ -16,8 +19,7 @@ require_once __DIR__ . '/header.php'; require_once __DIR__ . '/code/termine.php'; $konzert = $konzert[0]; - -if ( ! empty($_SESSION) && ! is_null($_SESSION["error"]) ) { +if ( isset($_SESSION["error"]) && ! is_null($_SESSION["error"]) ) { ?> <div class="alert alert-danger" role="alert"> <?php @@ -26,15 +28,23 @@ if ( ! empty($_SESSION) && ! is_null($_SESSION["error"]) ) { ?> </div> <?php -} else if ( ! empty($_SESSION) && ! is_null($_SESSION["success"]) ) { +} else if ( isset($_SESSION["success"]) && ! is_null($_SESSION["success"]) ) { ?> <div class="alert alert-success" role="alert"> <?php echo htmlentities($_SESSION["success"]); - unset($_SESSION["success"]); + + if ( isset($_SESSION["dontdisplaydeploybutton"]) ) { + unset($_SESSION["dontdisplaydeploybutton"]); + } else { ?> <hr> Um die Änderung zu veröffentlichen, klicke auf den Button "Webseite aktualisieren". +<?php + } + + unset($_SESSION["success"]); +?> </div> <?php } else if ( isset($_REQUEST["deploy"]) ) { @@ -128,6 +138,7 @@ if ( ! empty($_SESSION) && ! is_null($_SESSION["error"]) ) { </table> </div> +<p>Mit Klick auf den Button wird die Webseite <a href="//www.gospeladlershof.de/">https://www.gospeladlershof.de</a> aktualisiert.</p> <a href="/code/deploy.php" class="btn btn-success"><span class="glyphicon glyphicon-refresh"></span> Webseite aktualisieren</a> </div> <!-- /container --> diff --git a/intern.gospeladlershof.de/konzert.php b/intern.gospeladlershof.de/konzert.php index fc690c3..c53d957 100644 --- a/intern.gospeladlershof.de/konzert.php +++ b/intern.gospeladlershof.de/konzert.php @@ -1,5 +1,8 @@ <?php $title = "Neues Konzert"; +$class_konzert = 'class="active"'; +$class_index= ''; +$class_proben= ''; require_once __DIR__ . '/header.php'; ?> diff --git a/intern.gospeladlershof.de/login.php b/intern.gospeladlershof.de/login.php new file mode 100644 index 0000000..09d180b --- /dev/null +++ b/intern.gospeladlershof.de/login.php @@ -0,0 +1,48 @@ +<?php +define('LOGIN_SITE', true); +require_once __DIR__ . '/code/session.php'; +$title="Login"; +require_once __DIR__ . '/header.php'; +?> + <body> + + <div class="container"> + + <form class="form-signin" method="POST" action="/code/login.php"> + +<?php +if ( ! empty($_SESSION) ) { + if ( isset($_SESSION["login"]) && $_SESSION["login"]){ + header($_SERVER["SERVER_PROTOCOL"] . " 302 Redirect"); + header("Location: /"); + exit; + } + if ( !is_null($_SESSION["error"]) ) { +?> +<div class="alert alert-danger" role="alert"> +<?php + echo htmlentities($_SESSION["error"]); + unset($_SESSION["error"]); +?> +</div> +<?php + } +} +?> + <h2 class="form-signin-heading">Bitte melde dich an</h2> + <label for="inputEmail" class="sr-only">E-Mail Adresse</label> + <input name="email" type="email" id="inputEmail" class="form-control" placeholder="E-Mail Adresse" required autofocus> + <label for="inputPassword" class="sr-only">Passwort</label> + <input name="password" type="password" id="inputPassword" class="form-control" placeholder="Passwort" required> + <div class="checkbox"> + <label> + <input type="checkbox" value="remember-me"> Bleib angemeldet + </label> + </div> + <button class="btn btn-lg btn-primary btn-block" type="submit">Lass mich rein</button> + </form> + + </div> <!-- /container --> +<?php +require_once __DIR__ . '/footer.php'; +?> diff --git a/intern.gospeladlershof.de/proben.php b/intern.gospeladlershof.de/proben.php index 2b57cc8..13bc10e 100644 --- a/intern.gospeladlershof.de/proben.php +++ b/intern.gospeladlershof.de/proben.php @@ -1,5 +1,9 @@ <?php $title = "Neue Probe"; +$class_proben= 'class="active"'; +$class_index= ''; +$class_konzert= ''; + require_once __DIR__ . '/header.php'; ?> |
