forked from martinius96/Webwars
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
182 lines (150 loc) · 7.09 KB
/
index.php
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<!--Autor: Martin Chlebovec alias: martinius96-->
<!--Support: https://www.paypal.me/Chlebovec-->
<!--Web: https://arduino.php5.sk-->
<!--Email: [email protected]>
<!--FB: 100001242570317-->
<!--LICENSE!-->
<!DOCTYPE html>
<?php
include("./global/functions.php");
session_start();
error_reporting(0);
include("common.php");?>
<html lang="sk">
<head>
<meta name=description content="<?php echo $lang['META_DESCRIPTION']; ?>">
<meta name=keywords content="<?php echo $lang['META_KEYWORDS']; ?>">
<meta name="robots" content="index,follow" />
<meta name="google-site-verification" content="99geZzMQuCEbWS3wtRt2Ih_ZkECtd4vqbYD2U0K-oOU" />
<meta name="revisit-after" content="2 days">
<meta name="googlebot" content="noodp">
<meta name="rating" content="general">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Start Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-76290977-1', 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->
<title><?php echo $lang['PAGE_TITLE']; ?></title>
<!-- Google Fonts -->
<link href='https://fonts.googleapis.com/css?family=Roboto+Slab:400,100,300,700|Lato:400,100,300,700,900' rel='stylesheet' type='text/css'>
<!-- End Google Fonts -->
<!-- Custom Stylesheet -->
<link rel="stylesheet" href="./css/animate.css">
<link rel="stylesheet" href="./css/style_index.css">
<!-- End Custom Stylesheet -->
<style>
body {margin: 0;}
ul.topnav {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
ul.topnav li {float: left;}
ul.topnav li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
ul.topnav li a:hover:not(.active) {background-color: #111;}
ul.topnav li a.active {background-color: #4CAF50;}
ul.topnav li.right {float: right;}
@media screen and (max-width: 600px){
ul.topnav li.right,
ul.topnav li {float: none;}
}
</style>
</head>
<body>
<div>
<ul class="topnav">
<li><a class="active" href="index.php"><?php echo $lang['MENU_LOGIN']; ?></a></li>
<li><a href="register"><?php echo $lang['MENU_REGISTER']; ?></a></li>
<li><a href="blog"><?php echo $lang['MENU_BLOG']; ?></a></li>
<li><a href="contact"><?php echo $lang['MENU_CONTACT']; ?></a></li>
<li class="right"><a href="status"><?php echo $lang['MENU_SERVER_STATUS'];?></a></li>
</ul>
</div>
<?php
if(isset($_SESSION['uid'])){ ?>
<center>
<h2> <?php echo $lang['SIGNED_IN_YET'];?> </h2>
<br>
<a href='game/main.php'>
<button type="button" class="xmiddle green button round"><?php echo $lang['BACK_TO_GAME'];?></button>
</a>
<a href='game/logout.php'>
<button type="button" class="xmiddle red button round"><?php echo $lang['LOGOUT'];?></button>
</a> <br>
<a href="?lang=sk"><img src="images/lang/slovakia.png" alt="Slovakia flag.png, 5,5kB" title="Slovakia" height="48" width="48"></a>
<a href="?lang=en"><img src="images/lang/britain.png" alt="britain.png, 2,2kB" title="Britain" height="48" width="48"></a>
<a href="?lang=de"><img src="images/lang/germany.png" alt="germany.png, 3,5kB" title="Germany" height="48" width="48"></a>
<a href="?lang=ru"><img src="images/lang/russia.png" alt="russia.png, 4,6kB" title="Russia" height="48" width="48"></a>
<a href="?lang=cz"><img src="images/lang/czech.png" alt="czech.png, 2,0kB" title="Czech" height="48" width="48"></a>
<a href="?lang=it"><img src="images/lang/italy.png" alt="italy.png, 739B" title="Italy" height="48" width="48"></a>
</center>
<?php } else {
if(isset($_POST['odoslat'])){
$username = mysqli_real_escape_string($con, $_POST['username']);
$username = trim( $username );
$username = htmlspecialchars( $username, ENT_QUOTES );
$password = mysqli_real_escape_string($con, $_POST['password']);
$password = trim( $password );
$password = htmlspecialchars( $password, ENT_QUOTES );
$login_check = mysqli_query($con,"SELECT `id` FROM `user` WHERE `username`='$username' AND `password`='".sha1($front_salt.$password.$back_salt)."'") or die (mysqli_error($con));
if(mysqli_num_rows($login_check) == 0){
echo $lang['ECHO_BAD_COMBINATION'];
}else{
$activated_check = mysqli_query($con,"SELECT `activated` FROM `user` WHERE `username`='$username' AND `password`='".sha1($front_salt.$password.$back_salt)."'") or die (mysqli_error($con));
$activated = mysqli_fetch_assoc($activated_check);
if($activated['activated'] == 0){
echo $lang['ECHO_NOT_ACTIVATED'];
}else{
$get_id = mysqli_fetch_assoc($login_check);
$_SESSION['uid'] = $get_id['id'];
header("Location: game/main.php");
$t = file_get_contents("prihlasenia.txt");
$today = date("Y-m-d H:i:s");
$t .= $today." Používateľ ".$username." "."sa prihlásil!"."\r\n";
file_put_contents("prihlasenia.txt",$t);
}
}
}
?>
<div class="container">
<div class="top">
</div>
<div class="login-box animated fadeInUp">
<div class="box-header">
<h2><?php echo $lang['SIGN_IN_H2'];?></h2>
</div>
<a href="?lang=sk"><img src="images/lang/slovakia.png" alt="Slovakia flag.png, 5,5kB" title="Slovakia" height="48" width="48"></a>
<a href="?lang=en"><img src="images/lang/britain.png" alt="britain.png, 2,2kB" title="Britain" height="48" width="48"></a>
<a href="?lang=de"><img src="images/lang/germany.png" alt="germany.png, 3,5kB" title="Germany" height="48" width="48"></a>
<a href="?lang=ru"><img src="images/lang/russia.png" alt="russia.png, 4,6kB" title="Russia" height="48" width="48"></a>
<a href="?lang=cz"><img src="images/lang/czech.png" alt="czech.png, 2,0kB" title="Czech" height="48" width="48"></a>
<a href="?lang=it"><img src="images/lang/italy.png" alt="italy.png, 739B" title="Italy" height="48" width="48"></a>
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method="post">
<br>
<input type="text" name="username" alt="username" placeholder=<?php echo $lang['PLACEHOLDER_USERNAME'];?> style=width:300px /> <br>
<input type="password" name="password" alt="password" placeholder=<?php echo $lang['PLACEHOLDER_PASSWORD'];?> style=width:300px />
<br>
<br>
<button type="submit" name="odoslat"><?php echo $lang['SIGN_IN_BUTTON'];?></button>
<br> <hr>
<?php echo $lang['HAVENT_ACCOUNT'];?> <a href="register"><button type="button"><?php echo $lang['REGISTER_SIGN_UP'];?></button></a>
</form>
</div>
</div>
</body>
<?php } ?>
</html>