?????????? ????????? - ??????????????? - /home/agenciai/public_html/cd38d8/smtp-edit.php.tar
???????
home/agenciai/public_html/php_mailer/smtp-edit.php 0000644 00000014111 15124777770 0016314 0 ustar 00 <?php require_once 'config.php'; requireLogin(); // User must be logged in // Get the profile ID from the URL if editing $profileId = isset($_GET['id']) ? $_GET['id'] : null; $profiles = getSMTPProfiles(); $profile = $profileId ? ($profiles[$profileId] ?? []) : []; // Pre-fill form with existing data or defaults $name = $profile['name'] ?? ''; $host = $profile['host'] ?? ''; $port = $profile['port'] ?? 587; $encryption = $profile['encryption'] ?? 'tls'; $username = $profile['username'] ?? ''; $password = ''; // Never pre-fill password for security $from_email = $profile['from_email'] ?? ''; $from_name = $profile['from_name'] ?? ''; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title><?= $profileId ? 'Edit' : 'Add' ?> SMTP Profile</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"> </head> <body class="bg-light"> <div class="container py-5"> <div class="row justify-content-center"> <div class="col-md-8"> <div class="d-flex justify-content-between align-items-center mb-4"> <h2><?= $profileId ? 'Edit' : 'Add New' ?> SMTP Profile</h2> <a href="index.php" class="btn btn-secondary">Back to Dashboard</a> </div> <div class="card"> <div class="card-body"> <form action="smtp-save.php" method="POST"> <?php if ($profileId): ?> <input type="hidden" name="id" value="<?= $profileId ?>"> <?php endif; ?> <div class="row"> <div class="col-md-6"> <div class="mb-3"> <label class="form-label">Profile Name *</label> <input type="text" class="form-control" name="name" value="<?= htmlspecialchars($name) ?>" required placeholder="e.g., My Gmail"> </div> <div class="mb-3"> <label class="form-label">SMTP Host *</label> <input type="text" class="form-control" name="host" value="<?= htmlspecialchars($host) ?>" required placeholder="smtp.gmail.com"> </div> <div class="row"> <div class="col-6"> <div class="mb-3"> <label class="form-label">Port *</label> <input type="number" class="form-control" name="port" value="<?= $port ?>" required> </div> </div> <div class="col-6"> <div class="mb-3"> <label class="form-label">Encryption *</label> <select class="form-select" name="encryption" required> <option value="tls" <?= $encryption == 'tls' ? 'selected' : '' ?>>TLS (port 587)</option> <option value="ssl" <?= $encryption == 'ssl' ? 'selected' : '' ?>>SSL (port 465)</option> </select> </div> </div> </div> <div class="mb-3"> <label class="form-label">SMTP Username *</label> <input type="text" class="form-control" name="username" value="<?= htmlspecialchars($username) ?>" required> </div> <div class="mb-3"> <label class="form-label">SMTP Password *</label> <input type="password" class="form-control" name="password" placeholder="<?= $profileId ? 'Leave blank to keep current password' : 'Required' ?>" <?= $profileId ? '' : 'required' ?>> </div> </div> <div class="col-md-6"> <div class="mb-3"> <label class="form-label">From Email *</label> <input type="email" class="form-control" name="from_email" value="<?= htmlspecialchars($from_email) ?>" required> </div> <div class="mb-3"> <label class="form-label">From Name *</label> <input type="text" class="form-control" name="from_name" value="<?= htmlspecialchars($from_name) ?>" required> </div> <div class="mb-3"> <label class="form-label">Connection Test</label> <div class="form-text"> After saving, you can test this connection by trying to send an email from the dashboard. </div> </div> </div> </div> <hr> <button type="submit" class="btn btn-primary">Save Profile</button> <a href="index.php" class="btn btn-secondary">Cancel</a> </form> </div> </div> </div> </div> </div> </body> </html>