File: /home/durgeshpandey215/public_html/zeeroprice.skilladders.com/buy.php
<?
require "application_top.php";
$pid = isset($_REQUEST['pid'])? $_REQUEST['pid']:"";
if($pid){
$db->where('id',1);
$rowu = $db->getOne('wallet_user');
$db->where('pid',$pid);
$rowp = $db->getOne('wallet_products');
if($rowu['points'] < $rowp['cost']){
$_SESSION['msg'] = "Low wallet balance. Please add sufficient amount in your wallet";
header("location:products-and-prices.php");exit;
}
$walletbalance = $rowu['points'] - $rowp['cost'];
$updatearr = array('points'=>$walletbalance);
$db->where('id',1);
$db->update('wallet_user',$updatearr);
$_SESSION['ViewProductSess'] = 1;
header("location:productdetails.php?pid=".$pid); exit;
}
?>