X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fsecurity.inc.php;h=ae9d0086e5f5735c57e51e0807a1cf15ff3df530;hb=e9e97a07a899d7583b0391a16d86fa427104ebcf;hp=47b38dac43bc8b1474111b36a70b26f6046716e2;hpb=8dda254648e0ebf8ba0e6a7b2d58acff730ada2c;p=platal.git diff --git a/include/security.inc.php b/include/security.inc.php index 47b38da..ae9d008 100644 --- a/include/security.inc.php +++ b/include/security.inc.php @@ -1,6 +1,6 @@ numRows()) { + $res = XDB::fetchOneCell('SELECT COUNT(*) + FROM email_watch + WHERE state != \'safe\' AND email = {?}', + $email); + if ($res) { send_warning_mail($message); return true; } @@ -78,7 +79,10 @@ function check_email($email, $message) function check_account() { - return S::user()->watch; + if (S::user()) { + return S::user()->watch; + } + return false; } function check_redirect($red = null) @@ -94,14 +98,14 @@ function check_redirect($red = null) } } -function send_warning_mail($title) +function send_warning_mail($title, $body = '') { global $globals; $mailer = new PlMailer(); $mailer->setFrom("webmaster@" . $globals->mail->domain); $mailer->addTo($globals->core->admin_email); $mailer->setSubject("[Plat/al Security Alert] $title"); - $mailer->setTxtBody("Identifiants de session :\n" . var_export($_SESSION, true) . "\n\n" + $mailer->setTxtBody($body . "Identifiants de session :\n" . var_export($_SESSION, true) . "\n\n" ."Identifiants de connexion :\n" . var_export($_SERVER, true)); $mailer->send(); }