Announcement

Collapse
No announcement yet.

Invalid Token On Contact/Custom Form Pages

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Invalid Token On Contact/Custom Form Pages

    Using a base ready theme. My forms no longer send, and show an invalid token error. Can anyone point me in the right direction? Thank you.

    This error in the console



    GET https://www.buckeyebag.com/mm5/theme...orms/token.php 500 (Internal Server Error) jquery.min.js:4
    Last edited by andrewbond; 12-27-23, 06:45 PM.

    #2
    andrewbond What ReadyTheme Framework are you using?

    It sounds like you may be using an outdated theme that uses the token.php to submit the form. The new Shadows Framework uses a Miva template to send the email which is more secure.



    Nicholas Adkins
    Technical Training Specialist / Miva, Inc.
    [email protected]
    https://www.miva.com/mivalearn

    Comment


      #3
      Base ready theme. It has worked fine until the most recent updates. Is there a way without having to switch themes?

      Comment


        #4
        andrewbond Ah yes I do remember the Base ReadyTheme, https://docs.miva.com/readytheme-doc...tion/baseready

        This theme is extremely old and using an outdated way to send the contact form email.

        My suggestion would be have a developer update the way the form is submitting because it really should not be using PHP to send the email.

        A developer should be able to port the Shadows contact form to your framework.

        The Shadows theme uses the contact_form Theme Component to add the form to the page.

        Here is the contact_form Theme Component: https://github.com/mivaecommerce/sha...ntact_form.mvt

        The form will then submit to the CTFM page and process the information and send the email using Miva template code rather than PHP: https://github.com/mivaecommerce/sha...lates/ctfm.mvt

        You should be able to add these elements and have a better more secure contact form using the same theme.

        That being said I would HIGHLY recommend looking into updating your theme to the newest Shadows framework so that you can take advantage of all the new features that have been included in the framework. In Version 10.08 you can use the Branches feature to apply the new Shadows framework to a branch and not alter the Production branch: https://docs.miva.com/miva10/referen...ching-overview

        Note: The reason the form my no longer work is because it is probably using PHP functions that are no longer supported due to security risks.
        Nicholas Adkins
        Technical Training Specialist / Miva, Inc.
        [email protected]
        https://www.miva.com/mivalearn

        Comment


          #5
          andrewbond It looks like our Support Team has identified this issue and found a fix that I was able to apply to your store to get the form working.

          That being said I still STRONGLY suggest looking into applying the Shadows framework or at least converting to the Shadows contact us form.

          Here are the updates I made to the token.php form and the contactForm.php files on your server:

          token.php, line 3 needs to be
          Current:
          Code:
          $ct = mktime();
          Updated:
          Code:
          $ct = time();
          contactForm.php line 23 needs to be
          Current:
          Code:
          $now = mktime();
          Updated:
          Code:
          $now = time();
          Current:
          Code:
          /* Send the message using mail() function */ mail($storeEmail, "Your ".$storeName." Contact Form Has Been Submitted", $message, $headers); /* Notify vistor of success or failue */ if (mail) {
          Updated:
          Code:
          /* Send the message using mail() function */ $mail = mail($storeEmail, "Your ".$storeName." Contact Form Has Been Submitted", $message, $headers); /* Notify vistor of success or failue */ if ($mail) {
          Last edited by Nick; 12-28-23, 10:01 AM.
          Nicholas Adkins
          Technical Training Specialist / Miva, Inc.
          [email protected]
          https://www.miva.com/mivalearn

          Comment


            #6
            I had this issue a few years if I recall correctly. I think I needed to adjust the paths in the scripts for some reason to get it working. But, eventually, I also integrated the Shadows contact form into my Base Ready themed store. Not sure that's your issue, but may you something to look for.

            Originally posted by andrewbond View Post
            Base ready theme. It has worked fine until the most recent updates. Is there a way without having to switch themes?
            Need to offer Shipping Insurance?
            Interactive Design Solutions https://www.myids.net
            MivaMerchant Business Partner | Certified MivaMerchant Web Developer
            Competitive Rates, Custom Modules and Integrations, Store Integration
            AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
            My T-shirt Collection is mostly MivaCon T-shirts!!

            Comment


              #7
              Looks like that is the issue. Can you give a little guidance on integrating the Shadows contact form into a base ready theme? The powers that be are not ready to update the entire site to Shadows..yet...

              Comment


                #8
                I don't recall the details being years ago. The original method needed PHP and the form processor script in a specific location. It's not an issue because the form processor script is a Miva Page template except for changing the paths in a couple places to match. My suggestion would be to use a branch and copy the Shadows templates, get that working. Then you can update with any customizations you had made to the Base Ready form.

                Scott
                Need to offer Shipping Insurance?
                Interactive Design Solutions https://www.myids.net
                MivaMerchant Business Partner | Certified MivaMerchant Web Developer
                Competitive Rates, Custom Modules and Integrations, Store Integration
                AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
                My T-shirt Collection is mostly MivaCon T-shirts!!

                Comment


                  #9
                  Thank you Scott!

                  Comment

                  Working...
                  X