<?php
// Include the txt-db-api main source
include "ffdb/txt-db-api.php";
$db = new Database("ffdbvcs");

function gettrad($lang, $textid) {
	$db = new Database("ffdbvcs");
	$resulttext = $db->executeQuery("SELECT ".$lang." FROM textes WHERE id = '" . $textid . "'");
	$resulttext->next();
	$datatext = $resulttext->getCurrentValuesAsHash();	
	return $datatext[$lang];
}

if (isset($_REQUEST['offer']) && isset($_REQUEST['uid'])) {
	require_once 'php5/api/AllopassAPI.php';
	$api = new AllopassAPI();
	$offer = $_REQUEST['offer'];
	$resultoffer = $db->executeQuery("SELECT * FROM vcs WHERE id = '" . $offer . "'");
	$resultoffer->next();
	$dataoffer = $resultoffer->getCurrentValuesAsHash();	
	$response = $api->prepareTransaction(array(
	 'site_id' => 291791, 
	 'pricepoint_id' => $dataoffer['pricepoint'], 
	 'product_name' => $dataoffer['credits'] . ' credits', 
	 'forward_url'=> 'http://www.psparadise.fr/allopass/success.php?country='.$dataoffer['country'].'&uid='.$_REQUEST['uid'], 
	 'notification_url'=> 'http://www.psparadise.fr/callback.php', 
	 'amount' => $dataoffer['price'], 
	 'reference_currency' => 'EUR', 
	 'data' => $_REQUEST['uid'] . "|" . $dataoffer['credits'],
	 'country' => $dataoffer['country']
	));
	$url = $response->getBuyUrl();
	header('Location: '.$url . '&forward_target=current') ;
		
}
else {
	if (!isset($_REQUEST['country'])) $_REQUEST['country'] = "FR"; 
	$resultlang = $db->executeQuery("SELECT lang FROM countries WHERE id = '" . $_REQUEST['country'] . "'");
	$resultlang->next();
	$datalang = $resultlang->getCurrentValuesAsHash();	
	$lang = $datalang['lang'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr" style="height: 100%; "><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  

  <meta http-equiv="Content-Script-Type" content="text/javascript">
  <meta http-equiv="Content-Style-Type" content="text/css">
  <meta http-equiv="Content-Language" content="fr">
  

  <meta name="category" content="Business,Financial Services,Merchant Services,Other Payment Systems,Micropayments">
  <meta name="keywords" content="Allopass, micropaiement, audiotel, securisÃƒÂ©, carte bancaire, code, ticket, accÃƒÂ¨s, tÃƒÂ©lÃƒÂ©phone, surtaxÃƒÂ©, sms, audiotex, rentabiliser, rÃƒÂ©gie, publicitÃƒÂ©, accÃƒÂ¨s payant, micro, paiement, webmaster, argent, gain, affiliation, marque blanche, parrainage, parrain, filleul, banniÃƒÂ¨re, pub">
  <meta name="description" content="La solution de micro paiement sÃƒÂ©curisÃƒÂ©e Allopass est leader sur le marchÃƒÂ© europÃƒÂ©en. Allopass est une plateforme de micro paiement par tÃƒÂ©lÃƒÂ©phone, sms et carte bancaire facile ÃƒÂ  installer et qui vous permet de rentabiliser rapidement  votre site : codes accÃƒÂ¨s, affiliation, parrainage, sponsoring, publicitÃƒÂ© ...">

  <meta name="revisit-after" content="15 days">
  <meta name="robots" content="index,follow">

  <title>Solutions s&eacute;curis&eacute;es de paiement et micro paiement sur Internet par le leader europ&eacute;en : Allopass</title>

  <link rel="stylesheet" type="text/css" media="all" href="./vcs_files/base.css">
  <link rel="stylesheet" type="text/css" media="all" href="./vcs_files/virtual.css">
  <link rel="shortcut icon" type="image/x-icon" href="https://payment.allopass.com/static/favicon.ico">

      <script type="text/javascript" src="./vcs_files/jquery-1.3.2.min.js"></script>
    <script type="text/javascript" src="./vcs_files/general.js"></script>
    <script type="text/javascript" src="./vcs_files/general(1).js"></script>
  </head>
<body style="height: 100%; ">

<!--[if    IE]><div class="iexplore"><![endif]-->
<!--[if    IE 7]><div class="iexplore7"><![endif]-->
<!--[if lt IE 7]><div class="iexplore6"><![endif]-->

    <div id="page" style="height: 769px; ">
  
      <h1><strong><?php echo gettrad($lang, 'buy'); ?> Credits</strong></h1>
    <p id="secure-payment"><?php echo gettrad($lang, 'secure'); ?></p>

  <div id="content">
    
    <div id="virtual-banner">&nbsp;</div>

       <div id="worldwide" style="width: 303px;">
  <div class="layout">
    <span class="country" style="width: 145px;">
    <?php 
    	$resultcountry = $db->executeQuery("SELECT description FROM countries WHERE id = '" . $_REQUEST['country'] . "'");
		$resultcountry->next();
		$datacountry = $resultcountry->getCurrentValuesAsHash();	
		
    ?>
      <img src="./vcs_files/<?php echo strtolower($_REQUEST['country']); ?>.png" alt="<?php echo $datacountry['description']; ?>" height="24" width="24"></img> <?php echo $datacountry['description']; ?>
    </span>
    <span class="separator">&nbsp;</span>
    <div id="country-more" style="width:235px;"><a class="more" href="#" onclick="javascript: document.getElementById('country-selector').style.display='block'; document.getElementById('country-more').style.display='none';"><?php echo gettrad($lang, 'choosec'); ?></a></div>
    <div id="country-selector" style="display:none; width:235px;">
    	<select style="margin-right: 5px;" name="newcountry">
    		<option value="index.php?country=FR&uid=<?php echo $_REQUEST['uid']?>" <?php echo ($_REQUEST['country'] == 'FR') ? 'selected="selected"':''; ?>>France</option>
    		<option value="index.php?country=BE&uid=<?php echo $_REQUEST['uid']?>" <?php echo ($_REQUEST['country'] == 'BE') ? 'selected="selected"':''; ?>>Belgique (BelgiÃ«)</option>
    		<option value="index.php?country=CA&uid=<?php echo $_REQUEST['uid']?>" <?php echo ($_REQUEST['country'] == 'CA') ? 'selected="selected"':''; ?>>Canada</option>
    		<option value="index.php?country=ES&uid=<?php echo $_REQUEST['uid']?>" <?php echo ($_REQUEST['country'] == 'ES') ? 'selected="selected"':''; ?>>EspaÃ±a</option>
    		<option value="index.php?country=ZZ&uid=<?php echo $_REQUEST['uid']?>" <?php echo ($_REQUEST['country'] == 'ZZ') ? 'selected="selected"':''; ?>>France Outre-mer</option>
    		<option value="index.php?country=RO&uid=<?php echo $_REQUEST['uid']?>" <?php echo ($_REQUEST['country'] == 'RO') ? 'selected="selected"':''; ?>>RomÃ¢nia</option>
    		<option value="index.php?country=CH&uid=<?php echo $_REQUEST['uid']?>" <?php echo ($_REQUEST['country'] == 'CH') ? 'selected="selected"':''; ?>>Suisse</option>
    		<option value="index.php?country=MA&uid=<?php echo $_REQUEST['uid']?>" <?php echo ($_REQUEST['country'] == 'MA') ? 'selected="selected"':''; ?>>Ø§Ù„Ù…Ù…Ù„ÙƒØ© Ø§Ù„Ù…ØºØ±Ø¨ÙŠØ©</option>
    	</select>
    </div>
  </div>
</div> 
   
<?php 
if (isset($_REQUEST['method']) && isset($_REQUEST['country'])) {	
	$method = $_REQUEST['method'];
	$country = $_REQUEST['country'];
	$result = $db->executeQuery("SELECT * FROM vcs WHERE country = '" . $country . "' AND method = '" . $method . "' ORDER BY credits DESC");
	$data = $result->getCurrentValuesAsHash();
	
	if ($result->getRowCount() == 0) {
		print "<center><i>No Data</i></center><br>";
	} else {
	?>   
		
		 <div class="clearer"></div>
		<form class="formLayout" id="payment-virtual" method="post" action="index.php?uid=<?php echo $_REQUEST['uid']?>">
		<div id="virtual-title"><?php echo "<img src='vcs_files/images/" . $method . "2.png'></img><br/>"; ?><?php echo gettrad($lang, 'offer'); ?></div>
		<div class="clearer"></div>
		<div class="offers-table">
	
	<?php 
		
		print "<table class='offers-list' style='width:200px;'>";
		while ($result->next()) {
			print "<tr>";
			$data = $result->getCurrentValuesAsHash();
			print "<td><input class='radioButton' id='offer' name='offer' type='radio' value='" . $data['id'] . "'></td>";
			print "<td>" . $data['credits'] . " Credits ". gettrad($lang, 'for') . " " . $data['price'] . " " . $data['currency'] . "</td>"; 
			print "</tr>";
		}
		print "</table>";

		print "<br>";	
	}
	?>
	</div>
	<div class="clearer">&nbsp;</div>
	<div class="formSubmit">
		<a href="javascript: history.go(-1)"><button type="button" class="active" title="Retour"><span><?php echo gettrad($lang, 'return'); ?></span></button></a>
		<button type="submit" class="active" title="Suivant"><span><?php echo gettrad($lang, 'next'); ?></span></button>
	</div>
	</form>
	<?php 
}
else if (isset($_REQUEST['country'])){
	$country = $_REQUEST['country'];
	$result = $db->executeQuery("SELECT DISTINCT method FROM vcs WHERE country = '" . $country . "'");
	$data = $result->getCurrentValuesAsHash();	
	if ($result->getRowCount() == 0) {
		print "<center><i>No Data</i></center><br>";
	} else {
?>   
		
		 <div class="clearer"></div>
		<div id="virtual-title"><?php echo gettrad($lang, 'method'); ?></div>
		<div class="clearer"></div>
		<div id="virtual-methods">
		<ul>
		
		<?php 
				
		while ($result->next()) {
			$data = $result->getCurrentValuesAsHash();
			$resultmethod = $db->executeQuery("SELECT ".$lang." FROM methods WHERE id = '" . $data['method'] . "'");
			$resultmethod->next();
			$datamethods = $resultmethod->getCurrentValuesAsHash();	
			print "<li><a href='index.php?country=".$country."&method=" . $data['method'] . "&uid=".$_REQUEST['uid']."' border=0><img src='vcs_files/images/" . $data['method'] . ".png'></a><span class='method-name'>" . $datamethods[$lang] . "</span></li>";
		}
		?>
                  </ul>
                    
		</div>
		</div>
		<div class="clearer"></div>
		<div style="text-align: center;">
			<?php if (isset($_REQUEST['uid'])) {?>
			<iframe frameborder="0" src="https://payment.allopass.com/virtual/virtual.apu?ids=291791&idd=1226690&user_id=<?php echo $_REQUEST['uid']; ?>&country=FR&type=sponsorpay" width="900" height="800"></iframe>
			<?php } ?>
		</div>
		<?php 
	}
}
else {
	$result = $db->executeQuery("SELECT DISTINCT country FROM vcs");
	$data = $result->getCurrentValuesAsHash();	
	if ($result->getRowCount() == 0) {
		print "<center><i>No Data</i></center><br>";
	} else {
		print "<table border=\"0\" style=\"width: 540px;\">";
		while ($result->next()) {
			print "<tr>";
			$data = $result->getCurrentValuesAsHash();
			print "<td><a href='index.php?country=".$data['country'] . "&uid=".$_REQUEST['uid']."'>" . $data['country'] . "</a></td>";
			print "</tr>";
		}
		print "</table>";

		print "<br>";	
	}
}
?>
	


<div id="bottom-link">
            
    <?php echo gettrad($lang, 'customer'); ?> <a id="support-link" href="https://payment.allopass.com/error/complain.apu?ids=290439&idd=1218163&lang=fr"><?php echo gettrad($lang, 'contact'); ?></a>        
        <a href="https://payment.allopass.com/cgp.apu?country=<?php echo $_REQUEST['country']; ?>" target="_blank" class="tos-link"><?php echo gettrad($lang, 'cgu'); ?></a>
 <?php if (isset($_REQUEST['method'])) { ?>
    	<div id="plan-backward">
        	<a href="javascript: history.go(-1)"><?php echo gettrad($lang, 'return'); ?></a>
      	</div>
<?php } ?>
    </div>

  
<div id="copyright">
    <p>
      Service édité par Allopass Copyright © 2012 Allopass Inc.
      Tous droits réservés.    </p>
</div> </div>


<!--[if    IE 7]></div><![endif]-->
<!--[if lt IE 7]></div><![endif]-->
<!--[if IE]></div><![endif]-->

</body></html>
<?php } ?>