OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
cream
/
weeklyEmail
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
06/17/2025 10:17:24 AM
rwxrwxr-x
📄
1.php
2.62 KB
06/12/2025 02:54:56 PM
rw-r--r--
📄
2.php
2.73 KB
06/12/2025 02:48:34 PM
rw-r--r--
📁
PHPMailer
-
05/19/2025 10:07:13 AM
rwxr-xr-x
📄
TEST.php
31.55 KB
06/16/2025 11:44:55 AM
rw-r--r--
📁
email_logs
-
06/18/2025 12:44:25 AM
rwxrwxrwx
📄
unsubscribe.php
7.32 KB
05/19/2025 10:07:13 AM
rw-r--r--
📄
weekly_email_cron_wrapper.sh
2.27 KB
05/12/2025 05:22:24 AM
rwxr-xr-x
📄
weeklyemail.php
30.67 KB
06/17/2025 04:15:00 AM
rw-r--r--
Editing: unsubscribe.php
Close
<?php // Unsubscribe handler for Knobly Cream App // This script handles email unsubscribe requests // Include necessary files include "../assets/php/db_config.php"; // Log file setup $logFile = "email_logs/unsubscribe.log"; $logDir = dirname($logFile); if (!is_dir($logDir)) { mkdir($logDir, 0755, true); } // Function to log messages function logMessage($message) { global $logFile; file_put_contents($logFile, date('[Y-m-d H:i:s] ') . $message . PHP_EOL, FILE_APPEND); } // Function to decode the unsubscribe token // Check if token is provided if (!isset($_GET['token']) || empty($_GET['token'])) { // No token provided header("HTTP/1.1 400 Bad Request"); echo "Invalid request: No unsubscribe token provided."; exit; } function simpleEncDec($string, $action = 'd') { $secret_key = 'knoblyCream@2020'; $secret_iv = 'my_simple_secret_iv'; $output = false; $encrypt_method = "AES-256-CBC"; $key = hash('sha256', $secret_key); $iv = substr(hash('sha256', $secret_iv), 0, 16); if ($action == 'e') { $output = base64_encode(openssl_encrypt($string, $encrypt_method, $key, 0, $iv)); } else if ($action == 'd') { $output = openssl_decrypt(base64_decode($string), $encrypt_method, $key, 0, $iv); } return $output; } $token = $_GET['token']; $email = simpleEncDec($token, 'd'); // Validate email format if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { logMessage("Invalid email format from token: $token"); header("HTTP/1.1 400 Bad Request"); echo "Invalid token format."; exit; } try { // Update user preferences in database $stmt = $creamdb->prepare("UPDATE cream.user SET email_notifications = 0 WHERE email = ?"); $stmt->bind_param("s", $email); $stmt->execute(); if ($stmt->affected_rows > 0) { logMessage("User unsubscribed successfully: $email"); // Success page echo "<!DOCTYPE html> <html> <head> <meta charset='UTF-8'> <meta name='viewport' content='width=device-width, initial-scale=1.0'> <title>Unsubscribe Successful</title> <style> body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; max-width: 600px; margin: 0 auto; padding: 20px; text-align: center; } .container { background-color: #f9f9f9; padding: 30px; border-radius: 5px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); margin-top: 50px; } h1 { color: #db5919; } .button { display: inline-block; background-color: #db5919; color: white; text-decoration: none; padding: 12px 20px; border-radius: 5px; margin: 20px auto; font-weight: bold; } </style> </head> <body> <div class='container'> <h1>Unsubscribe Successful</h1> <p>You have been successfully unsubscribed from Knobly Cream weekly emails.</p> <p>We're sorry to see you go! If you change your mind, you can update your email preferences in your account settings.</p> <a href='https://knoblycream.com' class='button'>Return to Knobly Cream</a> </div> </body> </html>"; } else { // logMessage("Unsubscribe failed or user not found: $email"); // User not found page echo "<!DOCTYPE html> <html> <head> <meta charset='UTF-8'> <meta name='viewport' content='width=device-width, initial-scale=1.0'> <title>Unsubscribe Failed</title> <style> body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; max-width: 600px; margin: 0 auto; padding: 20px; text-align: center; } .container { background-color: #f9f9f9; padding: 30px; border-radius: 5px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); margin-top: 50px; } h1 { color: #db5919; } .button { display: inline-block; background-color: #db5919; color: white; text-decoration: none; padding: 12px 20px; border-radius: 5px; margin: 20px auto; font-weight: bold; } </style> </head> <body> <div class='container'> <h1>Unsubscribe Failed</h1> <p>We couldn't find an account with this email address or you're already unsubscribed.</p> <p>If you continue to receive emails, please contact our support team.</p> <a href='https://knoblycream.com' class='button'>Return to Knobly Cream</a> </div> </body> </html>"; } } catch (Exception $e) { logMessage("Error during unsubscribe process: " . $e->getMessage()); // Error page echo "<!DOCTYPE html> <html> <head> <meta charset='UTF-8'> <meta name='viewport' content='width=device-width, initial-scale=1.0'> <title>Unsubscribe Error</title> <style> body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; max-width: 600px; margin: 0 auto; padding: 20px; text-align: center; } .container { background-color: #f9f9f9; padding: 30px; border-radius: 5px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); margin-top: 50px; } h1 { color: #db5919; } .button { display: inline-block; background-color: #db5919; color: white; text-decoration: none; padding: 12px 20px; border-radius: 5px; margin: 20px auto; font-weight: bold; } </style> </head> <body> <div class='container'> <h1>Unsubscribe Error</h1> <p>An error occurred while processing your unsubscribe request.</p> <p>Please try again later or contact our support team for assistance.</p> <a href='https://knoblycream.com' class='button'>Return to Knobly Cream</a> </div> </body> </html>"; } finally { // Close database connection $creamdb->close(); }