Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.86 KB | None | 0 0
  1. <?php
  2. if(isset($_GET['lang'])){
  3. $_COOKIE['LANG_addorre'] = $_GET['lang'];
  4. $_COOKIE['LANG_'] = $_GET['lang'];
  5. setcookie('LANG_' . 'addorre', $_GET['lang']);
  6. }
  7. define("_VALID_PHP", true);
  8. require_once("../autoload.php");
  9.  
  10. $getip = $_SERVER['REMOTE_ADDR'];
  11. $beforeTime = date("Y-m-d h:i:s",strtotime("-15 minutes"));
  12. $checkip = $db->getValue("count(id)", TABLE_ADMIN_LOGINS, "date > date_sub(now(), interval 3 minute) AND ip='$getip'");
  13. if($checkip >= '5') {
  14.  
  15. $databan['banned'] = '1';
  16. $db->update(TABLE_ADMIN_LOGINS, $databan, "ip='$getip' ORDER BY id DESC LIMIT 1");
  17. echo 'Your IP address is BANNED!';
  18. exit();
  19. }
  20.  
  21. $sites = $api->request('get_sites');
  22.  
  23. if ($user->logged_in) {
  24. if ($user->is_Admin() && isset($_SESSION['site_id'])) {
  25. redirect_to("index.php");
  26. } else {
  27. redirect_to(SITEURL);
  28. exit;
  29. }
  30. }
  31.  
  32. $login_msg = array();
  33. if(post('login')) {
  34. $result = $api->request('login', array('email' => post('email'), 'password' => post('password')), 'json');
  35. $result = json_decode($result);
  36. $data['username'] = post('email');
  37. //Login successful
  38. if ($result->status == 1) {
  39. unset($_SESSION['site_id']);
  40. if(!isset($_SESSION['site_id'])) {
  41. $_SESSION['site_id'] = post('site_id');
  42. }
  43.  
  44. $data['ip'] = $_SERVER['REMOTE_ADDR'];
  45. $data['date'] = date("Y-m-d H:i:s");
  46. $data['browser'] = $_SERVER['HTTP_USER_AGENT'];
  47. $data['site_id'] = post('site_id');
  48. $data['success'] = '1';
  49.  
  50. $db->insert(TABLE_ADMIN_LOGINS, $data);
  51. redirect_to("index.php");
  52. } elseif($result->status == 2) {
  53. redirect_to("2factor.php");
  54. } else {
  55. if(isset($result->error_fields)){
  56. foreach($result->error_fields as $key => $error_field){
  57. $login_msg[$key] = $error_field;
  58. }
  59. $data['ip'] = $_SERVER['REMOTE_ADDR'];
  60. $data['date'] = date("Y-m-d H:i:s");
  61. $data['browser'] = $_SERVER['HTTP_USER_AGENT'];
  62. $data['site_id'] = post('site_id');
  63. $data['success'] = '0';
  64.  
  65. $db->insert(TABLE_ADMIN_LOGINS, $data);
  66. } elseif(isset($result->msg)) {
  67. $login_msg[] = $result->msg;
  68. }
  69. }
  70. }
  71. $getip = $_SERVER['REMOTE_ADDR'];
  72. $beforeTime = date("Y-m-d h:i:s",strtotime("-15 minutes"));
  73. $checkip = $db->getValue("count(id)", TABLE_ADMIN_LOGINS, "date > date_sub(now(), interval 3 minute) AND ip='$getip' ORDER BY id DESC");
  74. if($checkip >= '5') {
  75. echo 'You are banned for 5 minutes!';
  76. exit();
  77. }
  78.  
  79. ?>
  80. <!DOCTYPE html>
  81. <!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
  82. <!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
  83. <!--[if !IE]><!-->
  84. <html lang="en">
  85. <!--<![endif]-->
  86. <!-- BEGIN HEAD -->
  87.  
  88. <head>
  89. <meta charset="utf-8" />
  90. <title><?php echo _LOGIN;?></title>
  91. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  92. <meta content="width=device-width, initial-scale=1" name="viewport" />
  93. <meta content="Expozy CMS" name="description" />
  94. <meta content="" name="author" />
  95.  
  96. <script type="text/javascript">
  97. var SITEURL = "<?php echo SITEURL;?>";
  98. var ADMINURL = "<?php echo ADMINURL;?>";
  99. </script>
  100.  
  101. <!-- BEGIN GLOBAL MANDATORY STYLES -->
  102. <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&subset=all" rel="stylesheet" type="text/css" />
  103. <link href="<?php echo ADMINURL;?>/assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
  104. <link href="<?php echo ADMINURL;?>/assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css" />
  105. <link href="<?php echo ADMINURL;?>/assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
  106. <link href="<?php echo ADMINURL;?>/assets/global/plugins/bootstrap-switch/css/bootstrap-switch.min.css" rel="stylesheet" type="text/css" />
  107. <!-- END GLOBAL MANDATORY STYLES -->
  108. <!-- BEGIN PAGE LEVEL PLUGINS -->
  109. <link href="<?php echo ADMINURL;?>/assets/global/plugins/select2/css/select2.min.css" rel="stylesheet" type="text/css" />
  110. <link href="<?php echo ADMINURL;?>/assets/global/plugins/select2/css/select2-bootstrap.min.css" rel="stylesheet" type="text/css" />
  111. <!-- END PAGE LEVEL PLUGINS -->
  112. <!-- BEGIN THEME GLOBAL STYLES -->
  113. <link href="<?php echo ADMINURL;?>/assets/global/css/components-md.min.css" rel="stylesheet" id="style_components" type="text/css" />
  114. <link href="<?php echo ADMINURL;?>/assets/global/css/plugins-md.min.css" rel="stylesheet" type="text/css" />
  115. <!-- END THEME GLOBAL STYLES -->
  116. <!-- BEGIN PAGE LEVEL STYLES -->
  117. <link href="<?php echo ADMINURL;?>/assets/pages/css/login.min.css" rel="stylesheet" type="text/css" />
  118. <!-- END PAGE LEVEL STYLES -->
  119. <!-- BEGIN THEME LAYOUT STYLES -->
  120. <!-- END THEME LAYOUT STYLES -->
  121. <link rel="shortcut icon" href="favicon.ico" /> </head>
  122. <!-- END HEAD -->
  123.  
  124. <body class=" login">
  125. <!-- BEGIN LOGO -->
  126. <div class="logo">
  127. <a href="index.php">
  128. <img src="/admin/assets/global/img/logo-admin.png" />
  129. </a>
  130. </div>
  131. <!-- END LOGO -->
  132. <!-- BEGIN LOGIN -->
  133. <div class="content">
  134. <!-- BEGIN LOGIN FORM -->
  135. <form id="login-form" class="login-form" action="" method="post">
  136. <input type="hidden" name="login" value="1">
  137.  
  138. <h3 class="form-title font-green"><?php echo _LOGIN;?></h3>
  139.  
  140. <?php if(!$sites) { ?>
  141. <div class="alert alert-danger text-center">
  142. <span><?php echo _ERROR_NO_SITES;?></span>
  143. </div>
  144. <?php } else {
  145. ?>
  146.  
  147. <?php
  148. if($login_msg){
  149. foreach($login_msg as $login_error) {
  150. ?>
  151. <div class="alert alert-danger">
  152. <button class="close" data-close="alert"></button>
  153. <span> <?php echo $login_error;?> </span>
  154. </div>
  155. <?php
  156. }
  157. }
  158. ?>
  159.  
  160. <div class="alert alert-danger display-hide">
  161. <button class="close" data-close="alert"></button>
  162. <span> <?php echo _EMPTY_FIELD;?> </span>
  163. </div>
  164.  
  165. <div class="form-group">
  166. <select class="form-control form-control-solid selectpicker" name="site_id">
  167. <option selected disabled><?php echo _LOGIN_SELECT_SITE;?></option>
  168. <?php foreach($sites as $site) { ?>
  169. <option value="<?php echo $site['site_id'];?>" <?php echo get_selected($site['site_id'], $core->site_id);?>><?php echo $site['site_name'];?></option>
  170. <?php } unset($site); ?>
  171. </select>
  172. </div>
  173. <div class="form-group">
  174. <!--ie8, ie9 does not support html5 placeholder, so we just show field title for that-->
  175. <label class="control-label visible-ie8 visible-ie9"><?php echo _USER_EMAIL;?></label>
  176. <input class="form-control form-control-solid placeholder-no-fix" type="text" autocomplete="off" placeholder="<?php echo _USER_EMAIL;?>" name="email" />
  177. </div>
  178. <div class="form-group">
  179. <label class="control-label visible-ie8 visible-ie9"><?php echo _PASSWORD;?></label>
  180. <input class="form-control form-control-solid placeholder-no-fix" type="password" autocomplete="off" placeholder="<?php echo _PASSWORD;?>" name="password" />
  181. </div>
  182. <div class="form-actions text-center">
  183. <a href="javascript:;" class="btn green uppercase" onclick="document.getElementById('login-form').submit();"><?php echo _LOGIN;?></a>
  184. <div class="row">
  185. <div class="col-md-12 text-center">
  186. <br />
  187. <a href="/admin/lost-password.php"><?php echo _LOST_PASSWORD; ?></a>
  188. </div>
  189. </div>
  190. </div>
  191.  
  192.  
  193. <?php } ?>
  194.  
  195.  
  196. <div class="row">
  197. <!-- languages -->
  198. <?php $langs = $db->getResults("*", "languages", "id != 0 ORDER BY id asc");
  199.  
  200. if(count($langs) < 3){
  201. foreach($langs as $l):?>
  202. <div class="col-md-4 text-center">
  203. <a href="?lang=<? echo $l['code'];?>"><? echo $l['title'];?></a>
  204. </div>
  205. <?endforeach;?>
  206. <? }else{
  207. for($i = 0; $i < 2; $i++):?>
  208. <div class="col-md-3 text-center">
  209. <a href="?lang=<? echo $l['code'];?>"><? echo $l['title'];?></a>
  210. </div>
  211. <? endfor;?>
  212. <div class="col-md-3 text-center">
  213. <a href="javascript;:">...</a>
  214. </div>
  215. <?} ?>
  216.  
  217.  
  218.  
  219. </div>
  220. </form>
  221. <!-- END LOGIN FORM -->
  222. </div>
  223. <div class="copyright"> <?php echo date("Y"); ?> © Expozy </div>
  224. <!--[if lt IE 9]>
  225. <script src="../assets/global/plugins/respond.min.js"></script>
  226. <script src="../assets/global/plugins/excanvas.min.js"></script>
  227. <script src="../assets/global/plugins/ie8.fix.min.js"></script>
  228. <![endif]-->
  229. <!-- BEGIN CORE PLUGINS -->
  230. <script src="<?php echo ADMINURL;?>/assets/global/plugins/jquery.min.js" type="text/javascript"></script>
  231. <script src="<?php echo ADMINURL;?>/assets/global/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
  232. <script src="<?php echo ADMINURL;?>/assets/global/plugins/js.cookie.min.js" type="text/javascript"></script>
  233. <script src="<?php echo ADMINURL;?>/assets/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
  234. <script src="<?php echo ADMINURL;?>/assets/global/plugins/jquery.blockui.min.js" type="text/javascript"></script>
  235. <script src="<?php echo ADMINURL;?>/assets/global/plugins/bootstrap-switch/js/bootstrap-switch.min.js" type="text/javascript"></script>
  236. <!-- END CORE PLUGINS -->
  237. <!-- BEGIN PAGE LEVEL PLUGINS -->
  238. <script src="<?php echo ADMINURL;?>/assets/global/plugins/jquery-validation/js/jquery.validate.min.js" type="text/javascript"></script>
  239. <script src="<?php echo ADMINURL;?>/assets/global/plugins/jquery-validation/js/additional-methods.min.js" type="text/javascript"></script>
  240. <script src="<?php echo ADMINURL;?>/assets/global/plugins/select2/js/select2.full.min.js" type="text/javascript"></script>
  241. <!-- END PAGE LEVEL PLUGINS -->
  242. <!-- BEGIN THEME GLOBAL SCRIPTS -->
  243. <script src="<?php echo ADMINURL;?>/assets/global/scripts/app.min.js" type="text/javascript"></script>
  244. <!-- END THEME GLOBAL SCRIPTS -->
  245. <!-- BEGIN PAGE LEVEL SCRIPTS -->
  246. <script src="<?php echo ADMINURL;?>/assets/pages/scripts/login.min.js" type="text/javascript"></script>
  247. <!-- END PAGE LEVEL SCRIPTS -->
  248. <script>
  249. document.getElementById('login-form').addEventListener('keypress', function(event) {
  250. if (event.keyCode == 13) {
  251. event.preventDefault();
  252. }
  253. });
  254. </script>
  255. </body>
  256.  
  257. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement