Hotel landing page - no libraries - bot captcha not user captcha (no reCaptcha)

Hello folks,
I had a go at building a hotel mock landing page (https://8886688.xyz/hotel). It’s more for the design aspects than multi-page content, thus the buttons go nowhere.

While the form does work, I have disabled the action. I used a hidden field as a bot captcha honeypot. I really hate the concept of stopping and burdening users with things to solve when it’s the bots that we need to stop. I read that bots cannot deal with CSS, so they just fill out every field, including hidden ones. Is that still true? The form goes to a php mail script that processes the form and dies if the hidden field is complete. The script is below if your interested in modifying it and giving it a go.

I used royalty-free images from www.unsplash.com.
I made the logo using Inkscape (free vector graphics software).

I’ve not worked out how to make the JS slider slide in a continuous loop. I’ll be investigating that.
I think the CSS could be refactored, as there is some repetition of rules applied across different elements.

The php mail script. I probably need to add some sanitation before submitting to e-mail.

<?php

if(isset($_POST['submit'])){ // Check  that  the form has been sent 

// Create vars from the posted data (sanitise them)
  $name = $_POST['name'];
  $email = $_POST['email'];
  $message = $_POST['message'];
  $spam = $_POST['username']; // Hidded field to catch the bot
  
// Run test for filled in hidden field
  if($spam) {
    die("Bad bot! Tut! Tut!");
    }
    else { // Process  form

  $to = "you@youremail.tld";
  $subj = "Bot Test";
  $body = "Here's a message sent by $name \nE-mail: $email \n$message";

  $headers = "From: Bot Test Form <".$email.">\r\n";
  $headers .= "Reply-To: ".$email;
  mail($to, $subj, $body, $headers);
  }
}
header("Location:http://www.doman.tld"); // Redirect to another page after sending
?>

I like php because it is included in probably almost all hosting services, so you don’t need to pay more to use Node and Mongo. For testing things like this, I only need to pay $0.67 USD per month.

1 Like