-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.php
142 lines (130 loc) · 8.75 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
<?php
session_start();
include 'assets/checks.php';
include 'assets/config.php';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<!-- META -->
<title><?php echo $title ?></title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/x-icon" href="./assets/img/favicon.ico" />
<!-- CSS -->
<link rel="stylesheet" href="./assets/css/tailwind.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" />
</head>
<body>
<img src="./assets/img/bg.webp" class="bg_img">
<div class="grid h-screen place-items-center">
<div class="flex justify-center">
<div class="rounded-lg shadow-lg bg-white max-w-sm dark:bg-slate-800" style="width:24rem;">
<div class="p-6">
<h5 class="text-gray-900 text-xl font-medium mb-2 dark:text-white">Register an Account.</h5>
<form action="./assets/functions.php" method="post">
<div class="mb-6">
<label for="username" class="block mb-2 text-sm font-medium text-gray-900 dark:text-gray-300">Username</label>
<input type="text" name="username" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="Username" required>
</div>
<div class="mb-6">
<label for="email" class="block mb-2 text-sm font-medium text-gray-900 dark:text-gray-300">Email</label>
<input type="email" name="email" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="Email" required>
</div>
<div class="mb-6">
<label for="password" class="block mb-2 text-sm font-medium text-gray-900 dark:text-gray-300">Password</label>
<input type="password" id="password" name="password" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="Password" required>
</div>
<div class="mb-6">
<label for="cpassword" class="block mb-2 text-sm font-medium text-gray-900 dark:text-gray-300">Confirm Password</label>
<input type="password" id="cpassword" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="Confirm Password" required>
</div>
<button id="regbut" type="submit" class="inline-block px-6 py-2.5 bg-gray-600 text-white font-medium text-xs leading-tight uppercase rounded shadow-md hover:shadow-lg focus:shadow-lg focus:outline-none focus:ring-0 active:shadow-lg transition duration-150 ease-in-out w-full" disabled>Register</button>
</form>
<?php
if (isset($_SESSION['userExist'])) {
echo '<span class="text-red-400">Username already exist! Choose another name!</span>';
unset($_SESSION['userExist']);
} elseif (isset($_SESSION['emailExist'])) {
echo '<span class="text-red-400">Account with this email already exist! Use another email.</span>';
unset($_SESSION['emailExist']);
} elseif (isset($_SESSION['empty'])) {
echo '<span class="text-red-400">All fields are required!</span>';
unset($_SESSION['empty']);
} elseif (isset($_SESSION['success'])) {
echo '<span class="text-green-400">Account Successfully Created</span>';
unset($_SESSION['success']);
}
?>
<div class="mb-6"><br>
<label for="cpassword" class="block mb-2 text-sm font-medium text-gray-900 dark:text-gray-300"><b>REALMLIST: </b><?php
require 'assets/config.php';
echo $realmlist;
?></label>
</div>
<!-- Use text-red-400 if server offline -->
<!-- Use "fa-solid fa-bolt-slash" if server offline-->
<div class="text-center dark:text-white"><i class="fa-solid fa-bolt text-green-400"></i> Server Status <i class="fa-solid fa-bolt text-green-400"></i></div>
<div class="grid grid-cols-4 gap-2 text-center dark:text-gray-400">
<!-- Currently Online Players / If offline, display zero, and make icon red. -->
<div><i class="fa-solid fa-user text-green-400"></i><?php echo totalOnline(); ?></div>
<!-- Display for how many hours the server has been online. / If offline, display zero. -->
<div><i class="fa-solid fa-clock text-cyan-400"></i> <?php echo uptime(); ?></span></div>
<!-- Amount of cheaters/hackers/dupers/whatever banned. -->
<div><i class="fa-solid fa-shield-virus text-red-400"></i> <?php echo totalBan(); ?></div>
<!-- Total Accounts or Characters registered -->
<div><i class="fa-solid fa-users text-orange-400"></i> <?php echo totalAccounts(); ?></div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="./assets/js/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function() {
// timer
function engageTimer() {
var serverStart = 1658479760; //Get server start time from DB
var currentTimeInSeconds = Math.floor(Date.now() / 1000);
var serverUp = Math.abs(currentTimeInSeconds - serverStart);
var upHrs = Math.floor(serverUp / 3600);
var upMin = Math.floor((serverUp % 3600) / 60);
if (upHrs < 10)
$("#uptimeHrs").text("0" + upHrs);
else
$("#uptimeHrs").text(upHrs);
if (upMin < 10)
$("#uptimeMin").text("0" + upMin);
else
$("#uptimeMin").text(upMin);
}
engageTimer();
setInterval(engageTimer, 3000)
// Password confirmation, makes sure the password match!
$("#password, #cpassword").keyup(function() {
if ($("#password").val() == $("#cpassword").val()) {
$("#password").addClass("dark:border-green-600 border-green-600");
$("#cpassword").addClass("dark:border-green-600 border-green-600");
$("#regbut").addClass("dark:bg-green-600 bg-green-600 hover:bg-green-700 focus:bg-green-700 active:bg-green-700");
if ($("#password").hasClass("border-red-600")) {
$('#regbut').removeAttr("disabled");
$("#password").removeClass("dark:border-red-600 border-red-600");
$("#cpassword").removeClass("dark:border-red-600 border-red-600");
}
} else {
$("#password").addClass("dark:border-red-600 border-red-600");
$("#cpassword").addClass("dark:border-red-600 border-red-600");
if ($("#password").hasClass("border-green-600")) {
$("#regbut").removeClass("dark:bg-green-600 bg-green-600 hover:bg-green-700 focus:bg-green-700 active:bg-green-700");
$("#regbut").attr("disabled", true);
$("#password").removeClass("dark:border-green-600 border-green-600");
$("#cpassword").removeClass("dark:border-green-600 border-green-600");
}
}
});
});
</script>
</body>
</html>