校验和错误
如何解决校验和错误我正在集成到 php 但发生校验和错误 如何解决校验和错误我正在集成到 php 但发生校验和错误
如何解决校验和错误
/* @ Check User Session : */
$session_user_id = $_SESSION[SITE_CODE]['user']['user_id'];
if(!empty($_SESSION['fund']))
{
//variable billing details:
$fname = $_SESSION['fund']['fname'];
$email = $_SESSION['fund']['email'];
$mbl = $_SESSION['fund']['mobno'];
$amount = $_SESSION['fund']['amount'];
$comment = $_SESSION['fund']['comment'];
//total payment amount:
$amount = number_format($_SESSION['fund']['amount'],2,'.','');
/* @ Get Product Details */
$array['productinfo'] = array("name"=>'AAA',
"description"=>'AAA',
"value"=>$amount,
"isRequired"=>"false");
$product_info = json_encode($array['productinfo']);
/**************[Start :: Payment Setup]***********************/
// Merchant key here as provided by Payu
$MERCHANT_KEY = "JBZaLc";
// Merchant Salt as provided by Payu
$SALT = "GQs7yium";
// End point - change to https://secure.payu.in for LIVE mode
$PAYU_BASE_URL = "https://test.payu.in";
$action = '';
$posted = array();
if(!empty($_POST)) {
//print_r($_POST);
foreach($_POST as $key => $value) {
$posted[$key] = $value;
}
}
$formError = 0;
if(empty($posted['txnid'])) {
// Generate random transaction id
$txnid = substr(hash('sha256', mt_rand() . microtime()), 0, 20);
} else {
$txnid = $posted['txnid'];
}
$hash = '';
// Hash Sequence
$hashSequence = "key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5|udf6|udf7|udf8|udf9|udf10";
if(empty($posted['hash']) && sizeof($posted) > 0) {
if(
empty($posted['key'])
|| empty($posted['txnid'])
|| empty($posted['amount'])
|| empty($posted['firstname'])
|| empty($posted['email'])
|| empty($posted['phone'])
|| empty($posted['productinfo'])
|| empty($posted['surl'])
|| empty($posted['furl'])
|| empty($posted['service_provider'])
) {
$formError = 1;
} else {
json_encode(json_decode('[{"name":"tutionfee","description":"","value":"500","isRequired":"false"},{"name":"developmentfee","description":"monthly tution fee","value":"1500","isRequired":"false"}]'));
$hashVarsSeq = explode('|', $hashSequence);
$hash_string = '';
foreach($_SESSION['fund'] as $hash_var) {
$hash_string .= isset($posted[$hash_var]) ? $posted[$hash_var] : '';
$hash_string .= '|';
}
$hash_string .= $SALT;
$hash = strtolower(hash('sha512', $hash_string));
$action = $PAYU_BASE_URL . '/_payment';
}
} elseif(!empty($posted['hash'])) {
$hash = $posted['hash'];
$action = $PAYU_BASE_URL . '/_payment';
}
/**************[End :: Payment Setup]***********************/
?>
<html>
<head>
<title>PayUMoney - Subscription Payment</title>
<script>
var hash = '2'; //'<?php //echo $hash ?>';
operation;
function submitPayuForm() {
if(hash == '') {
return;
}
var payuForm = document.forms.payuForm;
payuForm.submit();
}
</script>
</head>
<body onLoad="submitPayuForm()">
<center>
<h2><img src="<?php echo SITE_PATH;?>media/images/payu_india.jpg"></h2>
<br/>
<span style="color:black"><strong>Please don't referesh the page ! We are redirecting you on payment process ...</strong></span>
<br/>
<br/>
<h2><img src="<?php echo SITE_PATH;?>media/images/loader1.gif" width="400"></h2>
<!--< /?php if($formError) { ?>
<span style="color:red">Please fill all mandatory fields.</span>
<br/>
<br/>
< ?php } ?>-->
<form action="<?php echo $action; ?>" method="post" name="payuForm">
<input type="hidden" name="key" value="<?php echo $MERCHANT_KEY;?>" />
<input type="hidden" name="hash" value="<?php echo $hash;?>"/>
<input type="hidden" name="txnid" value="<?php echo $txnid;?>" />
<table>
<tr>
<td><!--<b>Mandatory Parameters</b>--></td>
</tr>
<tr>
<td><!--Amount:--> </td>
<td><input type="hidden" name="amount" value="<?php echo $amount;?>" /></td>
<td><!--First Name:--> </td>
<td><input type="hidden" name="firstname" id="firstname" value="<?php echo $fname; ?>" /></td>
</tr>
<tr>
<td><!--Email:--> </td>
<td><input type="hidden" name="email" id="email" value="<?php echo $email; ?>" /></td>
<td><!--Phone:--> </td>
<td><input type="hidden" name="phone" value="<?php echo $mbl; ?>" /></td>
</tr>
<tr>
<td><!--Product Info:--> </td>
<td colspan="3"><input type="hidden" name="productinfo" value="<?php echo $product_info; ?>"></td>
</tr>
<tr>
<td><!--Success URI:--> </td>
<td colspan="3"><input type="hidden" name="surl" value="<?php echo SITE_PATH;?>payu-money-success" size="64" /></td>
</tr>
<tr>
<td><!--Failure URI:--> </td>
<td colspan="3"><input type="hidden" name="furl" value="<?php echo SITE_PATH;?>payu-money-failure" size="64" /></td>
</tr>
<tr>
<td><!--Service Provider:--> </td>
<td colspan="3"><input type="hidden" name="service_provider" value="<?php echo 'payu_paisa';?>" size="64" /></td>
</tr>
<!--<tr>
<td><b>Optional Parameters</b></td>
</tr>-->
<tr>
<td><!--Last Name:--> </td>
<td><input type="hidden" name="lastname" id="lastname" value="<?php echo $lname; ?>" /></td>
<td><!--Cancel URI:--> </td>
<td><input type="hidden" name="curl" value="<?php echo SITE_PATH;?>payu-money-cancel" /></td>
</tr>
<tr>
<td><!--Address1:--> </td>
<td><input type="hidden" name="address1" value="<?php echo $address; ?>" /></td>
<td><!--Address2:--> </td>
<td><input type="hidden" name="address2" value="<?php echo $address2; ?>" /></td>
</tr>
<tr>
<td><!--City:--> </td>
<td><input type="hidden" name="city" value="<?php echo $city; ?>" /></td>
<td><!--State:--> </td>
<td><input type="hidden"name="state" value="<?php echo $state; ?>" /></td>
</tr>
<tr>
<td><!--Country:--> </td>
<td><input type="hidden" name="country" value="<?php echo $country; ?>" /></td>
<td><!--Zipcode:--> </td>
<td><input type="hidden" name="zipcode" value="<?php echo $zipcode; ?>" /></td>
</tr>
<tr>
<td><!--UDF1:--> </td>
<td><input type="hidden" name="udf1" value="<?php echo "camera vintage shopping cart -".date('dmY'); ?>" /></td>
<td><!--UDF2:--> </td>
<td><input type="hidden" name="udf2" value="<?php echo (empty($posted['udf2'])) ? '' : $posted['udf2']; ?>" /></td>
</tr>
<tr>
<td><!--UDF3:--> </td>
<td><input type="hidden" name="udf3" value="<?php echo (empty($posted['udf3'])) ? '' : $posted['udf3']; ?>" /></td>
<td><!--UDF4:--> </td>
<td><input type="hidden" name="udf4" value="<?php echo (empty($posted['udf4'])) ? '' : $posted['udf4']; ?>" /></td>
</tr>
<tr>
<td><!--UDF5:--> </td>
<td><input type="hidden" name="udf5" value="<?php echo (empty($posted['udf5'])) ? '' : $posted['udf5']; ?>" /></td>
<td><!--PG:--> </td>
<td><input type="hidden" name="pg" value="<?php echo (empty($posted['pg'])) ? '' : $posted['pg']; ?>" /></td>
</tr>
<tr>
<!-- < /?php //if(!$hash) { ?>
<td colspan="4"><input type="submit" value="Submit" /></td>
< /?php //} ?>-->
<input type="hidden" name="service_button_submit" id="service_button_submit" value="Subscription Confirmed" />
<input type="hidden" name="make_payment_amount" id="make_payment_amount" value="<?php echo $paper_total_fee;?>" />
</tr>
</table>
</form>
</center>
</body>
</html>