0

I have this script.

<head>
<script type="text/javascript" src="sha1.js"></script>

</head>
<body>
<?php
$A= 'TEST01';
$B= '059B8125F';
$C= '20061123_003';
$D= '100.00';
$E= '50126';

?>
<form name="checkout" method="post" action="">
<input type="hidden" name="A" value="<?php echo $A; ?>" />
<input type="hidden" name="B" value="<?php echo $B; ?>" />
<input type="hidden" name="C" value="<?php echo $C; ?>" />
<input type="hidden" name="D" value="<?php echo $D; ?>" />
<input type="hidden" name="E" value="<?php echo $E; ?>" />
</form>

<script type="text/javascript" language="javascript">
var str = "##" + form.A.value.toUpperCase() + "##" + form.B.value.toUpperCase() + "##" + form.C.value.toUpperCase() + "##" + form.D.value.toUpperCase() + "##" + form.E.value.toUpperCase() + "##";

form.SIGNATURE.value = hex_sha1(str);
</script>


</body>

My question is, how to show the SIGNATURE value ini PHP? I want to show it in echo. Is it possible?

Thank you all

Akshay
  • 3,361
  • 1
  • 21
  • 19
Nur faiz
  • 3
  • 3

1 Answers1

0

PHP's sha1 function may be useable for this.

This should be calculate from php-side.

<head>
<script type="text/javascript" src="sha1.js"></script>

</head>
<body>
<?php
$A= 'TEST01';
$B= '059B8125F';
$C= '20061123_003';
$D= '100.00';
$E= '50126';

$hash_str = "##" + strtoupper($A) + "##" + strtoupper($B) + "##" + strtoupper($C) + "##" + strtoupper($D) + "##" + strtoupper($E) + "##";

$signature = sha1($hash_str);

echo $signature;
?>

<form name="checkout" method="post" action="">
<input type="hidden" name="A" value="<?php echo $A; ?>" />
<input type="hidden" name="B" value="<?php echo $B; ?>" />
<input type="hidden" name="C" value="<?php echo $C; ?>" />
<input type="hidden" name="D" value="<?php echo $D; ?>" />
<input type="hidden" name="E" value="<?php echo $E; ?>" />
<input type="hidden" name="SIGNATURE" value="<?php echo $signature; ?>" />
</form>

</body>
Oğuzhan Eroğlu
  • 152
  • 1
  • 10