Limit Maximum Post Code length ?
Hello,
I'm still working with the v1.3.7. In the administration it is possible to set the minimum number of characters for the ZIP code, but I wonder if it is possible to setup maximum number of characters? Is it possible to edit it somewhere in php source?
Re: Limit Maximum Post Code length ?
In your templates, tpl_modules_address_book_details.php you'll find this code:
(this link is from v1.5.7, but you'll recognize the similarities in yours)
https://github.com/zencart/zencart/b...ls.php#L96-L97
Notice there that it uses the following to set the field length:
Code:
zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_postcode', '40')
Behind the scenes it does 2 things:
1. It says use 40 characters as the initial size/width displayed on the page.
2. It reads the database table (address_book table) to get the maximum length of the field in there, and then tells the web page to not allow more characters than that.
So, if your "real" question is how to shorten the field so it doesn't take up so much horizontal space (40 characters when you're only wanting 10) then perhaps just changing the 40 to a smaller number will suffice.
Or was your "real" question something else?
1 Attachment(s)
Re: Limit Maximum Post Code length ?
Thank you very much for your feedback. However, this is not what I am looking for. Recently we have a problem with customer registration through spambot. I think the implementation of captcha would be too complicated.
So, I thought to limit the length of the ZIP code characters because there are 6 characters in our country, but spambot enters more characters. The minimum number of characters that can be set in the administration works so that if the customer enters fewer characters when registering, he / she will receive a "more characters must be entered" error. I'm looking for how to do the same upside down to limit the maximum number of characters.
This is a spambot registration:
Attachment 18728
Re: Limit Maximum Post Code length ?
Honestly if the goal is to address spambot type actions it would be suggested to start the upgrade process as the software being used (Zen Cart 1.3.7 based on the content of this thread) is based on antiquated and potentially buggy software as compared to today's standard.
As far as captcha type implementation it shouldn't be much effort at all to implement, there are example sections of code in the associated header_php.php file for the pages in question, in the associated template file for the page and the code to implement the captcha should already exist for that version or a relatively equivalent version.
As to simply limiting that field length, it may temporarily stop a few of the submissions, but there is no reason to expect that the bot won't get "smarter". I see that numbers are applied to the phone number, so apparently it has figured out that aspect...
Re: Limit Maximum Post Code length ?
I don't even have a copy of 1.3.7 to look at, but you could try pattern matching on the field..
One thing through,
Quote:
However, this is not what I am looking for. Recently we have a problem with customer registration through spambot
This bot does not use your form! which makes CAPTCHA useless anyway, and any pattern matching..
This is what I use on my postal code. Google search for patterns matching your country needs..
Code:
<?php echo zen_draw_input_field('postcode', '',' id="postcode" title="Your postal code (12345 or 12345-1234)" pattern="^\d{5}(?:[\s]?[-\s][\s]?\d{4})?$" required="required" aria-required="true" '); ?>
Re: Limit Maximum Post Code length ?
Quote:
Originally Posted by
davewest
I don't even have a copy of 1.3.7 to look at, but you could try pattern matching on the field..
One thing through,
This bot does not use your form! which makes CAPTCHA useless anyway, and any pattern matching..
This is what I use on my postal code. Google search for patterns matching your country needs..
Code:
<?php echo zen_draw_input_field('postcode', '',' id="postcode" title="Your postal code (12345 or 12345-1234)" pattern="^\d{5}(?:[\s]?[-\s][\s]?\d{4})?$" required="required" aria-required="true" '); ?>
And what do these bots use for registration?
Re: Limit Maximum Post Code length ?
Quote:
Originally Posted by
moskyt
And what do these bots use for registration?
The old method was to fill in your form, there are ways to bypass your from and just post data. As with everything, bots upgrade too.
Re: Limit Maximum Post Code length ?
Quote:
Originally Posted by
davewest
The old method was to fill in your form, there are ways to bypass your from and just post data. As with everything, bots upgrade too.
Current software requires additional matching data to accept provided data. Not to mention that much of the data collected way back was on the url ($_GET) instead of the more secure posted ($_POST) data. More secure because it is not readily accessible by detecting the open text readable information of the page request.