Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Limit Character Types In Profile Fields - I.e. First And Last Name Rate Topic   - - - - -

 
  • Ed Newman
  • Advanced Member
  • Members
  • Join Date: 02-Mar 13
  • 136 posts

Posted 20 April 2020 - 01:08 PM #1

Getting a lot of spam in new customer profiles.  People are entering urls in the first or last name.  Get a loan, cryptocurrency, whatever crap.  I'd like to restrict the data entry in the first and last name field to only A-Z characters.  Any easy way to do this?  Anyone have an add-in or want to write one for a reasonable amount of money?


Ed Newman
Dark Storm Industries LLC
www.dark-storm.com


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 20757 posts

Posted 20 April 2020 - 01:50 PM #2

Yes, you can create custom form validators based on input element class attribute. E.g.

<script>
$.ceFormValidator('registerValidator', {
    class: 'cm-gc-validate-amount',
    message: _.tr('text_gift_cert_amount_alert'),
    func: function(id) {
        var max = parseInt((parseFloat(max_amount) / parseFloat(_.currencies.secondary.coefficient))*100)/100;
        var min = parseInt((parseFloat(min_amount) / parseFloat(_.currencies.secondary.coefficient))*100)/100;

        var amount = parseFloat($('#' + id).val());
        if ((amount <= max) && (amount >= min)) {
            return true;
        }

        return false;
    }
});
</script>

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 
  • Ed Newman
  • Advanced Member
  • Members
  • Join Date: 02-Mar 13
  • 136 posts

Posted 20 April 2020 - 03:43 PM #3

Can you PM me a quote for an add on?


Ed Newman
Dark Storm Industries LLC
www.dark-storm.com


 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11642 posts

Posted 20 April 2020 - 06:58 PM #4

Be sure to handle hyphens and apostrophes otherwise you will eliminate valid names.  Are these getting around ReCaptcha?  If not, simply enable ReCaptcha for profile fields.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 20757 posts

Posted 21 April 2020 - 06:23 AM #5

Can you PM me a quote for an add on?

 

Please post all requirements here


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 
  • Ed Newman
  • Advanced Member
  • Members
  • Join Date: 02-Mar 13
  • 136 posts

Posted 21 July 2020 - 01:32 PM #6

They are back at it today.  The problem is a URL in the "name" field in the customer profile.  That's what I need to block.  Simplest might be to block special characters like : and // which would block the link. 

 

Yes, we use recaptcha but they do it manually so they can just do it like any other person.


Ed Newman
Dark Storm Industries LLC
www.dark-storm.com


 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11642 posts

Posted 21 July 2020 - 06:19 PM #7

Probably easiest way is to do something like this in app/addons/my_changes/controllers/common/profiles.pre.php

if( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
  $excluded_strings('http:', 'https:', 'ftp:', 'sftp:', 'ftps:');
  $exclude_fields('firstname', 'lastname');
 
  foreach($exclude_fields as $field) {
    if( !empty($_REQUEST[$field])  ) {
        foreach($excluded_strings as $str) {
          if( stripos($_REQUEST[$field], $str) !== false ) {
          die("Hacker go away!");
        }
      }
    }
  }
}
return array(CONTROLLER_STATUS_OK);

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • Ed Newman
  • Advanced Member
  • Members
  • Join Date: 02-Mar 13
  • 136 posts

Posted 21 July 2020 - 07:04 PM #8

my profiles.php is located in app/controllers/frontend not common so just change the location of there the profiles.pre.php file would go?  Not the coding expert by any stretch


Ed Newman
Dark Storm Industries LLC
www.dark-storm.com


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 20757 posts

Posted 22 July 2020 - 05:54 AM #9

As alternative, use hooks in the fn_update_user function (app/functions/fn.users.php)


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 
  • Ed Newman
  • Advanced Member
  • Members
  • Join Date: 02-Mar 13
  • 136 posts

Posted 23 July 2020 - 01:13 PM #10

Can you provide a price for an add-on to do this?  Ideally, I would like a text box in the add-on setting to enter what to block.... 'www', 'http', etc and a entry in language for what error message to display.  By default it could be 'Please enter a valid first and last name'.  Thanks.


Ed Newman
Dark Storm Industries LLC
www.dark-storm.com


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 20757 posts

Posted 23 July 2020 - 01:24 PM #11

Can you provide a price for an add-on to do this?  Ideally, I would like a text box in the add-on setting to enter what to block.... 'www', 'http', etc and a entry in language for what error message to display.  By default it could be 'Please enter a valid first and last name'.  Thanks.

 

Yes, it can be done with the addon. We are overloaded now. So hire someone to perform it for you


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11642 posts

Posted 23 July 2020 - 06:10 PM #12

Feel free to click the link in my signature and I'll be happy to give you a quote.  We can either create a separate addon for you or extend your existing my_changes addon to do so.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.