X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fxorg.misc.inc.php;h=37525b8050fe696a260505ec9ee3663c373a6be8;hb=b6cdf7b450a26a7fb5027d23569b15def0abd812;hp=7f2674871a317a50fb97961194309549e8f6bdfe;hpb=5ddeb07cc787dd1dc3630a31f1528f5cc7c4d9b9;p=platal.git diff --git a/include/xorg.misc.inc.php b/include/xorg.misc.inc.php index 7f26748..37525b8 100644 --- a/include/xorg.misc.inc.php +++ b/include/xorg.misc.inc.php @@ -110,4 +110,32 @@ function make_forlife($prenom,$nom,$promo) { $forlife = str_replace("'","",$forlife); return $forlife; } + +function check_ip($level) +{ + $test = array(); + switch ($level) { + case 'unsafe': $test[] = "state = 'unsafe'"; + case 'dangerous': $test[] = "state = 'dangerous'"; + case 'ban': $test[] = "state = 'ban'"; break; + default: return false; + } + $res = XDB::query("SELECT state + FROM ip_watch + WHERE ip = {?} AND (" . implode(' OR ', $test) . ')', + $_SERVER['REMOTE_ADDR']); + return $res->numRows(); +} + +function send_warning_mail($title) +{ + $mailer = new PlMailer(); + $mailer->setFrom("webmaster@polytechnique.org"); + $mailer->addTo("hotliners@staff.polytechnique.org"); + $mailer->setSubject($title); + $mailer->setTxtBody("Identifiants de session :\n" . var_export($_SESSION, true) . "\n\n" + ."Identifiants de connexion :\n" . var_export($_SERVER, true)); + $mailer->send(); +} + ?>