1- # Contact-Form-PHP
1+ # 📬 Contact-Form-PHP
22
33[ ![ version] ( https://img.shields.io/badge/version-1.7.2-blue.svg )] ( https://github.com/raspgot/Contact-Form-PHP )
44[ ![ code size] ( https://img.shields.io/github/languages/code-size/raspgot/Contact-Form-PHP )] ( https://github.com/raspgot/Contact-Form-PHP )
55[ ![ closed issues] ( https://img.shields.io/github/issues-closed-raw/raspgot/Contact-Form-PHP )] ( https://github.com/raspgot/Contact-Form-PHP/issues?q=is%3Aissue+is%3Aclosed )
66[ ![ stars] ( https://img.shields.io/github/stars/raspgot/Contact-Form-PHP?style=social )] ( https://github.com/raspgot/Contact-Form-PHP/stargazers )
77
8- A ** modern** , ** secure** , and ** customizable ** contact form for any PHP project
9- Built with ** Bootstrap 5** , powered by ** AJAX** , ** PHPMailer** , and ** Google reCAPTCHA v3** — no jQuery, no bloat
10- 🔐 Designed for performance, accessibility, and clean code
8+ A ** modern** , ** secure** and ** lightweight ** contact form for PHP projects.
9+ Built with ** Bootstrap 5** , ** AJAX** , ** PHPMailer** , and ** Google reCAPTCHA v3** — no jQuery, no bloat.
10+ 🔐 Designed with ** security ** , ** performance ** and ** accessibility ** in mind.
1111
1212![ Demo] ( https://github.raspgot.fr/contact-form-raspgot.gif )
1313
1414## ✨ Features
1515
16- - ** PHP 8+ Ready** – Strictly typed and future-proof
17- - ** Bootstrap 5 UI** – Responsive and accessible
18- - ** AJAX Submission** – No page reloads
19- - ** Google reCAPTCHA v3** – Invisible spam protection
20- - ** SMTP Delivery with PHPMailer** – Secure emails
21- - ** Auto-reply to users** – Confirm receipt
22- - ** Disposable email detection** – Block throwaway addresses
23- - ** Honeypot spam traps** – Catch bots
24- - ** Session-based rate limiting** – Prevent abuse
25- - ** Easy customization** – Tailor fields and styles
16+ - ✅ ** PHP 8+ Ready** – Strict types & modern code
17+ - 🎨 ** Bootstrap 5 UI** – Responsive and accessible
18+ - ⚡ ** AJAX Submission** – No page reload
19+ - 🤖 ** Google reCAPTCHA v3** – Invisible spam protection
20+ - 📧 ** PHPMailer SMTP** – Secure email delivery
21+ - 🔁 ** Auto-reply** – User confirmation message
22+ - 🚫 ** Disposable email detection** – Block throwaway addresses
23+ - 🕵️ ** Honeypot traps + Rate limiting** – Anti-bot & anti-abuse
24+ - 🛠️ ** Easy customization** – Fields, messages & styles
2625
2726## 🚀 Live Demo
2827
29- 🔗 [ View the demo ] ( https://github.raspgot.fr )
28+ 🔗 [ Try it here ] ( https://github.raspgot.fr )
3029
3130## 📦 Quick Start
3231
33- 1 . ** Clone the repository: **
32+ 1 . ** Clone or download ** the repo:
3433
3534 ``` bash
3635 git clone https://github.com/raspgot/Contact-Form-PHP.git
3736 ```
3837
39- Or [download as ZIP](https://github.com/raspgot/Contact-Form-PHP/archive/master.zip)
38+ Or [download ZIP](https://github.com/raspgot/Contact-Form-PHP/archive/master.zip)
39+
40+ 2. ** Run locally** with PHP:
41+
42+ Use a local PHP server like [XAMPP](https://www.apachefriends.org), [MAMP](https://www.mamp.info) or PHP' s built-in server:
4043
41- 2. ** Run locally:**
42- Use a local PHP server like [XAMPP](https://www.apachefriends.org), [MAMP](https://www.mamp.info) or PHP' s built-in server:
4344 ```bash
4445 php -S localhost:8000
4546 ```
4647
47- ## ⚙️ Configuration
48+ ## ⚙️ Setup
4849
49- ### 1. Set credentials
50+ ### 1. Configure backend
5051
51- Get your reCAPTCHA secret key at [Google reCAPTCHA](https://www.google.com/recaptcha/admin)
52+ Get your reCAPTCHA secret key at [Google reCAPTCHA admin ](https://www.google.com/recaptcha/admin)
5253
53- In `AjaxForm.php`, edit :
54+ Edit ** `AjaxForm.php`** with your credentials :
5455
5556```php
5657const SECRET_KEY = ' your_recaptcha_secret_key' ;
@@ -61,81 +62,61 @@ const SMTP_SECURE = 'tls';
6162const SMTP_PORT = 587;
6263```
6364
64- > **Note:** Enable `php_curl` in `php.ini`:
65- >
66- > ```ini
67- > extension=curl
68- > ```
69-
70- ### 2. Set reCAPTCHA site key in JS
65+ > **Note:** Enable `php_curl` in `php.ini`
7166
72- In `AjaxForm.js`:
73-
74- ```javascript
75- const RECAPTCHA_SITE_KEY = ' YOUR_RECAPTCHA_SITE_KEY' ;
67+ ```ini
68+ extension=curl
7669```
7770
78- And in `index.html`:
79-
80- ```html
81- <script src="https://www.google.com/recaptcha/api.js?render=YOUR_RECAPTCHA_SITE_KEY"></script>
82- ```
83-
84- ## ✨ Advanced Features
85-
86- - Regex-based User-Agent detection (blocks common bots)
87- - DNS and disposable email validation (rejects throwaway emails)
88- - reCAPTCHA score filtering (requires min. score 0.5)
89- - Honeypot hidden field (traps bots)
90- - Session rate limiting (max 3 submissions per hour)
91- - Input sanitization to prevent header injection and XSS
92- - Automatic user acknowledgment email
93- - Customizable email template with dynamic data
94-
95- ## 🛠️ Customization
71+ ### 2. Configure frontend
9672
97- ### ✏️ Change validation messages
73+ - In **`AjaxForm.js`**:
9874
99- Edit the messages in `index.html`:
75+ ```js
76+ const RECAPTCHA_SITE_KEY = ' YOUR_RECAPTCHA_SITE_KEY' ;
77+ ```
10078
101- ```html
102- <div class="valid-feedback">Looks good !</div>
103- <div class="invalid-feedback">Please provide a valid name.</div>
104- ```
79+ - In **`index.html`**:
10580
106- ### ✉️ Customize the confirmation email
81+ ```html
82+ <script src="https://www.google.com/recaptcha/api.js?render=YOUR_RECAPTCHA_SITE_KEY"></script>
83+ ```
10784
108- The file `email_template.php` contains the HTML template for the confirmation email automatically sent to the user after form submission
85+ ---
10986
110- You can modify this file to:
87+ ## 🔧 Customization
11188
112- - Change the content of the email
113- - Add your logo and branding
114- - Adjust formatting and styles
89+ - **Validation messages** → edit in `index.html`
90+ - **Confirmation email** → customize `email_template.php` (logo, branding, text)
91+ - **Rate limiting** → edit in `AjaxForm.php`:
11592
116- ### ⚡ Adjust session rate limiting
93+ ```php
94+ const MAX_ATTEMPTS = 5;
95+ const RATE_LIMIT_DURATION = 3600; // in seconds
96+ ```
11797
118- By default, the form limits users to **5 submissions per hour** to prevent abuse
98+ ---
11999
120- To change this limit:
100+ ## 🔒 Advanced Features
121101
122- 1. Open `AjaxForm.php`
123- 2. Look for the following lines:
102+ - Regex-based bot User-Agent blocking
103+ - DNS & disposable email checks
104+ - reCAPTCHA score filtering (min. 0.5)
105+ - Honeypot hidden field
106+ - Session rate limiting (default: 5/hour)
107+ - Header injection & XSS protection
124108
125- ```php
126- const MAX_ATTEMPTS = 5;
127- const RATE_LIMIT_DURATION = 3600; // seconds (3600 = 1 hour)
128- ```
109+ ---
129110
130- 3. Modify `MAX_ATTEMPTS` and `RATE_LIMIT_DURATION` to suit your needs
111+ ## 🤝 Contributing
131112
132- ## 🙌 Contributing
113+ Issues and PRs are welcome! 🚀
133114
134- Feel free to open issues or submit pull requests :)
115+ ---
135116
136- ## 🧑 💻 Author
117+ ## 👨 💻 Author
137118
138- 
119+ 
139120Developed by [**Raspgot**](https://raspgot.fr) — [contact@raspgot.fr](mailto:contact@raspgot.fr)
140121
141122If you find this project useful, please ⭐ star the repository !
0 commit comments