<?php
if (($_POST == null) ) 
{
    echo "What is going on here, NO POST DATA :-/";
}
else
{    
    include_once($_SERVER['DOCUMENT_ROOT'] . '/student_portal/includes/databaseFunctions.php');
    echo "Hold On PLease, you shall be redirected to the secure payment page soon.";  
    
  //  openDatabase();
 //  $txnRef= $_POST['txn_ref'];
  // $d= date('Y-m-d H:i:s');
 // $am= $_POST['amount'];
  // $cm= $_POST['cust_name'];
   //$cid= $_POST['cust_id'];
  
  
   // closeDB();
    ?>
    <head>
        <meta charset="UTF-8">
        <title>COLLEGEPAY DEMO APP</title>
    </head>
    <form name="myForm" id="myForm" method="post" action="https://stageserv.interswitchng.com/test_paydirect/pay">
        <!-- REQUIRED HIDDEN FIELDS -->
        <input name="product_id" type="hidden" value="<?php echo $_POST['product_id']; ?>" />
        <input name="pay_item_id" type="hidden" value="<?php echo $_POST['pay_item_id']; ?>" />
        <input name="amount" type="hidden" value="<?php echo $_POST['amount']; ?>" />
        <input name="currency" type="hidden" value="<?php echo $_POST['currency']; ?>" />
        <input name="site_redirect_url" type="hidden" value="<?php echo $_POST['site_redirect_url']; ?>" />
        <input name="txn_ref" type="hidden" value="<?php echo $_POST['txn_ref']; ?>" />

        <input name="payment_params" type="hidden" value="college_split" /> 
        <input name="xml_data" type="hidden" value='<?php echo $_POST['xml_data']; ?>' />
        
        <input name="cust_id" type="hidden" value="<?php echo $_POST['cust_id']; ?>"/>
        <input name="site_name" type="hidden" value="My WEbsite Name"/>
        <input name="cust_name" type="hidden" value="<?php echo $_POST['cust_name']; ?>" />
        <input name="hash" type="hidden" value="<?php echo $_POST['hash'];  ?>" />
        </br></br>
        <input type="submit" value="PAY NOW"></input>
    </form> 	

     <a href="/testpayment/">HOME</a>
     <a href="/testpayment/requery.php">Requery</a>
    </body>
    <br/><br/>
    <img src="images/isw_logo_new_combined.png" title="INTERSWITCH_LOGO" alt="INTERSWITCH LOGO" />
    <script type="text/javascript">
    var auto_refresh = 
            setInterval(
                        function()
                        {    submitform();  }, 3000
                        );
    function submitform()
    {
        document.getElementById('myForm').submit(); // SUBMIT FORM
    }

    </script>
    <?php

}
?>