-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
178 lines (165 loc) · 6.68 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
<?php
error_reporting(0);
include('./core/functions.php');
session_start();
if(@$_GET["p"] != ""){
$code = secure_input(@$_GET["p"]);
$url = gld('url',$code);
if(!empty($url)){
if(!isset($_SESSION['viewed'])){
ulv($code);
$_SESSION['viewed'] = 'isViewedz';
$_SESSION['viewIP'] = $_SERVER['REMOTE_ADDR'];
}
header("Location: $url");
exit;
}else{
header("HTTP/1.1 403 Forbidden");
}
}
default_start();
$isUserLogged = False;
if(isset($_SESSION['logged']) == True){
$user_agent = $_SESSION['user_agent'];
$user_ip = $_SESSION['user_ip'];
$status = session_check($user_agent,$user_ip);
if(($_SESSION['session_count']-=1) <= 0){
session_regenerate_id();
$_SESSION['session_count'] = 5;
}
if($status){
$isUserLogged = True;
}
if(isset($_GET['logout']) == true){
session_destroy();
header('location: '.$_SERVER['PHP_SELF']);
}
}
if($isUserLogged){
header('Location: ./dashboard.php');
}
$_SESSION['incorrect_login'] = False;
if(isset($_POST['login'])){
$user = secure_input($_POST['username']);
$pass = secure_input($_POST['password']);
$status = login($user, $pass);
if($status){
header('Location: ./dashboard.php');
}else{
$_SESSION['incorrect_login'] = True;
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="uft-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:title" content="Simple Managable Url Shortener">
<meta property="og:description" content="Simple Managable Url Shortener with PHP">
<meta property="og:type" content="">
<meta property="og:url" content="">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" crossorigin="anonymous">
<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-OERcA2EqjJCMA+/3y+gxIOqMEjwtxJY7qPCqsdltbNJuaOe923+mo//f6V8Qbsw3" crossorigin="anonymous"></script>
<title>SMUS - Simple Managable Url Shortener</title>
</head>
<body>
<div class="d-flex justify-content-center align-items-center login-wrap" id="login-f">
<form method="post">
<h2 class="text-center fw-bold title">SMUS - LOGIN</h2><hr>
<div class="login-inp-box">
<input type="text" name="username" placeholder="Username" autocomplete="off" autofocus required>
</div>
<div class="login-inp-box d-flex justify-content-center align-items-center">
<input type="password" name="password" placeholder="Password" id="password" required>
<a style="cursor:pointer; user-select:none;" onclick="vis();" id="eye" class="material-symbols-outlined">visibility</a>
</div>
<input class="btn btn-primary mt-2" type="submit" name="login" value="Login" style="width:100%; ">
</form>
</div>
</body>
<style>
body{
height: 100vh;
background: linear-gradient(126deg, rgba(207,206,215,1) 0%, rgba(114,188,203,1) 100%);
background-attachment: fixed;
}
.title{
background: linear-gradient(
to right,
rgb(17, 118, 207,0.2) 20%,
rgb(17, 118, 207,0.3) 30%,
rgb(17, 118, 207,0.7) 70%,
rgb(17, 118, 207) 80%
);
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
text-fill-color: transparent;
background-size: 500% auto;
animation: title 1s ease-in-out infinite alternate;
}
@keyframes title {
0% {
background-position: 0% 50%;
}
100% {
background-position: 100% 50%;
}
}
.login-wrap{
z-index: 1;
position: absolute;
width: 100%;
height: 100%;
}
form{
background-color: rgb(255,255,255,0.1);
box-shadow: 0px 4px 2px 2px rgb(0,0,0,0.1);
padding:50px;
border-radius: 10px;
/*border-bottom: 4px solid rgb(0, 0, 0,0.5);*/
/*box-shadow: 5px 5px 5px 1px grey;*/
}
.login-inp-box{
border:1px solid rgb(0, 0, 0,0.8);
/*background-color:rgb(0,0,0,0.3);*/
}
.login-inp-box input{
height: 100%;
width:80%;
border:none;
color:black;
font-weight:bold;
outline:none;
background-color: transparent;
padding:10px;
}
.material-symbols-outlined {
color:black;
display: inline-flex;
margin:0;
text-align: center;
align-items: center;
justify-content: center;
text-decoration: none;
width:5vh;
height: 0vh;
font-variation-settings:
'FILL' 0,
'wght' 400,
'GRAD' 0,
'opsz' 48
}
.material-symbols-outlined:hover{
color:darkcyan;
}
</style>
<script>
// For password visibility function, idk why I obfuscated it. ill refactor this sooner or later.
function _0x41ee(_0x2c9ee3,_0x316f22){var _0x186731=_0x1867();return _0x41ee=function(_0x41ee95,_0x416ab4){_0x41ee95=_0x41ee95-0x180;var _0x3d0c2e=_0x186731[_0x41ee95];return _0x3d0c2e;},_0x41ee(_0x2c9ee3,_0x316f22);}function _0x1867(){var _0xb4cee4=['1318074vXNBUK','919999ErXmeY','getElementById','visibility','type','587521inRMnU','445242cIALby','6444KsOJvS','92brsVcc','2hWgGvf','text','17130rpmoZH','innerHTML','363769LgUHKR','password','16HJSiRE','240LaeYXq','eye','165890EhfIwA'];_0x1867=function(){return _0xb4cee4;};return _0x1867();}(function(_0xc7d739,_0x25e522){var _0x163a87=_0x41ee,_0x28c548=_0xc7d739();while(!![]){try{var _0x4ff8e8=parseInt(_0x163a87(0x184))/0x1+parseInt(_0x163a87(0x18c))/0x2*(parseInt(_0x163a87(0x183))/0x3)+-parseInt(_0x163a87(0x18b))/0x4*(parseInt(_0x163a87(0x182))/0x5)+parseInt(_0x163a87(0x189))/0x6+-parseInt(_0x163a87(0x190))/0x7*(-parseInt(_0x163a87(0x192))/0x8)+parseInt(_0x163a87(0x18a))/0x9*(-parseInt(_0x163a87(0x18e))/0xa)+parseInt(_0x163a87(0x188))/0xb*(parseInt(_0x163a87(0x180))/0xc);if(_0x4ff8e8===_0x25e522)break;else _0x28c548['push'](_0x28c548['shift']());}catch(_0x23f21e){_0x28c548['push'](_0x28c548['shift']());}}}(_0x1867,0x966b4));function vis(){var _0x4b0f54=_0x41ee,_0x254e27=document[_0x4b0f54(0x185)](_0x4b0f54(0x181)),_0x326003=document[_0x4b0f54(0x185)](_0x4b0f54(0x191));_0x326003['type']==_0x4b0f54(0x191)?(_0x254e27['innerHTML']='visibility_off',_0x326003[_0x4b0f54(0x187)]=_0x4b0f54(0x18d)):(_0x254e27[_0x4b0f54(0x18f)]=_0x4b0f54(0x186),_0x326003[_0x4b0f54(0x187)]=_0x4b0f54(0x191));}
<?php if($_SESSION['incorrect_login']){echo "Swal.fire('Incorrect username or password!','','error');";}?>
</script>
</html>