<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
// +----------------------------------------------------------------------+
// | PHP version 4/5                                                      |
// +----------------------------------------------------------------------+
// | This source file is a part of iScripts Multicart                     |
// +----------------------------------------------------------------------+
// | Authors: Programmer<programmer@armia.com>        		              |
// +----------------------------------------------------------------------+
// | Copyrights Armia Systems, Inc and iScripts.com © 2005                |
// | All rights reserved                                                  |
// +----------------------------------------------------------------------+
// | This script may not be distributed, sold, given away for free to     |
// | third party, or used as a part of any internet services such as      |
// | webdesign etc.                                                       |
// +----------------------------------------------------------------------+
?>
<?php
include "../includes/config.php";
include "../includes/session.php";
include "../includes/functions.php";
if (get_magic_quotes_gpc()) {
    $_POST = array_map('stripslashes_deep', $_POST);
    $_GET = array_map('stripslashes_deep', $_GET);
    $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
	$_SESSION = array_map('stripslashes_deep', $_SESSION);
}
if(isset( $_SESSION["sess_userid"]) and $_SESSION["sess_userid"]!= ""){
	$userid = $_SESSION["sess_userid"];
}
$paymentMethod="PP";

//$totaltopay = getCartTotal($userid);

if(isset($_SESSION['membership']))
{
$totaltopay=$_SESSION['membership']['plan_SubscriptionCharge'];
}else
{
header("location:chooseYourPlan.php");
exit();
}

//getting payment info
$sql = "SELECT * FROM ".$tableprefix."settings ";
$res = mysql_query($sql);
$row = mysql_fetch_array($res);
$txtPaypalEmail = $row["paypalemail"];
$txtPaypalSandbox = $row["enablepaypalsandbox"];

/*pass transaction id*/
$uique_sessionid=$userid.time().session_id();
$_SESSION['sess_unique_sessid']=$uique_sessionid;
$uique_sessionid_md5encrypted=md5($uique_sessionid);


/*****************/

if($txtPaypalSandbox == "Y"){
    //$paypalurl ="http://192.168.0.11/sudheesh/paypal.php";
	$paypalurl = "https://www.sandbox.paypal.com/cgi-bin/webscr";
	$paypalbuttonurl = "https://www.sandbox.paypal.com/en_US/i/btn/x-click-but23.gif" ;
}else{
    //$paypalurl ="http://192.168.0.11/sudheesh/paypal.php";
	$paypalurl = "https://www.paypal.com/cgi-bin/webscr";
	$paypalbuttonurl = "https://www.paypal.com/en_US/i/btn/x-click-but23.gif" ;
}

$referrer =  $_SERVER["HTTP_REFERER"];

/*display the active template*/

$active_template = displayTemplate();


include "../includes/htmltop.php";


/* Top File Name */

//include_once ("../includes/".$active_template[0]);

?>

		<body>
		<center>
		<div id="layout">
		
<?php
include_once("../includes/topheader_seller.php");
?>				
				
			<!--categories area start -->
			
<?php

//	include_once("../includes/categorylist.php");

?>			
<div align="left" class="main_body" >
				<!--main body start -->
<?php	
			
include "../includes/artisttopmenu.php";
	
?>
		<!--center content area start-->		
		
<div align="right" class="content_area">
	
	
		<!--items display area start -->
	
                <div align="left" id="items_top_area" class="page_title">
<!--				<img src="<?php //echo $active_template[3]?>/top_title_left.gif" alt="" class="items_top_area_img" /> -->
				<div align="left" id="items_top_area_ttl"><?php echo TEXT_PMNT_GTWY;?></div>
<!--				<img src="<?php //echo $active_template[3]?>/top_title_right.gif" alt="" class="items_top_area_img" /> -->
		</div>
		
		<div>&nbsp;</div>
		
		<div class="text_information" align="center"><?php echo $message?></div>
		
		<div>
		
		<table cellpadding="0" cellspacing="0" width="100%">
		

<?php

	/*$select_currency_code = "SELECT vcurrency_code FROM ".$tableprefix."currency_master WHERE vactive = 'Y'";
	$result_currency_code = mysql_query($select_currency_code) or die(mysql_error());
	$currency_row = mysql_fetch_assoc($result_currency_code);
	$currency_code = $currency_row['vcurrency_code'];*/
	
	$currency_attributes = displayCurrencyType();
	
/*-------function call to check whether cart contains digital or gift coupon products so as to hide shipping---*/

//	$hide_shipping_division = hideShipping();

/*-------function call to check whether cart contains digital or gift coupon products so as to hide shipping------*/
	
//	$check_shipping_enable = checkShippingEnable();
	
	
	//$totaltopay += $shipping_cost;
	
	
?>			


			<tr>
				<td><?php echo TEXT_WAITING;?></td>
			</tr>
			<tr>
				<td>&nbsp;</td>
			</tr>
			<tr>
				<td align="center">
					<form action="<?php echo $paypalurl;?>" method="post" name="frmPayment">
					<div style="display:none;">&nbsp;&nbsp;&nbsp;navigate </div>
					<p>
						<input type="hidden" name="cmd" value="_xclick">
						<input type="hidden" name="business" value="<?php echo $txtPaypalEmail?>">
						<input type="hidden" name="item_name" value="Membership Subscription for <?php echo SITE_NAME;?> - <?php echo $_SESSION['membership']['plan_Title']?>">
						<input type="hidden" name="item_number" value="<?php echo $uique_sessionid;?>">
						<input type="hidden" name="amount" value="<?php echo $totaltopay;?>">
						<input type="hidden" name="bn" value="armiasystems_shoppingcart_wps_us">
									
<?php 
						
						/*Shipping Settings*/
						
						echo $shipping_form;
			
?>						
			
<?php if(isset($_SESSION['session_taxrate']) && $_SESSION['session_taxrate']!='')
{
	 $taxrate=number_format($_SESSION['session_taxrate'],2,".","");
	
?>		
		            
					<input type="hidden" name="tax" value="<?php echo $taxrate;?>">
				
<?php
}
?>																							
					<input type="hidden" name="return" value="<?php echo SECURE_SITE_URL ."/sellers/success.php"; ?>">
					<input type="hidden" name="cancel_return" value="<?php echo SITE_URL ."/sellers/artistmain.php"; ?>">
					<input type="hidden" name="no_note" value="1">
					<input type="hidden" name="currency_code" value="<?php echo $currency_attributes[2]?>">
				 </p>	
				</form>
				

			
				</td>
			</tr>	
<?php
/*--------------Register a session to store the amount-------------*/
 if (function_exists('session_unregister')){
        (isset($_SESSION['SESS_pay_amount']))?session_unregister('SESS_pay_amount'):$_SESSION['SESS_pay_amount']="";
 }
 else {
     unset($_SESSION['SESS_pay_amount']);
 }
$totalpayamt= $totaltopay + $shipping_cost+$taxrate;  
$_SESSION['SESS_pay_amount']=number_format($totalpayamt,2,".","");
/*--------------Register a session to store the amount-------------*/
			 if (($paymentMethod == 'PP') )
			 {			
			 
?>			 
			
			<SCRIPT>		  
				//document.frmPayment.submit();		    
		   </SCRIPT>
		   
<?php

			}

?>		   
			
			
			
	</table>		


	</div>	
	
	
	<div align="left" class="float_clear1"></div>
				

	<div align="left" class="float_clear"><img src="images/clear.gif" alt="" width="1" height="1" /></div>		
	<!--mainbody area end -->
	<div align="left" class="float_clear"><img src="images/clear.gif" alt="" width="1" height="1" /></div>

	
				<!--main body end -->

				</div>
                				<div align="left" class="clear_float"><img src="images/clear_admin.gif" alt="" width="1" height="1" /></div>

				</div>

<?php

	include "../includes/footer.php";

?>

                        <SCRIPT>
	document.frmPayment.submit();
</SCRIPT>