Example #1
0
<?php

$objBusiness = new Business();
$business = $objBusiness->getBusiness();
if (!empty($business)) {
    $objForm = new Form();
    $objValid = new Validation($objForm);
    if ($objForm->isPost('name')) {
        $objValid->_expected = array('name', 'address', 'telephone', 'email', 'website', 'vat_rate');
        $objValid->_required = array('name', 'address', 'telephone', 'email', 'vat_rate');
        $objValid->_special = array('email' => 'email');
        $vars = $objForm->getPostArray($objValid->_expected);
        if ($objValid->isValid()) {
            if ($objBusiness->updateBusiness($vars)) {
                Helper::redirect('/admin' . Url::getCurrentUrl(array('action', 'id')) . '&action=edited');
            } else {
                Helper::redirect('/admin' . Url::getCurrentUrl(array('action', 'id')) . '&action=edited-failed');
            }
        }
    }
    require_once 'template/_header.php';
    ?>
	
	<h1>Business</h1>
	
	<form action="" method="post">
		<table cellpadding="0" cellspacing="0" border="0" class="tbl_insert">
			
			<tr>
				<th><label for="name">Name: *</label></th>
				<td>
Example #2
0
 private function validateIpn()
 {
     $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
     // check if post has been received from paypal.com
     if (!preg_match('/paypal\\.com$/', $hostname)) {
         return false;
     }
     // get all posted variables and put them to array
     $objForm = new Form();
     $this->_ipn_data = $objForm->getPostArray();
     // check if email of the business matches the email recived
     // in post from IPN
     if (!empty($this->_ipn_data) && array_key_exists('receiver_email', $this->_ipn_data) && strtolower($this->_ipn_data['receiver_email']) != strtolower($this->_business)) {
         return false;
     }
     return true;
 }