Community Forums 

Main Content

Link Verification for dummies

    Dec 13 2012 20:53:15

    #1

    Simon Clay

    Join date : 2009-02-19      Posts : 43

    Hi,

    I am attempting to create a module for a CMS (runs on php & mysql) which enables the user to create mals shopping cart links.

    I want it to generate link verification for each product but can't understand what I need to do to make that work from the documentation.

    Is anyone able to explain in a simpler way how it should be done?



    Dec 14 2012 17:13:48

    #2

    anon

    Join date : 2008-09-18      Posts : 488

    Create a php function to calculate a hash:
    function calc_hash($product, $price, $units) {
    $secret_key = "XXXXXXXXXXXXXXXXXXXXXX";
    $hash = md5($secret_key . substr(addslashes($product), 0, 10) . $price . $units);
    return $hash;
    }

    Then have code that adds the hash to your Mal's form:
    $hash = calc_hash($product, $price, $units);
    echo("<input type='hidden' name='hash' value='$hash' />\r");



    Dec 19 2012 12:20:27

    #3

    Simon Clay

    Join date : 2009-02-19      Posts : 43

    Thanks very much. I really appreciate it.



    Mar 08 2013 23:04:13

    #4

    BenJPhotography

    Join date : 2013-03-08      Posts : 3

    I have essentially the same question but on the javascript side. Even though the hash I'm generating via Javascript is the same as what I get from the "Hash generator on its own" tool I'm not entirely sure I'm entering the right values into the tool (or into my JS function). i.e. The Mal's cart page may be checking the hash against different fields than what I'm calculating against, thus the hash's are not matching.

    More details here: https://www.mals-e.com/viewtopic.php?id=24602&mid=24602&fid=2



    Mar 08 2013 23:40:53

    #5

    Don

    Join date : 2008-09-18      Posts : 493

    oops

    www.donbarrow.co.uk
    www.pacenotes.com
    Please either Share or Like my Facebook