<?php
// INCLUDE HEADER IN PAGE
include('other_header.php');
// GET CURRENT DATE AND TIME
$date = date('Y-m-d H:i:s');
if(isset($_POST['success'])) {
	if($_POST['success'] == 'loggedin') {
	?>
	<div style="margin-top: -80px;" class="alert alert-success" role="alert">
		<strong>Well done!</strong> Successfully logged in.
	</div>
	<?php
	}
}

$ratesapi = $sa['jsonrates'];
$currency = $acu['ISO'];
$json_url = "http://jsonrates.com/get/?from=USD&to=" . $currency . "&apiKey=" . $ratesapi;
$json = file_get_contents($json_url);
$obj1 = json_decode($json, true);
$currenciesrate = $obj1['rate'];
?>
  <div class="container">
    <div class="text-center">
      <h1><?php echo $title; ?>
      	<small>/
      			<?php
						$accounttypenow = $_SESSION['acctype'];
						if($accounttypenow == 0){//Publisher
					?>
							Active is: Publisher Account
					<?php
						}
						if($accounttypenow == 1){//Advertiser
					?>
							Active is: Advertiser Account
					<?php
						}
					?>
			</small>
		</h1>
 	 </div>
		</br>
	<div class="text-center">
      <h1><small>Publisher's account</small></h1>
 	</div>
  <?php      
        if ( isset( $_POST[ 'depositsub' ] ) )
{
    try
    {
        // Run CSRF check, on POST data, in exception mode, for 10 minutes, in one-time mode.
        NoCSRF::check( 'csrf_token', $_POST, true, 60*10, false );
        // form parsing, DB inserts, etc.
        // ...
        $result = 'CSRF check passed. Form parsed.';
    }
    catch ( Exception $e )
    {
        // CSRF attack detected
        echo"<script type='text/javascript'>javascript: window.history.go(-1);</script>";
    }
}
else
{
    $result = 'No post data yet.';
}
// Generate CSRF token to use in form hidden field
$token = NoCSRF::generate( 'csrf_token' );
if(isset($_POST['depositsub']))
{
	if($_POST['depositsub'] < $sa['mindeposit']) {?>
									<div class="col-md-6 col-md-offset-3">
												<div class="panel panel-default">
													<div class="panel-heading"><?php echo $a096; ?></div>
													<div class="panel-body">
														<form action="" method="POST">
															<input type="hidden" name="csrf_token" value="<?php echo $token; ?>">
															<div class="form-group has-error">
																<input class="form-control" id="appendedPrependedInput" placeholder="1000" name="depositsub" type="text">
																<h1><b><span style="font-size: 20px;" class="help-block"><?php echo $a258; ?> <?php echo $sa['mindeposit'];?> <?php echo $acu['ISO']; ?></span></b></h1>
															</div>
															
															<input class="btn btn-primary" type="submit" name="submit" value='<?php echo $a094; ?>'>
														</form>
													</div>
												</div>
											</div>
	<?php
	}
	else{
?>
									<div class="col-md-4">
										<?php
										if($paypal_status == '1') {
										?>
										<div class="panel panel-default">
											<div class="panel-heading">PayPal</div>
											<div class="panel-body">
												<?php 
												$zerothreefive = $paypal_taxdollars * $currenciesrate;
												$amount = $_POST['depositsub'];
												$amount = number_format($amount, 2, '.', '');
												$tax = ((($amount / 100) * $paypal_taxpercentage) + (ceil($zerothreefive*10)/10)); 
												$tax = number_format($tax, 2, '.', '');
												$totally = $amount + $tax; 
												?>
												<form action="https://www.paypal.com/cgi-bin/webscr" method="post" name="paypal" id="paypal">
													<input type="hidden" name="on1" value="<?php echo"{$seeP['username']}"; ?>">
													<input type="hidden" name="on2" value="<?php echo"{$seeP['apemail']}"; ?>">
													<input type="hidden" name="on3" value="<?php echo"{$seeP['ppemail']}"; ?>">
													<input type="hidden" name="on4" value="<?php echo"{$seeP['email']}"; ?>">
													<input type="hidden" name="on5" value="<?php echo"{$seeP['country']}"; ?>">
													<input type="hidden" name="on6" value="<?php $accounttypenow = $_SESSION['acctype']; if($accounttypenow == 0){echo'publisher';} if($accounttypenow == 1){ echo'advertiser';} ?>">
													<input type="hidden" name="payer_email" value="<?php echo"{$seeP['email']}"; ?>">
													<input type="hidden" name="email" value="<?php echo"{$seeP['email']}"; ?>">
													<input type="hidden" name="address1" value="<?php echo"{$seeP['adress']}"; ?>">
													<input type="hidden" name="city" value="<?php echo"{$seeP['city']}"; ?>">
													<input type="hidden" name="cmd" value="_xclick" />
													<input type="hidden" name="business" value="<?php echo $paypal_1; ?>" />
													<input type="hidden" name="cbt" value="Return back to Control Panel" />
													<input type="hidden" name="currency_code" value="<?php echo $acu['ISO']; ?>" />
													<input type="hidden" name="quantity" value="1" />
													<input type="hidden" name="item_name" value="Deposit money" />
													<input type="hidden" name="item_number" value="3794" />
													<input type="hidden" name="no_shipping" value="1" />
													<input type="hidden" name="payer_username" value="<?php echo"{$seeP['username']}"; ?>" />
													<input type="hidden" name="amount" value="<?php echo $amount;?>" />
													<input type="hidden" name="tax" value="<?php echo $tax;?>" />
													<input type="hidden" name="return" value="<?php echo $mainurl; ?>p.Deposit"/>
													<input type="hidden" name="cancel_return" value="<?php echo $mainurl; ?>p.Deposit" />
													<input type="hidden" name="notify_url" value="<?php echo $mainurl; ?>system/general/components/payment/paypal/ipn.php" />
													<input type='image' src='system/general/components/payment/paypal/paypalbuy.png' border='0' name='submit' alt='Paypal'>
												</form>
												<b> <?php echo $a098; ?>: <?php echo $acu['ISO']; ?> <?php echo $amount;?></b></br>
												<b> <?php echo $a099; ?>: <?php echo $acu['ISO']; echo $tax; ?></b></br>
												<b> <?php echo $a099; ?>: <?php echo $paypal_taxpercentage; ?>%(<?php echo $acu['ISO']; echo (($amount / 100) * $paypal_taxpercentage);?>) + <?php echo $acu['ISO']; echo (ceil($zerothreefive*10)/10); ?></br>
												<b> <?php echo $a100; ?>: <?php echo $acu['ISO']; ?> <?php echo $totally;?></b>
											</div>
										</div>
										<?php
										}
										if($twocheckout_status == '1') {
										?>
										<div class="panel panel-default">
											<div class="panel-heading">2Checkout</div>
											<div class="panel-body">
												<?php 
												$zerothreefive = $twocheckout_taxdollars * $currenciesrate;
												$tax = ((($amount / 100) * $twocheckout_taxpercentage) + (ceil($zerothreefive*10)/10)); 
												$tax = number_format($tax, 2, '.', '');
												$totally = $amount + $tax; 
												?>
												<form action='https://www.2checkout.com/checkout/purchase' method='post'>
													<input type='hidden' name='sid' value='<?php echo $twocheckout_2; ?>' />
													<input type='hidden' name='mode' value='2CO' />
													<input type='hidden' name='li_0_type' value='product' />
													<input type='hidden' name='li_0_name' value='Deposit' />
													<input type='hidden' name='li_0_price' value='<?php echo $amount;?>' />
													<input type='hidden' name='li_1_type' value='tax' />
													<input type='hidden' name='li_1_name' value='Tax' />
													<input type='hidden' name='li_1_price' value='<?php echo $tax;?>' />
													<input type='hidden' name='currency_code' value='<?php echo $acu['ISO']; ?>' />
													<input type='hidden' name='card_holder_name' value='Checkout Shopper' />
													<input type='hidden' name='street_address' value='<?php echo"{$seeP['username']}"; ?>' />
													<input type='hidden' name='street_address2' value='<?php $accounttypenow = $_SESSION['acctype']; if($accounttypenow == 0){echo'publisher';} if($accounttypenow == 1){ echo'advertiser';} ?>' />
													<input type='hidden' name='city' value='Columbus' />
													<input type='hidden' name='state' value='OH' />
													<input type='hidden' name='zip' value='43228' />
													<input type='hidden' name='country' value='USA' />
													<input type='hidden' name='email' value='<?php echo"{$seeP['email']}"; ?>' />
													<input type='hidden' name='phone' value='614-921-2450' />
													<input class='btn btn-primary' name='submit' type='submit' value='Checkout' />
												</form>
												
												<?php
												if($sa['2comode'] == '1') {
												?>
												<script src="https://www.2checkout.com/static/checkout/javascript/direct.min.js"></script>
												<?php
												}
												?>
												<b> <?php echo $a098; ?>: <?php echo $acu['ISO']; ?> <?php echo $amount;?></b></br>
												<b> <?php echo $a099; ?>: <?php echo $acu['ISO']; echo $tax; ?></b></br>
												<b> <?php echo $a099; ?>: <?php echo $twocheckout_taxpercentage; ?>%(<?php echo $acu['ISO']; echo (($amount / 100) * $twocheckout_taxpercentage);?>) + <?php echo $acu['ISO']; echo (ceil($zerothreefive*10)/10); ?></br>
												<b> <?php echo $a100; ?>: <?php echo $acu['ISO']; ?> <?php echo $totally;?></b>
											</div>
											</div>
										<?php
										}
										?>
									</div>
									<div class="col-md-4">
										<?php
										if($payza_status == '1') {
										?>
										<div class="panel panel-default">
											<div class="panel-heading">Payza</div>
											<div class="panel-body">
												<?php
												$zerothreefive = $payza_taxdollars * $currenciesrate;
												$taxpz = ((($amount / 100) * $payza_taxpercentage) + (ceil($zerothreefive*10)/10)); 
												$taxpz = number_format($taxpz, 2, '.', '');
												$totallypz = $amount + $taxpz; 
												?>
												<form method="post" action="https://secure.payza.com/checkout" >
													<input type="hidden" name="ap_merchant" value="<?php echo $payza_1; ?>"/>
													<input type="hidden" name="ap_purchasetype" value="item-goods"/>
													<input type="hidden" name="ap_itemname" value="Deposit money"/>
													<input type="hidden" name="ap_amount" value="<?php echo $amount;?>"/>
													<input type="hidden" name="ap_taxamount" value="<?php echo $taxpz;?>"/>
													<input type="hidden" name="ap_currency" value="<?php echo $acu['ISO']; ?>"/>
													<input type="hidden" name="ap_quantity" value="1"/>
													<input type="hidden" name="ap_itemcode" value="DEPOSIT"/>
													<input type="hidden" name="ap_description" value="Add money/credits to your advertisement account."/>
													<input type="hidden" name="ap_returnurl" value="<?php echo $mainurl; ?>p.Deposit"/>
													<input type="hidden" name="ap_cancelurl" value="<?php echo $mainurl; ?>p.Deposit"/>
													<input type="hidden" name="ap_alerturl" value="<?php echo $mainurl; ?>system/general/components/payment/payza/ipn.php"/>
													<input type="hidden" name="ap_ipnversion" value="2"/>
													<input type="hidden" name="apc_1" value="<?php echo"{$seeP['username']}"; ?>"/>
													<input type="hidden" name="apc_2" value="<?php echo"{$seeP['apemail']}"; ?>"/>
													<input type="hidden" name="apc_3" value="<?php echo"{$seeP['ppemail']}"; ?>"/>
													<input type="hidden" name="apc_4" value="<?php echo"{$seeP['email']}"; ?>"/>
													<input type="hidden" name="apc_5" value="<?php echo"{$seeP['country']}"; ?>"/>
													<input type="hidden" name="apc_6" value="<?php $accounttypenow = $_SESSION['acctype']; if($accounttypenow == 0){echo'publisher';} if($accounttypenow == 1){ echo'advertiser';} ?>"/>
													<input type="image" src="system/general/components/payment/payza/payzabuy.png"/>
												</form>
												<b> <?php echo $a098; ?>: <?php echo $acu['ISO']; ?> <?php echo $amount;?></b></br>
												<b> <?php echo $a099; ?>: <?php echo $acu['ISO']; echo $taxpz; ?></b></br>
												<b> <?php echo $a099; ?>: <?php echo $payza_taxpercentage; ?>%(<?php echo $acu['ISO']; echo (($amount / 100) * $payza_taxpercentage);?>) + <?php echo $acu['ISO']; echo (ceil($zerothreefive*10)/10); ?></br>
												<b> <?php echo $a100; ?>: <?php echo $acu['ISO']; ?> <?php echo $totallypz;?></b>
												</div>
										</div>
										<?php
										}if($skrill_status == '1') {
										?>
										<div class="panel panel-default">
											<div class="panel-heading">Skrill</div>
											<div class="panel-body">
												<?php 
												$zerothreefive = $skrill_taxdollars * $currenciesrate;
												$tax = ((($amount / 100) * $skrill_taxpercentage) + (ceil($zerothreefive*10)/10)); 
												$tax = number_format($tax, 2, '.', '');
												$totally = $amount + $tax; 
												?>
												<form accept-charset="UTF-8" action="https://www.moneybookers.com/app/payment.pl" id="mb_form" method="post">
												<div style="margin:0;padding:0;display:inline">
													<input name="utf8" type="hidden" value="&#x2713;" />
													<input name="authenticity_token" type="hidden" value="5qwipMIzmiGKwFqZVikW5hNS0DU0k8zVj/GXf9XGH4w=" />
												</div>
    												<input id="pay_to_email" name="pay_to_email" type="hidden" value="<?php echo $skrill_1; ?>" />
    												<input id="transaction_id" name="transaction_id" type="hidden" value="10dbe0a9951e42ad96cc67edad807a71" />
    												<input id="return_url" name="return_url" type="hidden" value="<?php echo $mainurl; ?>p.Deposit" />
    												<input id="cancel_url" name="cancel_url" type="hidden" value="<?php echo $mainurl; ?>p.Deposit" />
   												<input id="status_url" name="status_url" type="hidden" value="<?php echo $mainurl; ?>system/general/components/payment/skrill/ipn.php" />
    												<input id="amount" name="amount" type="hidden" value="<?php echo $totally;?>" />
    												<input id="amount2_description" name="amount2_description" type="hidden" value="Deposit" />
    												<input id="amount2" name="amount2" type="hidden" value="<?php echo $amount;?>" />
    												<input id="amount3_description" name="amount3_description" type="hidden" value="Tax" />
    												<input id="amount3" name="amount3" type="hidden" value="<?php echo $tax;?>" />
    												<input id="field 1" name="field1" type="hidden" value="<?php echo"{$seeP['username']}"; ?>" />
    												<input id="field 2" name="field2" type="hidden" value="<?php $accounttypenow = $_SESSION['acctype']; if($accounttypenow == 0){echo'publisher';} if($accounttypenow == 1){ echo'advertiser';} ?>" />
    												<input id="currency" name="currency" type="hidden" value="<?php echo $acu['ISO']; ?>" />
    												<input id="detail1_description" name="detail1_description" type="hidden" value="Deposit" />
    												<input id="detail1_text" name="detail1_text" type="hidden" value="<?php echo $acu['ISO']; echo $amount;?>" />
    												<input id="detail2_description" name="detail2_description" type="hidden" value="Tax" />
    												<input id="detail2_text" name="detail2_text" type="hidden" value="<?php echo $tax;?>" />
    												<input id="detail3_description" name="detail3_description" type="hidden" value="Amount total" />
    												<input id="detail3_text" name="detail3_text" type="hidden" value="<?php echo $totally;?>" />
    												<input id="recipient_description" name="recipient_description" type="hidden" value="<?php echo $title; ?>" />
    												<input class="btn btn-primary" type="submit" value="Checkout"/>
  												</form>
												<b> <?php echo $a098; ?>: <?php echo $acu['ISO']; ?> <?php echo $amount;?></b></br>
												<b> <?php echo $a099; ?>: <?php echo $acu['ISO']; echo $tax; ?></b></br>
												<b> <?php echo $a099; ?>: <?php echo $skrill_taxpercentage; ?>%(<?php echo $acu['ISO']; echo (($amount / 100) * $skrill_taxpercentage);?>) + <?php echo $acu['ISO']; echo (ceil($zerothreefive*10)/10); ?></br>
												<b> <?php echo $a100; ?>: <?php echo $acu['ISO']; ?> <?php echo $totally;?></b>
											</div>
											</div>
										<?php
										}
										?>
									</div>
									<div class="col-md-4">
										<?php
										if($g2apay_status == '1') {		
										?>
										<div class="panel panel-default">
											<div class="panel-heading">G2A Pay</div>
											<div class="panel-body">
												<?php
												$zerothreefive = $g2apay_taxdollars * $currenciesrate;
												$taxpz = ((($amount / 100) * $g2apay_taxpercentage) + (ceil($zerothreefive*10)/10)); 
												$taxpz = number_format($taxpz, 2, '.', '');
												$totallypz = $amount + $taxpz; 
												?>
												<div id="checkoutForm">
    												<script src="https://checkout.pay.g2a.com/index/checkout"
           											data-id="pay-g2a-script"
            										data-key="<?php echo $g2apay_2; ?>"
            										data-email="<?php echo"{$seeP['email']}"; ?>"
            										data-order-id="<?php $accounttypenow = $_SESSION['acctype']; if($accounttypenow == 0){echo'publisher';} if($accounttypenow == 1){ echo'advertiser';} ?>|<?php echo $taxpz;?>|<?php echo $session_username;?>"
            										data-amount="<?php echo $totallypz;?>"
            										data-currency="<?php echo $acu['ISO']; ?>"
            										data-items[][sku]="<?php echo"{$seeP['username']}"; ?>"
            										data-items[][name]="<?php echo $amount;?><?php echo $acu['ISO']; ?>"
            										data-items[][amount]="<?php echo $amount;?>"
            										data-items[][qty]="1"
            										data-items[][extra]="DEPOSIT - <?php echo $amount;?><?php echo $acu['ISO']; ?>"
            										data-items[][sku]="<?php echo"{$seeP['username']}"; ?>"
            										data-items[][name]="<?php echo $taxpz;?><?php echo $acu['ISO']; ?>"
            										data-items[][amount]="<?php echo $taxpz;?>"
            										data-items[][qty]="1"
            										data-items[][extra]="TAX - <?php echo $taxpz;?><?php echo $acu['ISO']; ?>"
            										data-url-ok="<?php echo $mainurl; ?>p.Deposit"
            										data-url-failure="<?php echo $mainurl; ?>p.Deposit">
    												</script>
												</div>
												<b> <?php echo $a098; ?>: <?php echo $acu['ISO']; ?> <?php echo $amount;?></b></br>
												<b> <?php echo $a099; ?>: <?php echo $acu['ISO']; echo $taxpz; ?></b></br>
												<b> <?php echo $a099; ?>: <?php echo $g2apay_taxpercentage; ?>%(<?php echo $acu['ISO']; echo (($amount / 100) * $g2apay_taxpercentage);?>) + <?php echo $acu['ISO']; echo (ceil($zerothreefive*10)/10); ?></br>
												<b> <?php echo $a100; ?>: <?php echo $acu['ISO']; ?> <?php echo $totallypz;?></b>
												</div>
										</div>
										<?php
										}
										?>
									</div>
<?php
}
}
else {
?>
											<div class="col-md-3">
											</div>
											<div class="col-md-6">
												<div class="panel panel-default">
													<div class="panel-heading"><?php echo $a096; ?></div>
													<div class="panel-body">
														<form action="" method="POST">
															<input type="hidden" name="csrf_token" value="<?php echo $token; ?>">
															<div class="form-group has-info">
																<input class="form-control" id="appendedPrependedInput" placeholder="1000" name="depositsub" type="text">
																<span style="font-size: 20px;" class="help-block"><?php echo $a095; ?> <?php echo $acu['ISO']; ?></span>
															</div>
															
															<input class="ios_btn_spinner btn btn-primary" type="submit" name="submit" value='<?php echo $a094; ?>'>
														</form>
													</div>
												</div>
											</div>
											<div class="col-md-3">
											</div>
<?php } ?>
								</div>
						</div>
					</div>
					</div>
				</div>
			</div>
		
		</div>
</div>

<?php
include('other_footer.php');
?>
