Skip to content
This repository has been archived by the owner on Jun 4, 2018. It is now read-only.

Commit

Permalink
Added cron job execution, Fixed unload on recaptcha interact
Browse files Browse the repository at this point in the history
Signed-off-by: Scrumplex <[email protected]>
  • Loading branch information
Scrumplex committed Mar 4, 2017
1 parent 5a3adc3 commit 9d5ea9a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
3 changes: 2 additions & 1 deletion assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@
$(window).focus(function () {
$(".content").fadeIn(300);
}).blur(function () {
$(".content").fadeOut(300);
if (!$('iframe').is(':focus'))
$(".content").fadeOut(300);
});

$(document).on("keydown", function (e) {
Expand Down
24 changes: 13 additions & 11 deletions include/cron.inc.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
<?php
require_once __DIR__ . "/mysql.inc.php";

$conn = getMYSQL();
function runJob() {
$conn = getMYSQL();

//Clear ip log
$now = time();
$twoWeeksAgo = $now - (60 * 60 * 24 * 14); // 60s * 60min * 24h * 14d
//Clear ip log
$now = time();
$twoWeeksAgo = $now - (60 * 60 * 24 * 14); // 60s * 60min * 24h * 14d

$ps = $conn->prepare("DELETE FROM `iplog` WHERE `DATE` < (?)");
$ps->bind_param("i", $twoWeeksAgo);
$ps->execute();
$ps = $conn->prepare("DELETE FROM `iplog` WHERE `DATE` < (?)");
$ps->bind_param("i", $twoWeeksAgo);
$ps->execute();

//Clear archived passwords
$ps = $conn->prepare("DELETE FROM `passwords` WHERE `ARCHIVED` = 1 AND `ARCHIVED_DATE` < (?)");
$ps->bind_param("i", $twoWeeksAgo);
$ps->execute();
//Clear archived passwords
$ps = $conn->prepare("DELETE FROM `passwords` WHERE `ARCHIVED` = 1 AND `ARCHIVED_DATE` < (?)");
$ps->bind_param("i", $twoWeeksAgo);
$ps->execute();
}
2 changes: 2 additions & 0 deletions include/user.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
require_once __DIR__ . "/format.inc.php";
require_once __DIR__ . "/geoip.inc.php";
require_once __DIR__ . "/passwords.inc.php";
require_once __DIR__ . "/cron.inc.php";

if (isset($_SESSION["last_activity"]) && (time() - $_SESSION["last_activity"]) >= 300)
logoutUser();
Expand Down Expand Up @@ -51,6 +52,7 @@ function loginUser($email, $password)
$succeeded = $ps->execute();
$ps->close();
if ($succeeded) {
runJob();
return getSuccess(array(), "login_user");
} else {
logoutUser();
Expand Down

0 comments on commit 9d5ea9a

Please sign in to comment.