Пример #1
0
?>
    <?php 
echo getMetaTags();
?>
    <title><?php 
echo $_SESSION['Application_title'];
?>
 <convert>#label=187<convert></title>
    <link rel="stylesheet" type="text/css" href="../css/filter.css" />
    <link rel="stylesheet" type="text/css" href="../css/global.css" />
    <link rel="stylesheet" type="text/css" href="../css/global_p.css" media="print" />
<?php 
//Variables initialisation
$type = isset($_GET['type']) ? $_GET['type'] : '';
$alert_for_news = "YES";
$country = getCountryCodeByIP(getIp());
$register_language = $_SESSION['language'];
$name = "";
$surname = "";
$login = "";
$password = "";
$key = "";
$contact = "";
$latitude = "";
$longitude = "";
$default_lat = "";
$default_lng = "";
$default_zoom = "";
$tmp_key = rand(1, 8);
$connection_failed = false;
$choose_another_login = false;
Пример #2
0
$m_pos = stripos($rqstUri, 'microfinance');
if ($pos > 0) {
    $rqstUri = substr($rqstUri, $pos, strlen($rqstUri));
} else {
    if ($m_pos > 0) {
        $rqstUri = substr($rqstUri, $m_pos, strlen($rqstUri));
    } else {
        $rqstUri = '';
    }
}
$count = 1;
// Get language setting by IP address
$langfrmIP = '';
if ($language == '') {
    if (!isset($_SESSION['CodeByIp'])) {
        $country = getCountryCodeByIP();
    }
    if (isset($country['code']) && $country['code'] != '') {
        $_SESSION['CodeByIp'] = $country['code'];
        if ($country['code'] == 'SN' || $country['code'] == 'BF' || $country['code'] == 'BJ' || $country['code'] == 'GN' || $country['code'] == 'HT' || $country['code'] == 'NE' || $country['code'] == 'FR') {
            $langfrmIP = 'fr';
        } else {
            if ($country['code'] == 'ID') {
                $langfrmIP = 'in';
            }
        }
    }
}
?>

<?php 
Пример #3
0
 function processStripe($stripe_token, $amount, $fee_amount)
 {
     global $database;
     require_once "extlibs/stripe-php-1.11.0/lib/Stripe.php";
     $country = getCountryCodeByIP();
     if (in_array($country['code'], array('CN', 'ID', 'SG', 'KE', 'MZ'))) {
         $_SESSION['stripe_error'] = "blocked";
         return false;
     }
     Stripe::setApiKey(STRIPE_SECRET_KEY);
     $payment_success = false;
     try {
         $email = $database->getEmail($this->userid);
         $charge = Stripe_Charge::create(array("amount" => $amount * 100, "currency" => "usd", "card" => $stripe_token, "description" => $email['email']));
         $payment_success = true;
     } catch (Stripe_Error $e) {
         $_SESSION['stripe_error'] = "charge";
         Logger("Stripe error: userid  " . $this->userid);
         Logger("Stripe error: token   " . $stripe_token);
         Logger("Stripe error: message " . $e->getMessage());
         Logger("Stripe error: status  " . $e->getHttpStatus());
         Logger("Stripe error: body    " . $e->getHttpBody());
     }
     if ($payment_success) {
         $stripe_tran_fee = $fee_amount * -1;
         for ($retry = 0; $retry < 3; $retry++) {
             $database->startDbTxn();
             $res1 = $database->setTransaction($this->userid, $amount, 'Funds upload to lender account', 0, 0, FUND_UPLOAD, 0, 0, UPLOADED_BY_STRIPE);
             $res2 = $res3 = 1;
             if ($fee_amount > 0) {
                 $res2 = $database->setTransaction($this->userid, $stripe_tran_fee, 'Stripe transaction fee', 0, 0, STRIPE_FEE);
                 $res3 = $database->setTransaction(ADMIN_ID, $fee_amount, 'Lender transaction fee', 0, 0, STRIPE_FEE);
             }
             if ($res1 == 1 && $res2 == 1 && $res3 == 1) {
                 $database->commitTxn();
                 return true;
             } else {
                 $database->rollbackTxn();
             }
         }
         $_SESSION['stripe_error'] = "transaction";
         Logger("Stripe error: userid  " . $this->userid);
         Logger("Stripe error: token   " . $stripe_token);
         // TODO send mail
     }
     return false;
 }