<?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
ob_start();
include "includes/config.php";
include "includes/session.php";
include "includes/functions.php";
include_once "classes/cls_user.php";
include_once "classes/cls_utils.php";
include_once "classes/cls_store.php";
if (get_magic_quotes_gpc()) {
    $_POST = array_map('stripslashes_deep', $_POST);
    $_GET = array_map('stripslashes_deep', $_GET);
    $_COOKIE = array_map('stripslashes_deep', $_COOKIE); 
} 


if(isset( $_SESSION["sess_userid"]) and $_SESSION["sess_userid"]!= ""){
	$userid = $_SESSION["sess_userid"];
}else{
	header("Location:login.php");
	exit;
}

$paymentMethod="PP";
  

//echopre($_SESSION['SELLER_PLAN_OBJ']);
    
  
$countrylist = makeCountryList();

/*display the active template*/

$active_template = displayTemplate();


$chkPaypal              = getSettingsValue('enablepaypal');
$txtPaypalEmail         = getSettingsValue('paypalemail');
$txtPaypalSandbox       = getSettingsValue('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"];

if($_SESSION['SELLER_PLAN_OBJ']->sellerPlanID!='') {
        $planObj                =   Utils::getsellerPlansByPlanId($_SESSION['SELLER_PLAN_OBJ']->sellerPlanID);
        
        if($planObj->status==SUCCESS)
        {
            $planObjVal =   $planObj->data;
            
             $planAmount = generalMethods::numberFormat($planObjVal->plan_SubscriptionCharge);
             $planName   = Utils::html_entity($planObjVal->plan_Title);
        }
        
        $totaltopay     =   $planAmount;
        
        if($totaltopay<=0)
        {
                $redirecturl    =   SITE_URL."/choosesellerplan.php";
                generalMethods::redirect($redirecturl);
        }
}else{
                $redirecturl    =   SITE_URL."/choosesellerplan.php";
                generalMethods::redirect($redirecturl);
}

$_SESSION['SESS_pay_amount']=$totaltopay;

$currency_attributes = displayCurrencyType();

include "includes/htmltop.php";

/* Top File Name */
include_once ("includes/".$active_template[0]);
$ddlCountry = $ddlCountry == ""?"US":$ddlCountry;
?>




<!--mainbody area start -->
<div class="main_body">
	<div class="container">
		<div class="row">

			
		<!--center content area start-->		
		
		<div align="left" id="item_details">
	
		
		<div class="col-sm-12 col-lg-4 col-md-4"></div>
                    <div class="col-sm-12 col-lg-4 col-md-4">
                        <div align="left" id="items_top_area">
                            <div align="center" id="items_top_area_ttl">
                                <?php echo MAKE_PAYMENT_PAYPAL; ?>
                                <div class="clear"></div>
                            </div>
                        </div>
                        <div class="<?php echo $msg_class;?>" align="center"><?php echo $message ?></div>
                        <div class="clear"></div>
                       
                            <div class="form_wrapper">
                                <div class="register_form_outer">
                                    
                                    
                                    <div class="registrationform_container">  
                                        <div class="field_wrapper formfield_row">
                            <img src="<?php echo str_replace("https://", "//", SECURE_SITE_URL); ?>/images/loading.gif" border="0"> <br><?php echo WAIT_INTERFACE_TEXT; ?>
                            <br>
                                        </div>
                                        <div class="field_wrapper formfield_row">
                                         <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 $planName?>">
						<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">							
                                                <input type="hidden" name="return" value="<?php echo SECURE_SITE_URL ."/seller_plan_payment_success.php"; ?>">
                                                <input type="hidden" name="cancel_return" value="<?php echo SITE_URL ."/failure_reg_payment.php"; ?>">
                                                <input type="hidden" name="no_note" value="1">
                                                <input type="hidden" name="currency_code" value="<?php echo $currency_attributes[2]?>">
				 </p>	
                                    </form>
                                        </div>   
                                           
                                    
                                        
                                    <div class="clear"></div>
                                </div>
                            </div>
                           

                    </div>
                    <div class="col-sm-12 col-lg-4 col-md-4"></div>

                    <div class="clear"></div>		
	
	
		<div align="left" class="float_clear1"></div>
					
					
		 <!--items display area end -->
		  </div>
		
			
		<!--center content area end-->	


		<div align="left" class="clear"></div>
                
		</div>
	</div>
</div>		
<!--mainbody area end -->
<div class="clear"></div>

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


				

<?php
include "includes/".$active_template[2];	/* Bottom File Name */
?>																
