<commit_before><?php

header("Content-type: text/html");

$sender = $_POST["name"];
$email = $_POST["email"];
$message = $_POST["message"];
$headers = "From: '".$sender."' <<EMAIL>>\r\n";

mail("<EMAIL>", "Contact form | ".$email, $message, $headers);

?>

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Thanks for getting in touch.</title>

    <style>
      @import url('https://fonts.googleapis.com/css?family=Montserrat:600');
      body {background-color:#2d3940;margin:0;color:white;position:fixed;}
      .content-main {width:50vw;position:absolute;top:50vh;left:50vw;transform:translate(-50%, -50%);text-align:center;}
      h1 {font-family:'Montserrat';font-weight:600;font-size:6vw;margin:0;font-weight:bold;text-transform:uppercase;}
      h2 {font-family:'Montserrat';font-weight:600;font-size:3vw;margin:0;font-weight:400;}
      canvas {width:100vw;height:100vh;}
    </style>

  </head>
  <body>
    <canvas id="boids"></canvas>
    <div class="content-main">
      <h1>Email sent</h1>
      <h2>Thanks for getting in touch, <?php echo explode(" ", $sender)[0]; ?>. I'll get back to you shortly.</h2>
    </div>

    <!-- TODO: replace this with an implementation of Boids, because flocking
    birds are weakly connected to email sending -->
    <script type="text/javascript" src="dist/emailsent.js"></script>
  </body>
</html><commit_msg>Don't allow contact without filling out fields<commit_after><?php

header("Content-type: text/html");

$sender = $_POST["name"];
$email = $_POST["email"];
$message = $_POST["message"];
$headers = "From: '".$sender."' <<EMAIL>>\r\n";

$success = false;
if (strlen(trim($sender)) > 0 && strlen(trim($email)) > 0 && strlen(trim($message)) > 0) {
  $success = true;
  mail("<EMAIL>", "Contact form | ".$email, $message, $headers);
}

?>

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Thanks for getting in touch.</title>

    <style>
      @import url('https://fonts.googleapis.com/css?family=Montserrat:600');
      body {background-color:#2d3940;margin:0;color:white;position:fixed;}
      .content-main {width:50vw;position:absolute;top:50vh;left:50vw;transform:translate(-50%, -50%);text-align:center;}
      h1 {font-family:'Montserrat';font-weight:600;font-size:6vw;margin:0;font-weight:bold;text-transform:uppercase;}
      h2 {font-family:'Montserrat';font-weight:600;font-size:3vw;margin:0;font-weight:400;}
      canvas {width:100vw;height:100vh;}
    </style>

  </head>
  <body>
    <canvas id="boids"></canvas>
    <div class="content-main">
      <h1><?= $success ? "Email sent" : "Email not sent" ?></h1>
      <h2 style="display: <?= $success ? "block" : "none"?>">Thanks for getting in touch, <?php echo explode(" ", $sender)[0]; ?>. I'll get back to you shortly.</h2>
      <h2 style="display: <?= $success ? "none" : "block"?>">Go back and fill in the missing fields</h2>
    </div>

    <!-- TODO: replace this with an implementation of Boids, because flocking
    birds are weakly connected to email sending -->
    <script type="text/javascript" src="dist/emailsent.js"></script>
  </body>
</html>
{'fraction_non_alphanumeric': 0.20141116100064144, 'fraction_numerical': 0.031109685695958948, 'mean_word_length': 4.433797909407666, 'pattern_counts': {'":': 0, '<': 64, '<?xml version=': 0, '>': 67, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4171448', 'n_tokens_mistral': 1140, 'n_tokens_neox': 1074, 'n_words': 220}