HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/linde-elearning/sign-up.php
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;

require './PHPMailer/src/Exception.php';
require './PHPMailer/src/PHPMailer.php';
require './PHPMailer/src/SMTP.php';

?>

<html>
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Plant safety</title>
  <link rel="shortcut icon" href="/assets/icons/favicon.ico" />
  <link rel="shortcut icon" href="/assets/icons/favicon.ico" />
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
  <link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet'>
  <link rel="stylesheet" href="styles/styles.css">
</head>
  <body>

  <header class="header">
    <div class="container">
      <a href="/">
        <img src="assets/images/logo-linde.png" class="header__logo"/>
      </a>
    </div>
  </header>

  <main>
  <?php
    error_reporting(E_ERROR | E_PARSE);

    $first_name = $_POST["firstName"];
    $last_name = $_POST["lastName"];
    $job_status = $_POST["status"];
    $user_email = $_POST["email"];
    $country = $_POST["country"];
    $terms_accepted = $_POST["terms"];
    $course_name = $_POST["course"];

    $admin_email = "info.e-learning@linde.com";
    $contact_email = "info.e-learning@linde.com";
    $subject = "Linde e-Learning";

    $user_message = '
      <p>Dear sender,</p>
      <p>We confirm that you have signed up for a course on the Linde e-Learning platform.</p>
      <p>Your signup information:</p>
      <ul>
        <li>Course name: <b>' . $course_name . '</b></li>
        <li>Your name: <b>' . $first_name .  ' ' . $last_name . '</b></li>
        <li>Country: <b>' . $country . '</b></li>
        <li>Job status: <b>' . $job_status . '</b></li>
      </ul>
      <p>In case you did not intend to sign up or would like to cancel this process, please contact us on: <a href="mailto:' . $contact_email . ' ?subject=Linde e-Learning">' . $contact_email . '</a></p>
      <p>Best regards, <br />Linde e-Learning team</p>
    ';

    $admin_message = '
      <p>Hi,</p>
      <p>This is a notification mail with information from a new interest in your course:</p>
      <ul>
        <li>Course name: ' . $course_name . '</li>
        <li>Name: ' . $first_name .  ' ' . $last_name . '</li>
        <li>Country: ' . $country . '</li>
        <li>Job status: ' . $job_status . '</li>
        <li>Terms accepted: ' . $terms_accepted . '</li>
      </ul>
      <p>For more information contact us on: <a href="mailto:' . $contact_email . ' ?subject=Linde e-Learning">' . $contact_email . '</a></p>
      <p>Best, <br /> Linde e-Learning</p>
    ';

    /*** Send mail to user ***/
    $mail = new PHPMailer(true);

    echo '<div class="sign-up">';
    echo '<div class="container">';
    echo '<div class="sign-up__wrap">';

    try {
      //Server settings
      $mail->SMTPDebug = SMTP::DEBUG_SERVER;                      //Enable verbose debug output
      $mail->isSMTP();                                            //Send using SMTP
      $mail->Host       = 'smtp.sendgrid.net';                     //Set the SMTP server to send through
      $mail->SMTPAuth   = true;                                   //Enable SMTP authentication
      $mail->Username   = 'apikey';                     //SMTP username
      $mail->Password   = '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';                               //SMTP password
      $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;            //Enable implicit TLS encryption
      $mail->Port       = 465;                                    //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`

      $mail->SMTPDebug = 0;
      $mail->CharSet = 'UTF-8';     

      //Recipients
      $mail->setFrom($admin_email, 'Linde e-Learning');
      $mail->addAddress($user_email, $first_name . $last_name);     //Add a recipient
      $mail->addReplyTo($admin_email, 'Linde e-Learning');

      //Content
      $mail->isHTML(true);                                  //Set email format to HTML
      $mail->Subject = 'Linde e-Learning';
      $mail->Body = $user_message;

      $mail->send();

      /***  Send mail for admin ****/
      // Remove previous recipients
      $mail->ClearAllRecipients();

      $mail->Body =$admin_message;

      // Add the admin address
      $mail->AddAddress($admin_email);
      $mail->Send();

      echo '<img src="assets/icons/icon-message-success.png" alt="Icon message success">';
      echo '<h2 class="sign-up__title">Success!</h2>';
      echo '<h2 class="sign-up__subtitle">You have successfully signed up for a course on e-Learning. A confirmation mail has been sent to your mail address. For more information feel free to contact us on <a href="mailto:' . $contact_email . '?subject=Linde e-Learning">' . $contact_email . '</a>!</h2>';
      } catch (Exception $e) {
        echo '<img src="assets/icons/icon-message-failed.png" alt="Icon message failed">';
        echo '<h2 class="sign-up__title">Oooops! Something wrong.</h2>';
        echo '<h2>Please try to sign up again or contact us on </br><a href="mailto:' . $contact_email . '?subject=Linde e-Learning">' . $contact_email . '</a></h2>';
        echo '<h2>Mailer Error: ' . $mail->ErrorInfo . '</h2>';
      }
      echo '</div>';
      echo '</div>';
      echo '</div>';
?>
  </main>

      <div class="cookie" style="display: none">
        <div class="container">
          <div class="row">
            <div class="col-12 col-xl-9">
              <h2>Cookie Preferences</h2>
              <p>By clicking “Accept All Cookies”, you agree to the storing of cookies and similar technologies on your device to enhance site navigation, analyze site usage, offer certain functionalities and assist in our marketing efforts. Strictly necessary cookies are always active. You can read more about our policy in the <br /><a href="/privacy-policy">Privacy Policy.</a>
              </p>
            </div>
            <div class="col-12 col-xl-3 btn-col">
              <div class="inline-buttons">
                <button class="btn-cookie btn-cookie--gradient-small acceptAllCookies">Accept All Cookies</button>
                <button class="btn-cookie btn-cookie--hollow small acceptNecessaryCookies">Reject</button>
              </div>
            </div>
          </div>
        </div>
      </div>

      <footer class="footer">
        <div class="container">
          <div class="footer__wrap">
            <ul class="footer__links">
              <li class="footer__link"><a href="/">HOME</a></li>
              <li class="footer__link"><a href="/legal-notice">LEGAL NOTICE</a></li>
              <li class="footer__link"><a href="/terms-conditions" >TERMS & CONDITIONS</a></li>
              <li class="footer__link"><a href="/privacy-policy" >PRIVACY POLICY</a></li>
              <li class="footer__link"><a href="/cookie-policy">COOKIE POLICY</a></li>
            </ul>
            <p class="footer__copyright">© Copyright E-Learning 2021</p>
          </div>
        </div>
      </footer>

      <script src="js/app.js"></script>
  </body>
</html>