Hello all 🙂

I have a MD5 problem with hidden field / form thingy... i try to make it as clear as possible...

I am making a form for my bank which has order info and such. I have made it all work but there is a part of the hidden fields (inside form) that need to be MD5 crypted. Now i aint that good with php or any other coding :rolleyes: but i guess it could be done with md5()...

so what i need is to know how to output this "action form" (POST) hidden field as MD5.. so it shows in html source like: <input type="hidden" name="whatever" value="KJh0we77345kjke8"> before i transfer it to the bank.

This is not a password or any other secret info but just plain text as MD5... and i dont need to write it to any file or db ..but just as hidden field in html form....

Example in function:

$process_button_string = tep_draw_hidden_field('VERSION', 'xxxxxx');
return $process_button_string;

if i need to make that "xxxxxx" as MD5 ..how would i do that?

...i have no idea if i gave enough info or i made any sense but i'm trying 🙂

Many thanks in advance!

    If you have the value that you wish to hash, then you can indeed use [man]md5/man

    All you would need to do is output the result of that hashing when you write the output of the page.

      I do have all the values... just dont know how to make them go through md5() ...

      the one i'm trying to make is a sum.. or chain if you will of values already calculated in that form...

      some of the values are static and some are changing values depending whats the amount, quantity etc... but thay all are in there already when i need to run em through md5...

      lets say we have defined these already:

          $ref = '5144';
          $date = 'EXPRESS';
          $cur = 'EUR';
          $stamp = intval($order->info['total'] * 123);

      and my module writes values like that correctly....

      now i would need to also run all these as "chain" through md5 and get one hidden field like value="sdf897sdfg78dKG8" ... and i have no clue how i do it....

      md5($ref,$date,$cur,$stamp) ....maybe or so?

      and then ask the hidden field write something like:

      tep_draw_hidden_field('NEWFIELD', md5); ...?

      now this is where i get lost becouse my general knownledge of php or any coding is kinda small 🙂

      or do i need to make function md5() ...?

      hehe dumb and lost here 😃

        say u wanna turn $variable into an md5, all u do is..

        <?
        $whatever = md5($variable);
        ?>
        

          what do you mean by run as a chain?
          basically, md5() accepts a string argument and returns a hexadecimal string that is the hash required.

          so for your "chain", you might take the simple approach of concatenating the values and then using md5().

            sorry ...with "chain" i just ment more than 1 variable to be valued as one md5 string...

            like $whatever = ($variable1,$variable2,$variable3); ----> one md5 value... not 3 seperate values...

            hope i make sense 🙂

            i will try these tomorrow when i get to work again ... thanks to all who helped... i will let you know if i made it or not 🙂

              ok i just had to go to work and try.. and it worked nice with 1 variable...

              but when i try to do it with 2 or more i get this:

              Warning: Wrong parameter count for md5()

              whats up with that? ...so what i'm trying to do is to run more than 1 variable through that single md5 line.. like this:

              $mac = md5($version,$rcv_id); <---- and it gives me the warning...

              with $mac = md5($version); <--- it works fine...

              what do i do wrong?

                How about:

                $mac = md5($version . $rcv_id);

                Would this work for what you trying to do?

                  cool! seems it works ... atleast no errors or warnings...

                  thank you all very many! 🙂

                    Write a Reply...