Announcement

Collapse
No announcement yet.

Howdy from Trainsim.com

Collapse
X
Collapse
First Prev Next Last
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Well... it worked. I got all 1.2 million posts imported, and it looks like all the users. Passwords worked for my test accounts, so this is all a good thing.

    Now the fun part...

    Embedding an iframe to display a form worked perfectly.

    Posting that form to another iframe... not so much. Got an error:
    Your submission could not be processed because a security token was missing.

    If this occurred unexpectedly, please inform the administrator and describe the action you performed before you received this error.​
    I'm hoping it's a matter of a missing "require once" style include, but maybe not.

    This is the last hurdle from a functional requirement on upgrading to vb 5 and would avoid going the API route.

    Comment


      #17
      You need to pass securitytoken parameter when submitting a form. You can get the value from Javascript using pageData.securitytoken
      Helpful? Donate. Thanks!
      Buy me a coffeePayPal QR Code
      Fast VPS Host for vBulletin:
      A2 Hosting & IONOS

      Comment


      • glennrocksvb
        glennrocksvb commented
        Editing a comment
        It should be parent.pageData.securitytoken since you're accessing it from an iframe.

      #18
      I hate asking, but I haven't quite figured out how to mix PHP and javascript -- can you point me towards something a little more explicit for pulling the parent token value on the first page and having the system find it on the second & third page? How many coffees?

      I know that I'd have to put that value into a hidden field, and can figure out how to do forms that pass and read values between two pages in the $_POST array, but that's about the extent.

      I'm a database and server guy more than I am a web developer, and most of my web experience is from 2000-2005 with Cold Fusion and BlueDragon using CFML... PHP is still quite new to me and we never had a need to use Javascript....

      Comment


        #19
        HTML Code:
        <form>
            ...
            <input type="hidden" name="securitytoken" id="securitytoken" />
        </form>
        <script>
            window.addEventListener('load', function() {
                document.getElementById('securitytoken').value = parent.pageData.securitytoken;
            });​
        </script>
        Helpful? Donate. Thanks!
        Buy me a coffeePayPal QR Code
        Fast VPS Host for vBulletin:
        A2 Hosting & IONOS

        Comment


          #20
          Thanks -- will give that a try

          Comment


            #21
            The API approach worked.... I'll keep the iframe approach in my back pocket just in case I find something that doesn't work.

            Thanks again for the knowledge dump... it's truly appreciated.

            The documentation on the API was missing some key details: where to install the localapi folder within the server's folder heirarchy, and how to install the package to enable it. I get that doing site admin requires some basic unwritten knowledge, but this is a pretty big miss from a user instructions standpoint.

            Other than that... how to create the custom function, and how to enable within a template and embed on a page is a pretty straight forward process.

            Comment


              #22
              Wow... I should have gone down the API path first. Four hours of binge coding later I've gotten to a point where I'm ready to go beyond just proof of concept and into design/build mode....

              Taking an existing php code chunk for a straight sql query with rowdata output to a table was super easy. All I had to do was replace the echo statements and append those into a html string value...

              From there, moving on to form posting to the same page was also a pretty easy step.

              Any hesitancy I had on migrating to v5 is gone. Poof. Vanished.

              It won't be lift and shift easy, but the benefits of getting off PHP5.6 and into a supported version of both vB and MySQL are well worth a week or three of rewriting a file management package that was originally deployed with v3 over 12 years ago.

              Comment


              • glennrocksvb
                glennrocksvb commented
                Editing a comment
                Awesome! 😎

              #23
              Thought I'd come back to this.... One of my hangups with the API file was cramming everything into main.php...

              I figured out thru a lot of error and trial that you CAN break things up and have multiple PHP files inside the localAPI / API folder.

              As an example, you can have files main.php, lasagna.php and jellydonut.php

              For lasagna.php:
              Code:
              class localapi_Api_Lasagna extends vB_Api

              If it's done right, you'll see the separate PHP files listed as API classes under "List API Extensions and PHP Hooks"

              Code:
              Localapi_Api_JellyDonut
              Localapi_Api_Lasagna
              Localapi_Api_Main
              In the user defined style template, it would be called like this:

              Code:
              {vb:data result, localapi:lasagna, itsHotAndMessy}
              {vb:raw result.html}
              This makes it a lot easier to debug when you have lots of functions... for our site we have what will work out to be around 30 or 40 custom functions. Being able to group them into category files has made it 10000% easier to debug as new functions are ported over.

              My suggestion is to add each function into "main.php" until it's debugged and solid, and then move the function into its eventual home.​

              Comment

              Users Viewing This Page

              Collapse

              There is 1 user viewing this forum topic.

              • Guest Guest

              Latest Posts

              Collapse

              Working...
              X
              Searching...Please wait.
              An unexpected error was returned: 'Your submission could not be processed because you have logged in since the previous page was loaded.

              Please push the back button and reload the previous window.'
              An unexpected error was returned: 'Your submission could not be processed because the token has expired.

              Please push the back button and reload the previous window.'
              An internal error has occurred and the module cannot be displayed.
              There are no results that meet this criteria.
              Search Result for "|||"