############################################################################### # PROGRAM : DOPAYS # # VERSION : 2.64.87 # # AUTHOR : Dmitry Pereuda # # COPYRIGHTS : DOSWARE TEAM # # # # RELEASED BY : WDYL-WTN # ############################################################################### # All source code, images, programs, files included in this distribution # # Copyright (C)2003 DOSWARE TEAM. All Rights Reservded. # ############################################################################### # While we distribute the source code for our scripts and you are allowed to # # edit them to better suit your needs, we do not support modified code. # # Please see the license prior to changing anything. You must agree to the # # license terms before using this software package or any code contained # # herein. # ############################################################################### # Any redistribution without permission of Dmitry Pereuda (DOSWARE TEAM) is # # strictly forbidden. # ############################################################################### $data['PageName']='MERCHANT AREA (SHOPPING CART)'; $data['PageFile']='shopcart'; $requirelogin=array('generateform','viewforms'); ############################################################################### include('../config.htm'); ############################################################################### if(is_info_empty($uid)){ header("Location:{$data['Host']}/members/profile.htm"); echo('ACCESS DENIED.'); exit; } ############################################################################### if(!$_SESSION['login']){ if(in_array($post['action'], $requirelogin)||!$post['action']){ header("Location:{$data['Members']}/login.htm"); echo('ACCESS DENIED.'); exit; } } ############################################################################### if(in_array($post['action'], $requirelogin)||!empty($_SESSION['login'])){ $post=select_info($uid, $post); if(!$post['step'])$post['step']=1; $post['ShopButtons']=get_files_list($data['ShopBtnsPath']); $data['UserId']=$uid; } ############################################################################### if(!$post['action'])$post['action']='viewforms'; ############################################################################### if($post['action']=='shoppingcart'){ $data['PageName']='PLEASE SELECT PRODUCTS TO BUY'; if(!$post['member']||!get_member_id($post['member'])){ header("Location:{$data['Host']}/index.htm"); exit; }else $data['ProductsList']=select_products(get_member_id($post['member']), 0); }else if($post['action']=='generateform'){ $post['PostHtmlCode']= "\n". "
". "\n" ; if($post['status']=='crypt'){ $post['PostHtmlCode']= "\n". encrypt($post['PostHtmlCode']). "\n" ; } $post['PostHtmlCode']=htmlspecialchars($post['PostHtmlCode'], ENT_QUOTES); }else if($post['action']=='docheckoutcart'){ $post['action']='showcartitems'; if($post['dologin']&&!$_SESSION['login']){ if(!$post['username']){ $data['Error']='Your username can not be empty.'; }elseif(!$post['password']){ $data['Error']='Your password can not be empty.'; }elseif(!is_member_active($post['username'])){ $data['Error']='This username is not found, inactive or banned.'; }elseif(!is_member_found($post['username'], $post['password'])){ $data['Error']='Your have entered a wrong username or password.'; }else{ $_SESSION['uid']=get_member_id($post['username'], $post['password']); $_SESSION['login']=true; set_last_access($post['username']); $data['UserId']=$_SESSION['uid']; $uid=$_SESSION['uid']; } } if($uid){ $summ=get_shopcart_items_price(); $balance=select_balance($uid); $data['Error']=''; if($balance<$summ){ $data['Error']="You do not have enough money in your account."; }elseif($summ<=0){ $data['Error']="Total price is not valid."; }elseif(get_member_id($post['member'])==$uid){ $data["Error"]="You cannot send money to yourself."; } if(!$data['Error']){ $fees=($summ * $data['PaymentPercent']/100)+$data['PaymentFees']; transaction( $uid, get_member_id($post['member']), $summ, $fees, 0, 1, 'Shopping cart payment for '.get_member_name(get_member_id($post['member'])), '' ); $data['summ']=$summ; set_shopitems_paid(); $back['member']=get_member_username($post['member']); $back['action']='shoppingcart'; $back['payer']=$uid; $back['total']=$summ; $back['referer']=$data['Host']; if($post['unotify']) use_curl($post['unotify'], $back); $post['action']='docheckoutcart'; $_SESSION['ureturn']=$post['ureturn']; unset($_SESSION['login']); unset($_SESSION['uid']); }else{ unset($_SESSION['login']); unset($_SESSION['uid']); } } }else if($post['action']=='updatequantity') { update_shopcart_item_quantity($post['itemtochange'], $post['quantity']); $post['action']=$post['saction']; }else if($post['action']=='delitems'){ if(isset($post['selecteditems'])){ $itemstodel=split(',', $post['selecteditems']); for($i=0; $i < count($itemstodel); $i++)delete_shopcart_item($itemstodel[$i]); } $post['action']='showcartitems'; }else if($post['action']=='changequantity'){ $data['ShopItemsList']=get_shopcart_items_list($post['itemtochange']); }else if($post['action']=='showcartitems'){ if(!empty($post['selectedproducts']) && isset($post['selectedproducts'])) { $parray=split(',', $post['selectedproducts']); for($i=0; $i < count($parray); $i++)insert_shopcart_item($parray[$i], 1); } $data['ShopItemsList']=get_shopcart_items_list(); }else if($post['action']=='checkoutcart'){ $ureturn=$_SESSION['ureturn']; unset($_SESSION['ureturn']); $back['member']=get_member_username($post['member']); $back['action']='shoppingcart'; $back['payer']=$post['payer']; $back['total']=$post['total']; $back['referer']=$data['Host']; if($ureturn)use_curl($ureturn, $back); }elseif(!$_SESSION['login']){ header("Location:{$data['Host']}/index.htm"); exit; } ############################################################################### display('members'); ############################################################################### ?>