简体   繁体   中英

how to get the value of checksum in php header

I have a header in php which contains a link like

<?php
header("Location: "."https://abc.com/ppp/purchase.do?version=3.0&".
    "merchant_id=<23255>&merchant_site_id<21312>&total_amount=<69.99>&".
    "currency=<USD>&item_name_1=<incidentsupporttier1>&item_amount_1=<1>&".
    "time_stamp=<2010-06-14.14:34:33>&**checksum=<calculated_checksum>**");
?>

when i run this page the value of checksum is calculated and the link is opened

now how checksum is calculated? calculated_checksum=md5(abc);

md5 is an algorithm which calculates the value of checksum based on certain values inside the bracket.

now i want to know how can i pass the value of checksum in the header url

I am not sure if this is what you mean:

Use string concatenation . :

$calculated_checksum=md5('abc');
header('Location: https://...&checksum=' . $calculated_checksum);

Variables have to start with $ .

<?php

$cs = md5("abc"); //Puts 900150983cd24fb0d6963f7d28e17f72 (the hash of abc) into  the variable named $cd

header("Location: "."https://abc.com/ppp/purchase.do?version=3.0&".
    "merchant_id=<23255>&merchant_site_id<21312>&total_amount=<69.99>&".
    "currency=<USD>&item_name_1=<incidentsupporttier1>&item_amount_1=<1>&".
    "time_stamp=<2010-06-14.14:34:33>&**checksum=" . $cs . "**"); //Redirect the page to the new page with the checksum concatenated onto the end

?>

Is that what you were looking for?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM