Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1633 2020-09-09 09:27:47

One2create
New Member
Registered: 2020-09-09
Posts: 5

Re: zem_contact_reborn 4.0.3.20

Hi there,

We’ve got a client with a Textpattern site that hasn’t been updated in 5+ years. They have just recently begun getting the “Form expired” error message on the contact form they use and want us to look in to it. Sadly all our Textpattern experts have moved on in the intervening years so I’m forced to have a crash course in how this all works.

At the moment we are just trying to work out why it is broken and what it will take to fix, so I can ask the client how they would like to proceed. Would someone be able to help me out?

Form is here: http://www.focalpointtraining.com/contact/
Textpattern version: 4.7.3
PHP version: 5.5.38
Active plugins: adi_mobile-0.2 fh-article-image-selector-0.3 hak_tinymce-1.0.2.3 smd_bio-0.40 zem_contact_lang-4.0.3.6 (modified) zem_contact_reborn-4.0.3.20 (modified)

Thanks in advance,
Simon

Offline

#1634 2020-09-09 10:06:13

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,548
Website

Re: zem_contact_reborn 4.0.3.20

Hi Simon, and welcome to txp.

It would be prudent to update both the php and txp to the latest versions.

adi_mobile has a version which is compatible with the latest version of txp
hak_tinymce is no longer cpompatible, although I would urge your client to learn textile as it is very simple.
smd_bio might still work but Stef, the developer would be able to advice should it need any changes
zem_contact has been replaced by com_connect.
Admittedly I never used fh-article-image-selector so I am not sure what it does.


Yiannis
——————————
neme.org | hblack.net | State Machines | NeMe @ github
I do my best editing after I click on the submit button.

Offline

#1635 2020-09-09 10:24:42

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,090
Website

Re: zem_contact_reborn 4.0.3.20

One2create wrote #325847:

They have just recently begun getting the “Form expired” error message on the contact form

Do you know if this is happening on every submission? Or just some of them? Form expiry is governed by writing to the txp_discuss_nonce database table, so please check that table exists and is writable.

Try this:

  1. Open up phpMyAdmin (or equivalent) from your host’s control panel – or you can use the rss_admin_db_manager plugin
  2. View the contents of the txp_discuss_nonce table or run the SQL command select * from txp_discuss_nonce where used=0 order by issue_time desc. That will show you all tokens set by the plugin that have not yet been used.
  3. Note the rows that are already there.
  4. Visit your contact form at http://www.focalpointtraining.com/contact/
  5. Re-run the SQL command above (or revisit the table)
  6. Note the differences in the number of rows. You should have an extra row now (at the top) which has just been added by visiting the form.
  7. Check the datestamp in the issue_time column and make sure it contains a reasonable date/time in it. Bear in mind that your host’s timezone may be different to yours. But if it’s massively out of sync, you may find that the form is “expiring” before it’s issued.

If this is the case you need to investigate your host’s date/time and time zone settings to check they are accurate. Forms expire by default in 10 minutes so it’s vital that the date and time matches ‘now’.

If you upgrade to com_connect then it has an expire attribute that allows you to lengthen this expiry time, which may at least buy you some time until you can figure it out for sure.

Hope that helps.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#1636 2020-09-09 10:26:05

kuopassa
Plugin Author
From: Porvoo, Finland
Registered: 2008-12-03
Posts: 211
Website

Re: zem_contact_reborn 4.0.3.20

One2create wrote #325847:

At the moment we are just trying to work out why it is broken and what it will take to fix, so I can ask the client how they would like to proceed. Would someone be able to help me out?

Replicate the forms created with zem_contact_reborn with the newer com_connect. :-)

Offline

#1637 2020-09-09 10:28:01

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,090
Website

Re: zem_contact_reborn 4.0.3.20

colak wrote #325848:

smd_bio might still work

It does but it probably needs a little visual spruce up for Txp 4.8.

I never used fh-article-image-selector so I am not sure what it does.

It’s an image selector on the Write panel. Will be superseded by com_article_image when it’s officially released.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#1638 2020-09-09 10:59:25

One2create
New Member
Registered: 2020-09-09
Posts: 5

Re: zem_contact_reborn 4.0.3.20

Bloke wrote #325849:

Do you know if this is happening on every submission? Or just some of them? Form expiry is governed by writing to the txp_discuss_nonce database table, so please check that table exists and is writable.

Try this:

  1. Open up phpMyAdmin (or equivalent) from your host’s control panel – or you can use the rss_admin_db_manager plugin
  2. View the contents of the txp_discuss_nonce table or run the SQL command select * from txp_discuss_nonce where used=0 order by issue_time desc. That will show you all tokens set by the plugin that have not yet been used.
  3. Note the rows that are already there.
  4. Visit your contact form at http://www.focalpointtraining.com/contact/
  5. Re-run the SQL command above (or revisit the table)
  6. Note the differences in the number of rows. You should have an extra row now (at the top) which has just been added by visiting the form.
  7. Check the datestamp in the issue_time column and make sure it contains a reasonable date/time in it. Bear in mind that your host’s timezone may be different to yours. But if it’s massively out of sync, you may find that the form is “expiring” before it’s issued.

If this is the case you need to investigate your host’s date/time and time zone settings to check they are accurate. Forms expire by default in 10 minutes so it’s vital that the date and time matches ‘now’.

If you upgrade to com_connect then it has an expire attribute that allows you to lengthen this expiry time, which may at least buy you some time until you can figure it out for sure.

Hope that helps.

Thanks. That was a usefully clear response!

The error is happening with every submission, to the best of my knowledge. Following your instructions I viewed the table in phpMyAdmin and it had 10 rows. I did a form submission and that dropped to 3 rows. So I tried again and it went up to 5 rows. This might be a bit of a doozy.

The timestamps seem to line up happily with what I’m doing. I’m not able to run upgrades at the moment as I’ll have to price everything up for the client before I can get a go ahead. Adding or removing plugins similarly isn’t going to happen at this stage, so my hands are a bit tied.

Offline

#1639 2020-09-09 11:18:32

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,090
Website

Re: zem_contact_reborn 4.0.3.20

One2create wrote #325852:

The error is happening with every submission

Okay, that gives us something to work with, thanks.

I viewed the table in phpMyAdmin and it had 10 rows. I did a form submission and that dropped to 3 rows.

Yeah, it may do that because it removes any rows that are older than 10 minutes whenever someone visits/submits a form. When it subsequently went up to 5 rows, it may have been that someone else (or a web spider) also visited the form around the same time as you. The contents of that table will fluctuate fairly regularly.

The key thing is that you’ve confirmed the timestamps match up, which is both good news (as it’s likely set up properly) but bad news (as there might be something else causing this behaviour).

Adding or removing plugins similarly isn’t going to happen at this stage, so my hands are a bit tied.

Totally understand this.

While zem_contact_reborn is an old plugin, it should still work so there’s no need to jump to com_connect immediately. In the majority cases, the Form Expired issue is simply that the server/client/host have different timestamps, time zones or one part of the chain is set to use Daylight Savings and one isn’t, which throws everything off by an hour and confuses the plugin.

To see if it still is this problem, you could try hacking the plugin to change its default timeout:

  1. Visit the Admin>Plugins panel
  2. Click to edit zem_contact_reborn
  3. Find interval 10 minute in the code
  4. Change that to interval 2 hour (or some largeish value)
  5. Save the changes

If that works and enables form submission then there’s definitely some time mismatch going on. Leaving the forms open for so long is a little bit of a security risk, but at least it might work until you can track down where the time issue is.

If it does work, you can try gradually reducing that interval until it stops working and then set it to a value as close as you can to one that works, e.g. use interval 90 minute and if that still works, go down to interval 61 minute and so on. You’re looking to set it to the smallest reasonable window you can.

In the process of doing that, the value at which it stops working might then give us a clue as to where the problem lies. My money’s still on DST somewhere in the chain, but I’m willing to be proved wrong.

P.S. I was wrong about the expire attribute in com_connect: it doesn’t yet govern the form expiry, just the page expiry. Using a custom expiry value is on my list of things to investigate.

Last edited by Bloke (2020-09-09 11:20:43)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#1640 2020-09-09 11:29:48

One2create
New Member
Registered: 2020-09-09
Posts: 5

Re: zem_contact_reborn 4.0.3.20

Sadly I failed at the first hurdle. Increased the time to 2 hours and it still gave the expiry error message.

Last edited by One2create (2020-09-09 11:30:04)

Offline

#1641 2020-09-09 11:36:35

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,090
Website

Re: zem_contact_reborn 4.0.3.20

One2create wrote #325854:

Sadly I failed at the first hurdle. Increased the time to 2 hours and it still gave the expiry error message.

Drat. Looks like I might be wrong then.

Just to be sure you could try something ludicrous, like interval 24 hour or interval 48 hour. But if neither of those work after a full cache refresh of the page and trying to send the form again, then set the plugin back to interval 10 minute and we’ll have to consider something else.

Might require you to grant me a Publisher login added to your Textpattern admin side though to help figure it out, if you don’t mind, and trust me.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#1642 2020-09-09 11:50:34

One2create
New Member
Registered: 2020-09-09
Posts: 5

Re: zem_contact_reborn 4.0.3.20

Yep. I tried 12 hours the first time out and just tried 48 hours, with no luck. Sorry!

I think at this stage letting you have a look at the site would be fine. What’s the best email to set your account up under?

Offline

#1643 2020-09-09 11:54:22

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,090
Website

Re: zem_contact_reborn 4.0.3.20

One2create wrote #325856:

Yep. I tried 12 hours the first time out and just tried 48 hours, with no luck. Sorry! What’s the best email to set your account up under?

No worries, thanks for trying. I’ll drop you an email in a few minutes.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#1644 2020-09-09 12:53:13

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,090
Website

Re: zem_contact_reborn 4.0.3.20

@One2create. Think that’s sorted now. Please test.

The version of the plugin you’re using has a function call to mysql_real_escape_string() which was being zapped by your version of PHP. That meant the security nonce wasn’t being read from the form, which meant the server had no idea which form was submitted and shrugged its shoulders.

The solution was simply to swap out the mysql_real_escape_string() call for doSlash() (like it’s done in com_connect).

EDIT: And calls to is_windows() need to be replaced with the constant IS_WIN.

Last edited by Bloke (2020-09-09 13:17:29)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB