Login   Register  
PHP Classes
elePHPant
Icontem

File: example-return.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Kristo Vaher  >  Estonian e-payments solution  >  example-return.php  >  Download  
File: example-return.php
Role: Example script
Content type: text/plain
Description: This is example return page, which receives returned information from bank.
Class: Estonian e-payments solution
Submit payments to Estonian and Finnish banks
Author: By
Last change: Version number update
Date: 2011-04-20 04:33
Size: 1,544 bytes
 

Contents

Class file image Download
<?php

    
// Estonian e-payments system 1.4
    // Kristo Vaher 2011 http://www.waher.net
    // Licensed under LGPL http://www.gnu.org/licenses/lgpl-3.0.txt
    // Published http://waher.net/archives/852
    
    //This is an example return page. It uses $_POST to validate if data is being returned, but custom array can be also used
    //Please note that this e-payment system assumes that website is modern and characters are encoded in UTF-8
    
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="et">
    <head>
        <title>Example Return Page</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    </head>
    <body>
        <?php
            
if(!empty($_POST)){
                require(
'class.epay.php');
                require(
'config.epay.php'); //while configuration file is not needed for initial submit page, it is needed for return page
                
$banklink=new Payment($config);
                if(
$banklink->validateReturn($_POST)){
                    
//The data returned from e-payment system is different for each profile
                    //Only constants across all profiles is 'result' (either 'success' or 'failed') and 'order-code'
                    
echo '<pre>';
                    
print_r($_POST); 
                    echo 
'</pre>';
                } else {
                    
//This means that internal security hash has failed and data has been edited
                    //It is recommended to log these attemtps, since it can be sign of malicious behavior
                    
echo '<br/>hash failed!';
                }
            }
        
?>
    </body>
</html>