diff --git a/.gitignore b/.gitignore index 719f2d8..e13ab03 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ conf.php test* var/database* var/.htaccess +devToProd.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 7151262..6be31c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,16 @@ -## 1.1 (future) +## 2 (future) - support postfix-mysql (not plain text virtual file) - - admin panel page with statistic - - limit nb alias / email - javascript checkupgrade in admin page - - add second table in database (for domain/checkupdate/intervale cron) - - send email for advertisement action ? + +## 1.4 (2018-03-19) + + - Interface admin avec stats, top user, possibilité de nettoyer, blacklister... + +## 1.2 (2018-03-19) + + - Ne pas permettre la création d'un alias depuis un alias + - Limiter le nombre d'alias possible ## 1.0.1 (2014-01-06) diff --git a/conf-dist.php b/conf-dist.php index 8bf7807..9ecf496 100644 --- a/conf-dist.php +++ b/conf-dist.php @@ -87,4 +87,13 @@ define('MAINTENANCE_MODE', false); // No maintenance for this ip (admin ip) define('MAINTENANCE_IP', '10.0.0.1'); + +// Usage de password-hash https://php.net/manual/fr/function.password-hash.php +// Vous pouvez crtyper le mot de passe en ligne avec les outils : +// http://www.passwordtool.hu/php5-password-hash-generator +// https://php-password-hash-online-tool.herokuapp.com/password_hash (PASSWORD_DEFAULT, no auto-generated, no cost 10) +// Mot de passe par défaut "admin" : +define('ADMIN_PASSWORD', '$2y$10$BncfiLy8VEYtkLVIlL5Ar.TVPY9Q3KbllJrdHNuSU5WCRnKafWM5K'); + + ?> diff --git a/emailPoubelle.php b/emailPoubelle.php index 8de3060..9208da3 100644 --- a/emailPoubelle.php +++ b/emailPoubelle.php @@ -10,16 +10,11 @@ // Depend : Postifx (postmap command) php-pdo //----------------------------------------------------------- -// @todo -// form ergonomie -// sqlite -// disable time - ////////////////// // Init & check ////////////////// -define('VERSION', '1.0'); +define('VERSION', '1.4'); if (DEBUG) { error_reporting(E_ALL); diff --git a/emailPoubelleAdmin.php b/emailPoubelleAdmin.php new file mode 100644 index 0000000..394e55f --- /dev/null +++ b/emailPoubelleAdmin.php @@ -0,0 +1,173 @@ +Erreur : Mot de passe incorrect'; +} +if (empty($_SESSION['adminPasswordHash']) || $auth == false) { + echo '
'; +} + +// Test connexion, si c'est ok : +if ($auth==true) { + // Connect DB + try { + if (preg_match('/^sqlite/', DB)) { + $dbco = new PDO(DB); + } else { + $dbco = new PDO(DB, DBUSER, DBPASS); + } + $dbco->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + } catch ( PDOException $e ) { + die('Connexion à la base '.$e->getMessage()); + } + if (isset($_POST['action'])) { + if ($_POST['action'] == 'DeleteEmail' && isset($_POST['email'])) { + DeleteEmail($_POST['email']); + } + if ($_POST['action'] == 'AddBlacklistEmail' && isset($_POST['email'])) { + AddBlacklistEmail($_POST['email']); + } + if ($_POST['action'] == 'DeleteAlias' && isset($_POST['id']) && isset($_POST['alias'])) { + DeleteAlias($_POST['id'], $_POST['alias']); + } + if ($_POST['action'] == 'DisableAlias' && isset($_POST['id']) && isset($_POST['alias'])) { + DisableAlias($_POST['id'], $_POST['alias'], $_POST['email']); + } + } + ?> + + Statistique : '; + echo 'Utilisateur '.$_POST['email'].' : '; + if (count($requestUtilisateur) != 0) { + echo ''; + if (!BlacklistEmail($_POST['email'])) { + echo ''; + } + } else { + echo 'N\'existe pas !'; + } + echo '
'; + echo ''; + if (count($requestUtilisateur) != 0) { + echo 'Status | +Alias | +DateCreat | +DateExpir | +Comment | +
---|---|---|---|---|
+ | '.$utilisateur['alias'].'
+ + '; + if ($utilisateur['status'] == 5) { + echo ''; + } + echo ' |
+ '.$utilisateur['dateCreat'].' | +'.$utilisateur['dateExpir'].' | +'.$utilisateur['comment'].' | +
Nombre d\'alias | +Action | +|
---|---|---|
'; + if (BlacklistEmail($recordActif['email'])) { + echo ' '; + } + echo $recordActif['email'].' | +'.$recordActif['calias'].' | ++ + '; + if (!BlacklistEmail($recordActif['email'])) { + echo ''; + } + echo ' + | +