aboutsummaryrefslogtreecommitdiff
path: root/www/failure.php
blob: 7461a282a41ec81023b49ab222bfdebc947efd03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?php
session_start();

$scheme="http://";

if(isset($_SERVER["HTTPS"])){
        if($_SERVER["HTTPS"] == "on"){
                $scheme="https://";
        }   
}

include("functions/func_login.php");
$db = new SQLite3("../database/sqlite.db");
if($_GET["e"] != "401" && check_if_banned($db)){
        banned();
}	
//include("include.php");
if(!empty($_GET)){
	switch($_GET["e"]){
		case("401"):
			$message = "You are banned!";
			break;

		case("403"):
			$message = "I could do that... but access forbidden";
			break;

		case("404"):
			$message = "404 - File Not Found";
			break;
		
		case("500"):
			$message = "Server fault.";
			break;

		case("502"):
			$message = "Bad Gateway";
			break;

		case("504"):
			$message = "Someone other is too slow. I can't wait forever.";
			break;

		default:
			$message = "200 / Everything is okay.";
			break;
	}
} else {
	header("Refresh: 0; https://".$_SERVER["HTTP_HOST"]."/");
	exit;
	$message = "200 / Everything is okay.";
	$_GET["e"] = 200;
}

?><!doctype html>
<html>
<head>
	<title><?php if($_GET["e"] != "401"){ echo "Failure ".$_GET["e"]; } else { echo "You are banned! "; } ?> :: Junge Gemeinde Adlershof</title>
	<meta http-equiv='Content-type' content='text/html; charset=utf-8' />
	<link rel='stylesheet' type='text/css' href='/static/hyperstyle.css' />
	<link rel='shortcut icon' href='/favicon.ico' type='image/x-icon'>
</head>

<?php

if($_SESSION["login"]){
	include("static/head.php");

	echo "
<br><br>
<div id='content_container' align='center'>
	<div class='kleineschrift'><div class='ueberschrift'><b><p style='text-decoration:underline;'>". $message ."</p></b></div></div>
	";

	echo "
<br><br>
	<p style='font-size:14px'>Upps, it seems to be something went wrong, sorry.</p>
	<p style='font-size:14px'>Have a random quote to bridge the time. Try to reload the site or check for typos in the URL.</p>
	";

	$rows = $db->query("SELECT count(*) as count FROM sprueche;");
	$row = $rows->fetchArray();
	$numRows = $row["count"];

	$zufall  = mt_rand(1,$numRows);
	$ergebnis = $db->query("SELECT * FROM sprueche where id=$zufall;");

	echo "
        <br>
        <div id='container' align='center'>
	<br><br><br>
	<b>Zitat Nummer #<?php echo $zufall; ?></b><br><br><div id='bgcolor'>
	";

	while($row=$ergebnis->fetchArray()){
		echo $row["spruch"];
	}

	echo "</div>
	</div>
	";
} else {
	echo "
		<body link='#000000' vlink='#000000' alink='#FF0000'>	
	";
	echo "
<br><br>
<div id='content_container' align='center'>
	<div class='kleineschrift'><div class='ueberschrift'><b><p style='text-decoration:underline;'>". $message ."</p></b></div></div>
	";

	if($_GET["e"] != "401"){
		echo "
		<br><br>
		<p style='font-size:14px'>Upps, it seems to be something went wrong, sorry.</p>
		<p style='font-size:14px'>Have a random quote to bridge the time. Try to reload the site or check for typos in the URL.</p>
		<br>
		<font style='font-size:14px'>Zurück zur <a href='/login'><u>Startseite</u></a> oder <a href='/password_recover'><u>Passwort vergessen?</u></a></font>
		";

		$rows = $db->query("SELECT count(*) as count FROM sprueche;");
		$row = $rows->fetchArray();
		$numRows = $row["count"];

		$zufall  = mt_rand(1,$numRows);
		$ergebnis = $db->query("SELECT * FROM sprueche where id=$zufall;");

		echo "
	        <br>
        	<div id='container' align='center'>
		<br><br><br>
		<b>Zitat Nummer #". $zufall ."</b><br><br><div id='bgcolor'>
		";

		while($row=$ergebnis->fetchArray()){
			echo $row["spruch"];
		}

		echo "</div>
		</div>
		";
		}
}