Is there a way to generate an unique token without form submission

Discussion in 'Programming' started by WebAutomated, Nov 1, 2010.

  1. #1
    Hi,

    I have the following code that is generating an unqiue token after a user submits the form above. Basically my question how can I generate(retrieve) that token without having to submit the form.

    <form name=submit method=post>
    <input type=submit name=submit value=submit>
    </form>
    
    <script type="text/javascript">
    
    var _document_referrer = document.referrer;
    var _document_location = document.location;
    
    (function() {
      //var getFrameUrls = function() {
      //  var urls = [document.location.href]
    
      //  var p = parent
      //  while (p != p.parent) {
      //    urls.push(p.document.location.href)
      //    p = p.parent
      //  }
      //  urls.push(p.document.location.href)
      //  return urls
      //}
      //
      //getFrameUrls()
      var tf = document.createElement('script')
      tf.type = 'text/javascript'
      tf.async = true
      tf.src = 'http://api.trustedform.com:80/verify.js?' + 
                                                                      'referrer=' + encodeURIComponent(_document_referrer) +
                                                                      '&location=' + encodeURIComponent(_document_location) +
                                                                      '&framed=' + encodeURIComponent(parent != window) +
                                                                      '&sdt=d8fa65e97becdf1368db8ed2e56300a672d73461'
      var s = document.getElementsByTagName('script')[0]
      s.parentNode.insertBefore(tf, s)
    })();
    
    </script>
    
    <? echo "<BR><BR>".$_POST['xxTrustedFormToken'];?>
    PHP:
    As you can see the hidden field for the token is called "xxTrustedFormToken" but it's only retrievable through the POST method. Is there another way I can get a hold of it's value without having to submit the form?

    PS: this is a script from trustedfrom.com for lead generation.
     
    WebAutomated, Nov 1, 2010 IP
  2. KingOle

    KingOle Peon

    Messages:
    69
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #2
    Can you post the form script that you use to submit the token?
     
    KingOle, Nov 1, 2010 IP
  3. WebAutomated

    WebAutomated Peon

    Messages:
    168
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #3
    It's up there:

    <form name=submit method=post>
    <input type=submit name=submit value=submit>
    </form>
    PHP:
    I just need to retrieve the $_POST['xxTrustedFormToken'] variable that is created from the javascript as a hidden field and it's appended to the form on submission. I just need to have it in some other way without submitting the form. Is it possible?
     
    WebAutomated, Nov 1, 2010 IP
  4. S1M

    S1M Peon

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #4
    It's passed in the request header so there has to be a server round-trip. You could try a hidden iframe.
     
    S1M, Nov 2, 2010 IP
  5. WebAutomated

    WebAutomated Peon

    Messages:
    168
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #5
    Would you be willing to help me with that. I'll pay you $15 via PayPal if you could help me retrieve that variable's value without having to submit the offer.
     
    WebAutomated, Nov 3, 2010 IP
  6. domainsurfer

    domainsurfer Well-Known Member

    Messages:
    922
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    110
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #6
    i have found the solution. Pm'ed you my contact details.
     
    domainsurfer, Nov 4, 2010 IP
  7. krsix

    krsix Peon

    Messages:
    435
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #7
    It's a javascript variable when the page has loaded.

    http://pastebin.com/uBwcv71T

    Just add that to the bottom and it'll open an alert box when it loads.

    Changes every load.
     
    krsix, Nov 4, 2010 IP
  8. poetbi

    poetbi Member

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #8
    I have resolved it all by js without form submission and contacted you via gmail.
    what can i do next?
     
    poetbi, Nov 4, 2010 IP
  9. domainsurfer

    domainsurfer Well-Known Member

    Messages:
    922
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    110
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #9
    work done and paid for. thanks.
     
    domainsurfer, Nov 5, 2010 IP