Page 1 of 1

s07e04 - Help stop URL Spammers QUESTIONS/SUPPORT

Posted: Sat Dec 16, 2023 9:26 am
by heatherbell
Addon:
Helps to stop URL Spammers using your Contact Form etc

Download:
viewtopic.php?f=28&t=279



--



Testing on 1.0.8.21, allowed a customer to register with http://i-am-a-spammer.com

Re: s07e04 - Help stop URL Spammers

Posted: Sun Dec 17, 2023 12:30 am
by ecartz
Maybe

Code: Select all

<script>$('#inputFirstName, #inputLastName, #inputFromName').attr('pattern', '^[^:/.]+$');</script>
in includes/hooks/shop/siteWide/attr.php

Re: s07e04 - Help stop URL Spammers

Posted: Sun Dec 17, 2023 6:23 am
by heatherbell
ecartz wrote: Sun Dec 17, 2023 12:30 am Maybe
No, can still register with http://i-am-a-spammer.com as name.

Re: s07e04 - Help stop URL Spammers

Posted: Sun Dec 17, 2023 10:42 am
by burt
Strange how that stopped working.

Try:

Code: Select all

$('#inputFirstName, #inputLastName, #inputFromName').attr('pattern', '(?!.*:/.*).*');
Image:
sp.jpg
This should stop any name with ":/" as part of it. It would not stop (eg) www.i-am-a-spammer.com

It would also need to be thoroughly tested to ensure that real names are let through. I can't imagine anyone has a name with :/ in it?

Caveat that this attribute is added by javascript so would only work with .js turned on. Lots of people (myself included) browse with .js turned off by default. If someone wanted it to work without .js, it would just mean overriding the relevant customer_data modules and inserting a pattern, something like [note I have not tried this but it should work];

Code: Select all

$input = new Input('firstname', [
   'id' => $input_id,
   'autocomplete' => 'given-name',
   'placeholder' => ENTRY_FIRST_NAME_TEXT,
   'minlength' => ENTRY_FIRST_NAME_MIN_LENGTH,
   'pattern' => '(?!.*:/.*).*',
 ]);