Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7520225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:01:53+00:00 2026-05-30T02:01:53+00:00

I am building a comment form for a website. Eventually, it will be a

  • 0

I am building a comment form for a website. Eventually, it will be a popup jquery form utilizing ajax. I am trying to get the php together right now and want to make sure that I cover all of the bases to protect against spam.

There are four fields: email, name, url, and comment. This is what I have for the php so far:

$email = $_POST['email'];

if(!filter_var($email, FILTER_VALIDATE_EMAIL)){ 
    print "E-mail is correct";

    $to      = 'asdfdsafasdfsda@gmail.com';
    $subject = 'the subject';
    $message = 'hello';
    $headers = 'From: webmaster@example.com';

    mail($to, $subject, $message, $headers);

} else {
    print "E-mail is not correct";
}

Just checking to make sure that the user is using a proper email address. I am not utilizing a database so am not worried as much about SQL injection or other database related problems. I just want the form to be secure against spam-bots.

What are the other elements I should include in my php to protect against spam?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T02:01:54+00:00Added an answer on May 30, 2026 at 2:01 am

    You can generally not decide if a message is spam or a desired text, so syntactic checks like the one you did for the email won’t work.

    there are on the other hand some solutions out there that try to find certain properties that could identify a message as spam. you can for instance look into http://wordpress.org/extend/plugins/akismet

    a common solution is to use a captcha. that is a picture containing some obfuscated text only a human can read. google provides a simple captcha system, if you want to try: http://www.google.com/recaptcha

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im building an automatic refreshing comment section for my website using jQuery .load. So
Building a comment system with Ajax and JQuery and I want the div the
I'm building a comment section on my website and I need to be able
I am building a comment system. so, I have a php page that displays
I'm parsing a JSON response via $.ajax() and building a form from this object's
I'm currently designing a comments table for a site I'm building. Users will be
building a site using PHP and MySQL that needs to store a lot of
Building a website that has English & Japanese speaking users, with the Japanese users
I'm building a web form that populates dynamically from a stored procedure. It is
I hope someone can help me..... i am trying to build a dynamic form

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.