Article focus on improvement mailinglist app for enabling access for common users only on by e-mail unsubscription without ability to see list of all subscribed users.
Goal of unsubscribe by user app extension
For further security hardening (not main improvement but first partialy update) we separate page for unsubscribing for admin (somebody who knows name of that page – no improvement in this way is done) and for unsubscribing for common user.
Users cannot see list of all subscribers names and email. But there is no way for refering any changes in the table. For better user experience, we expanded messaging output for information about:
that e-mail was found in database table – select query search database for appropriate e-mail
that e-mail was succesfully deleted from databse
or warning message that e-mail was not found (user with this e-mail is not subscribed for mailing)
Frontend of the page after inserting wrong e-mail looks like this
or succesfull e-mail removed output
Main logic of script
Next code snipet contains logic for finding appropriate-mail and show message about succesfull search. Next deleting selected e-mail from subscribtion list.
<?php
// two variables for message and styling of the mesage with bootstrap
require_once(‚appvars.php‘); // including variables for database
$msg = “;
$msgClass = “;
$msg_about_contains_email = “;
$msgClass_email = “;
// default values of auxiliary variables
$email =““;
$is_removed = false; //before hitting submit button no result is available
$is_present = false; // email is not in the table – default before slecting against user submitted email for deletion
if(filter_has_var(INPUT_POST, ‚submit‘)){
// Data obtained from $_postmessage are assigned to local variables
$email = htmlspecialchars($_POST[‚email‘]);
// Controll if all required fields was written
if(!empty($email) ) {
// If check passed – all needed fields are written
We inform you that we use cookies and other technologies on this site to function and improve the operation of the site, ensure it, provide social networking features, personalize content and ads to users, and analyze traffic and user behavior. For more information, please read our Terms of Use and Cookies. You can prevent cookies from being processed by changing the settings in your Internet browser.OkPrivacy policy