<?php 
/*
##################################################################
#                       PHP 4&5 MySQL 4&5                        #
##################################################################
#           Copyright (c) 2004-2008 Armia Systems Inc            #
##################################################################
#               This file is part of Cybermatch site             #
##################################################################
#    Developed By: simi (simi@armia.com)                         #

##################################################################
#               Developed On:   03-04-2008                       #
##################################################################
#               Modified By:                                     #
##################################################################
#               Modified On:                                     #
##################################################################
# 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.                                         #
##################################################################
*/

require_once ("config.inc.php");
require_once ("includes/userlogincheck.inc.php");
require_once ("includes/mysql.inc.php");
require_once ("classes/misc.class.php");
require_once ("classes/userside.class.php");
require_once ("classes/settings.class.php");

$message	= "";
$script		= "";
$mail		= "";
$product	= isset($_REQUEST['product'])	?	trim($_REQUEST['product'])	:	"0";

if (!$objDB) {
	$message	= "Unable to Locate Database Server.";
} else {
	$objM		= new misc($objDB);
	$objU		= new userside($objDB);	
	$script		= $objM->get_script($message);
	$message	= $objM->remove_script($message);
}

if(isset($_SESSION['sess_buy_credits']) && $_SESSION['sess_buy_credits']!='')
{
	//update table with purchase credits 
	mysql_query("update ".TABLEPREFIX."user set nCredits=nCredits+'".$_SESSION['sess_buy_credits']."' where 
						nUser_Id='".$_SESSION['user_id']."'") or die(mysql_error());
						
	$title='Buy Credits Process Completed';
        $settObj = new settings($objDB);        
        $arrSettings	= $settObj->select();        
        $totalAmount=$arrSettings['credit_value']*$_SESSION['sess_buy_credits'];
	
	$echoMesg='You have successfully purchased '.$_SESSION['sess_buy_credits'].' credits by paying an amount of $'.$totalAmount.'.';
	//clear session value
	unset($_SESSION['sess_buy_credits']);
	unset($_SESSION['sess_Paymode']);
	unset($_SESSION['sess_TransId']);
	unset($_SESSION['sess_product']);
}//end if
else
{
	$title='Subscription Process Completed';
	$echoMesg='You have successfully subscribed '.stripslashes($objU->get_product($product)).' by paying an amount of 
							$'.$objU->get_product_amount($product).'.';
}//end else
include_once ("title.inc.php");
include_once ("tophtml.inc.php");
?>
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="72%" valign="top"><div class="search-rslts"><table width="100%"  border="0" cellspacing="0" cellpadding="5">
          <tr>
            <td>              <table width="100%"  border="0" cellspacing="0" cellpadding="5">
              <tr>
                   <td width="100%" class="inenr-hd"><h2><?php echo $title;?></h2></td>
             
              </tr>
            </table>
				<table width="100%"  border="0" cellspacing="0" cellpadding="10">
                <tr>
                  <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="headings2">Success</td>
                    </tr>
                  </table>
                    <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td><img src="images/spacer.gif" width="1" height="10"></td>
                      </tr>
                    </table>
					<form name="frmTell" method="post" action="<?php echo $_SERVER['PHP_SELF']?>" onSubmit="return validate();">
                    <table width="100%"  border="0" cellspacing="0" cellpadding="5">
					<?php if(isset($message) && trim($message)!='')
					      {
					?>
                    <tr align="center">
                      <td class="maintext1 warning"><?php echo $message;?></td>
                      </tr>
					<?php }//end if?>
                    <tr>
                      <td width="54%" class="maintext1"><?php echo $echoMesg;?></td>
                      </tr>
                  </table>
					</form>
                    </td>
                </tr>
              </table>
              <div id="hide"><?php echo $script?></div>
			</td>
          </tr>
        </table></div></td>
        <td width="28%" valign="top"><?php include_once ("left.inc.php");?></td>
      </tr>
    </table>      
      </td>
  </tr>
</table>
<?php include_once('bottomhtml.inc.php');?>
