@@ -721,7 +721,7 @@ <h2 id="contact-heading" class="font-display text-3xl sm:text-5xl font-black tex
721721
722722 <!-- FORMULAR CARD -->
723723 < div class ="bg-white rounded-[32px] p-8 shadow-2xl border border-gray-50 lg:col-span-3 reveal ">
724- < form id ="contact-form " action =" https://www.fotostudio.io/f/28346edbb9dafb15685cc1bf99067ce6 " method ="POST " class ="space-y-6 ">
724+ < form id ="contact-form " method ="POST " class ="space-y-6 ">
725725
726726 <!-- Vos Coordonnées -->
727727 < div class ="space-y-4 ">
@@ -1102,6 +1102,34 @@ <h4 class="text-xs font-bold uppercase tracking-widest text-white/55 mb-4">Légi
11021102 } , { threshold : 0.1 , rootMargin : '0px 0px -50px 0px' } ) ;
11031103
11041104 revealElements . forEach ( el => revealObserver . observe ( el ) ) ;
1105+
1106+ // 5. Dynamic Form Action & Honeypot Validation to prevent automated spam
1107+ const contactForm = document . getElementById ( 'contact-form' ) ;
1108+ if ( contactForm ) {
1109+ const loadTime = Date . now ( ) ;
1110+
1111+ contactForm . addEventListener ( 'submit' , function ( e ) {
1112+ // Honeypot check: If the hidden input is filled, it's a bot
1113+ const gotcha = contactForm . querySelector ( 'input[name="_gotcha"]' ) ;
1114+ if ( gotcha && gotcha . value !== '' ) {
1115+ e . preventDefault ( ) ;
1116+ console . warn ( 'Spam detected via honeypot.' ) ;
1117+ return ;
1118+ }
1119+
1120+ // Time check: If submitted in less than 4 seconds, it's likely a bot
1121+ const timeDiff = Date . now ( ) - loadTime ;
1122+ if ( timeDiff < 4000 ) {
1123+ e . preventDefault ( ) ;
1124+ console . warn ( 'Spam detected (too fast).' ) ;
1125+ return ;
1126+ }
1127+
1128+ // Set the action URL dynamically to prevent simple scraper bots from finding the endpoint in raw HTML
1129+ // Base64 decodes to: https://www.fotostudio.io/f/28346edbb9dafb15685cc1bf99067ce6
1130+ contactForm . action = atob ( "aHR0cHM6Ly93d3cuZm90b3N0dWRpby5pby9mLzI4MzQ2ZWRiYjlkYWZiMTU2ODVjYzFiZjk5MDY3Y2U2" ) ;
1131+ } ) ;
1132+ }
11051133 </ script >
11061134</ body >
11071135</ html >
0 commit comments