function del($id) { global $_USERS; $sendorders = $this->getone($id, "uname,oids,couponid,freight,serverfee,customsfee,totalfee,state"); if (is_array($sendorders)) { if ($sendorders['state'] != 1) { return lang('Not_allowcancel_sendorder'); } if ($_USERS['uname'] != $sendorders['uname']) { return lang('Permissions_not'); } include_once INC_PATH . "/member.class.php"; $m = new memberclass(); $tempmoney = $sendorders['totalfee']; $note = lang('cancel_sendorder_id') . $id; $m->moneyedit($sendorders['uname'], $tempmoney, 3, $note); $wheresqlo = "oid in(" . $sendorders['oids'] . ")"; editstate($this->tablepre . "order", "state", $wheresqlo, 4); //更改订单状态操作 editstate($this->tablepre . "order", "sid", $wheresqlo, 0); //更改订单对应运单ID操作 if (GetNum($sendorders['couponid'])) { editstate($this->tablepre . "coupon", "state", "cid = " . GetNum($sendorders['couponid']), 1); //更改优惠卷状态操作 } } else { return lang('sendOrderID_notexist'); } $dataarray = array('state' => 4); return $this->edit($id, $dataarray); //return $this->table_sendorder->del($id); }
function del($id) { global $_USERS; $goods = $this->getone($id, "uname,goodsnum,goodsprice,goodsurl,goodsname,sendprice,type,goodsseller,goodssite,state"); if (is_array($goods)) { if ($goods['state'] != 1 && $goods['state'] != 6) { return lang('Not_allowcancel_order'); } if ($_USERS['uname'] != $goods['uname']) { return lang('Permissions_not'); } //type=1时候表示是代购商品需要返还用户付款额度 if ($goods['type'] == 1 || $goods['type'] == 2) { include_once INC_PATH . "/member.class.php"; $m = new memberclass(); $countnum = $this->getcount("uname='" . $goods['uname'] . "' and goodsseller='" . $goods['goodsseller'] . "' and (state=1 or state=6)"); if ($countnum > 1) { //只退还账户余额] $tempmoney = $goods['goodsprice'] * $goods['goodsnum']; $note = lang('cancel_order') . "<a href=\\'" . $goods['goodsurl'] . "\\' target=\\'_blank\\'>《" . $goods['goodsname'] . "》</a>" . lang('order_id') . $id; $m->moneyedit($goods['uname'], $tempmoney, 4, $note); } elseif ($countnum = 1) { //退还账户余额和运费 $tempmoney = $goods['goodsprice'] * $goods['goodsnum'] + $goods['sendprice']; $note = lang('cancel_order') . "<a href=\\'" . $goods['goodsurl'] . "\\' target=\\'_blank\\'>《" . $goods['goodsname'] . "》" . lang('And_freight') . $goods['sendprice'] . "</a>" . lang('order_id') . $id; $m->moneyedit($goods['uname'], $tempmoney, 4, $note); } //else{ //退还账户余额和运费 // $tempmoney=$goods['goodsprice']*$goods['goodsnum']+$goods['sendprice']; // $note="取消订单<a href=\'".$goods['goodsurl']."\' target=\'_blank\'>《".$goods['goodsname']."》和运费:".$goods['sendprice']."</a>订单ID:".$id; // $m->moneyedit($goods['uname'],$tempmoney,4,$note); //} } } else { return lang('OrderID_notexist'); } return $this->table_order->del($id); }
/** * 付款成功充值到账户 * * @param unknown_type $sn * @return 'OK' */ function paysuccess($sn, $money) { $sn = GetNum($sn); $row = $this->getonebysn($sn, $field = "rid,uname,state,money,payname"); if (!is_array($row)) { return lang('Renumber_notexist'); } if ($row['state'] == 2) { return lang('been_recharge'); } //更新状态 $dataarray = array('money' => $money, 'successtime' => time(), 'state' => 2); $this->rechargerecord->edit($row['rid'], $dataarray); include_once INC_PATH . "/member.class.php"; $m = new memberclass(); $note = $row['payname'] . $money . lang('yuan') . lang('Serial_number') . $sn; $m->moneyedit($row['uname'], $money, 9, $note); return 'OK'; }
} elseif ($action == "changestate" && !empty($aid)) { //更改状态 $aid = GetNum($aid); $wheresqlarr = "aid ={$aid}"; editstate($Table->table, "state", $wheresqlarr, 1); //更改状态操作 showmsg("修改状态成功!", "-1"); //成功提示! } elseif ($action == "chargeback" && !empty($aid)) { //更改状态 $aid = GetNum($aid); $wheresqlarr = "aid ={$aid}"; $row = $Table->getone($aid); $umoney = DB::result_first("Select money From `{$Table->table}` where uname like '{$row['uname']}' "); if ($umoney < $row['money']) { showmsg("用户帐户余额不足!扣费失败!", "-1"); } //成功提示! include_once INC_PATH . "/member.class.php"; $m = new memberclass(); $note = $row['name'] . ' 账户:' . $row['account'] . '充值扣费' . $row['money'] . "服务订单ID:" . $row['aid']; $m->moneyedit($row['uname'], -$row['money'], 0, $note); //扣去账户余额 editstate($Table->table, "state", $wheresqlarr, 2); //更改状态操作 showmsg("修改状态并且扣费成功!", "-1"); //成功提示! } else { showmsg("未知请求", "-1"); //出错! }
<?php session_start(); //购物车相关ajax数据处理 include "../common.inc.php"; InitGP(array("action", "remark", "gid", "num", "gids", "cityid")); //初始化变量全局返回 include INC_PATH . "/member.class.php"; $m = new memberclass(); AjaxHead(); if ($action == 'checkemail') { $jsondata = json_decode(str_replace("'", '"', file_get_contents('php://input'))); $email = $jsondata->email; $info = $m->checkemail($email, true); echo json_encode($info); exit; } else { if ($action == 'checkuname') { $jsondata = json_decode(str_replace("'", '"', file_get_contents('php://input'))); $username = $jsondata->username; $info = $m->checkuname($username, true); echo json_encode($info); exit; } elseif ($action == 'checkcode') { InitGP(array("code")); //初始化变量全局返回 include INC_PATH . "/code/securimage.php"; $img = new Securimage(); $valid = $img->check($code); if ($valid != true) { exit('0');
include_once INC_PATH . "/member.class.php"; $m = new memberclass(); $note = "调整商品<a href=\\'" . $goodsurl . "\\' target=\\'_blank\\'>《" . $goodsname . "》</a>价格:" . -$tempmoney . "订单ID:" . $oid; $m->moneyedit($uname, $tempmoney, 5, $note); //扣去账户余额 } if ($sendprice != $oldsendprice) { //商品运费调整 $tempmoney = 0; $tempmoney = GetNum($oldsendprice - $sendprice); //计算运费调整 $wheresqlarr = "uname = '" . $uname . "' and goodsseller = '" . $goodsseller . "' and state < 3"; editstate($Table->table, "sendprice", $wheresqlarr, $sendprice); //更改状态操作 include_once INC_PATH . "/member.class.php"; $m = new memberclass(); $note = "调整商品<a href=\\'" . $goodsurl . "\\' target=\\'_blank\\'>《" . $goodsname . "》</a>运费:" . -$tempmoney . "订单ID:" . $oid; $m->moneyedit($uname, $tempmoney, 5, $note); //扣去账户余额 } $arrayedit = array("goodsurl" => $goodsurl, "goodsname" => Char_cv($goodsname), "goodsprice" => GetNum($goodsprice), "sendprice" => GetNum($sendprice), "goodsnum" => GetNum($goodsnum), "goodssize" => Char_cv($goodssize), "goodscolor" => Char_cv($goodscolor), "goodsseller" => Char_cv($goodsseller), "goodsremark" => Char_cv($goodsremark), "orderremark" => Char_cv($orderremark), "sellerurl" => $sellerurl, "expressno" => $expressno, "orderweight" => GetNum($orderweight), "state" => GetNum($state), "payid" => Char_cv($payid), "uptime" => time()); $info = $Table->edit($oid, $arrayedit); if ($info == "OK") { exit("<script language='javascript'>alert('编辑成功');parent.parent.\$.fn.colorbox.close();</script>"); } else { exit("<script language='javascript'>alert('编辑失败');parent.location.reload();</script>"); } } else { $evalue = $Table->getone($oid); //print_r($evalue); include "tpl/order_edit.htm";
$info = $m->edit($uname, "", "", $password); if ($info == "OK") { include template('resetp_ok'); //包含输出修改密码成功 exit; } else { print "<script language='javascript'>alert('修改密码失败!请重试');history.go(-1);</script>"; exit; } } if (empty($uname) || empty($activekey) || empty($email)) { print "<script language='javascript'>alert('链接已过期!');</script>"; jumpurl(url("index.php")); } else { include template('resetp_newpass'); //包含输出指定模板 } } else { print "<script language='javascript'>alert('链接缺少参数!');</script>"; jumpurl(url("index.php")); } } elseif ($action == 'quit') { //退出登录 //处理登录操作 include INC_PATH . "/member.class.php"; $m = new memberclass(); $msg = $m->quit(); print "<script language='javascript'>alert('退出成功!');</script>" . $m->ucsynlogin; jumpurl(url("index.php")); //showmessage("退出成功!".$m->ucsynlogin,"index.php",1); }
<?php //我的劵 InitGP(array("action", "commit", "email", "username", "oldpassword", "password", "password2", "mobile")); //初始化变量全局返回 if (!empty($commit)) { //处理更新用户资料操作 if ($password != $password2) { showmessage(lang('two_pass_noCorrect'), "-1", false); } $editarray = array("tel" => GetNum($mobile)); include "includes/member.class.php"; $m = new memberclass(); $msg = $m->edit($username, $email, $oldpassword, $password, $editarray); if ($msg == "OK") { showmessage(lang('Success_mod'), "login.php", true); } else { showmessage($msg, "-1", false); } } else { //显示资料修改表单 /** * 输出测试部分开始 print_r($_USERS); */ /** * 输出测试部分结束 */ include template('member_settings');
<?php //我的劵 InitGP(array("action", "mid", "page")); //初始化变量全局返回 include_once INC_PATH . "/member.class.php"; $m = new memberclass(); AjaxHead(); //禁止页面缓存 header("Content-type: text/html; charset=" . CHARSET); if (empty($action)) { $value = $m->getone($_USERS['uname']); } elseif ($action == 'save') { InitGP(array("tname", "sex", "tel", "zip", "address", "qq", "msn", "country", "city", "oldface", "commit")); //初始化变量全局返回 if (!empty($commit)) { //上传图片处理 require_once INC_PATH . '/upload.class.php'; $f = new Upload('attachment/avatar', array('gif', 'jpg', 'jpge', 'png'), 50000); //路径 允许扩展名 文件尺寸 $f->setThumb(0); //设置不生成缩微图 $f->run('faceimg', 1); $info = $f->getInfo(); $imgdata = $info[0]['fullsavename']; //获取第一个上传图片反馈 if (isset($info[0]['error'])) { $imgdata = $oldface; } $editarray = array("tname" => Char_cv($tname), "sex" => GetNum($sex), "tel" => GetNum($tel), "zip" => Char_cv($zip), "address" => Char_cv($address), "qq" => GetNum($qq), "msn" => Char_cv($msn), "country" => Char_cv($country), "face" => $imgdata, "city" => Char_cv($city)); $msg = $m->edit($_USERS['uname'], '', $_USERS['password'], '', $editarray);
if ($totalfee > $_USERS['money']) { print "<script language='javascript'>alert('账户余额不足!请充值后重新操作!');</script>"; jumpurl(url('m.php?name=orderlist')); } $totalfee = sprintf("%01.2f", $totalfee); $freight = sprintf("%01.2f", $freight); $serverfee = sprintf("%01.2f", $serverfee); $deliveryrow['customs_fee'] = sprintf("%01.2f", $deliveryrow['customs_fee']); $addarray = array('uid' => $_USERS['uid'], 'uname' => $_USERS['uname'], 'email' => $_USERS['email'], 'oids' => $oids, 'couponid' => GetNum($couponid), 'freight' => GetNum($freight), 'serverfee' => $serverfee, 'customsfee' => $deliveryrow['customs_fee'], 'totalfee' => $totalfee, 'countmoney' => $countmoney, 'countweight' => $countweight, 'consignee' => $consignee, 'country' => $country, 'city' => $city, 'zip' => $zip, 'tel' => $tel, 'address' => $address, 'remark' => $remark, 'did' => $did, 'deliveryname' => $deliveryrow['deliveryname'], 'areaname' => $deliveryrow['areaname'], 'addtime' => time(), 'uptime' => time(), 'state' => 1); include_once INC_PATH . "/sendorder.class.php"; $sendorderobj = SendOrderClass::init(); $sid = $sendorderobj->add($addarray); if (GetNum($sid)) { //提交成功,处理扣费和修改订单状态 include_once INC_PATH . "/member.class.php"; $m = new memberclass(); $note = "提交运单,运单ID:" . $sid; $m->moneyedit($_USERS['uname'], -$totalfee, 3, $note); //扣费操作 editstate($tablepre . "order", "state", $wheresqlo, 5); //更改订单状态操作 editstate($tablepre . "order", "sid", $wheresqlo, $sid); //更改订单对应运单ID操作 if (GetNum($couponid)) { editstate($tablepre . "coupon", "state", "cid = " . GetNum($couponid), 3); //更改优惠卷状态操作 } //显示成功页面 include template('member_tosendorderok'); //包含输出指定模板 } else {
if (empty($action)) { InitGP(array("uid", "sn", "uname", "money", "paytype", "payname", "remark")); //初始化变量全局返回 if (!empty($_POST) and !empty($uname)) { $uid = DB::result_first("select uid from " . DB::table('users') . " where uname = '{$uname}'"); //查询uid $uid = GetNum($uid); if ($uid == 0) { showmsg("用户名不存在!", "-1"); } //出错! $arrayadd = array("uid" => $uid, "uname" => Char_cv($uname), "sn" => GetNum($sn), "money" => GetNum($money), "paytype" => GetNum($paytype), "payname" => Char_cv($payname), "remark" => Char_cv($remark), "addtime" => $timestamp, "successtime" => $timestamp, "state" => 2); $info = $Table->add($arrayadd); if (GetNum($info)) { include_once INC_PATH . "/member.class.php"; $m = new memberclass(); if ($m->moneyedit($uname, $money, "后台转账充值")) { showmsg("充值成功!", PHP_SELF); //出错! exit("<script language='javascript'>alert('编辑成功');parent.parent.\$.fn.colorbox.close();</script>"); } else { $Table->del($info); showmsg("充值失败!", "-1"); //出错! } } else { showmsg("充值失败!", "-1"); //出错! exit("<script language='javascript'>alert('编辑失败');parent.location.reload();</script>"); } } else {
$arrayadd = $value; unset($arrayadd['oid']); unset($arrayadd['sid']); $arrayadd['uid'] = $_USERS['uid']; $arrayadd['uname'] = $_USERS['uname']; $arrayadd['goodsnum'] = GetNum($pieceNum); $arrayadd['type'] = 2; $arrayadd['goodsremark'] = Char_cv(pieceRemark); $arrayadd['addtime'] = time(); $arrayadd['uptime'] = time(); $arrayadd['state'] = 1; $arrayadd['pinoid'] = GetNum($oid); $info = $Table->add($arrayadd); if (GetNum($info)) { include_once INC_PATH . "/member.class.php"; $m = new memberclass(); $note = lang('Buy') . "<a href=\\'" . $value['goodsurl'] . "\\' target=\\'_blank\\'>《" . $value['goodsname'] . "》</a> " . GetNum($pieceNum) . lang('Pieces_order_ID') . $info; $tempmoney = $value['goodsprice'] * GetNum($pieceNum); $m->moneyedit($_USERS['uname'], -$tempmoney, 1, $note); //扣去账户余额 addfield("order", "pinnum", "oid={$oid}", 1); //更改状态操作 showmsg(lang('fight_sucess'), PHP_SELF); //出错! } else { showmsg(lang('fight_lose'), "-1"); //出错! } } //utf-8过滤用于搜索的字符串 function FilterSearch($keyword)
/** * 优惠卷易主 * * @param unknown_type $sn * @param unknown_type $uname * @return OK */ function buycoupon($sn, $uname) { $uname = Char_cv($uname); $sn = Char_cv($sn); $urow = DB::fetch_first("select uid,money from " . $this->tablepre . "users where uname='" . $uname . "'"); if (empty($urow['uid']) || empty($uname)) { return lang('user_cantempty'); } $row = DB::fetch_first("select cid,state,getway,sellmoney,uname from " . $this->table_coupon->table . " where sn='" . $sn . "'"); if ($row['sellmoney'] > GetNum($urow['money'])) { return lang('Insuff_accountbalance'); } if ($row['uname'] == $uname) { return lang('notbuy_owncoupons'); } if (is_array($row) && $row['state'] == 2 && $row['getway'] == 1 && GetNum($row['sellmoney'])) { $dataarray = array('uid' => $urow['uid'], 'uname' => $uname, 'state' => 1); include_once INC_PATH . "/member.class.php"; $m = new memberclass(); $note = lang('buy_coupon') . $sn . lang('Spend') . $row['sellmoney'] . lang('yuan'); $note = lang('sell_coupon') . $sn . lang('Earn') . $row['sellmoney'] . lang('yuan'); $m->moneyedit($uname, -$row['sellmoney'], $note); $m->moneyedit($row['uname'], $row['sellmoney'], $note); return $this->table_coupon->edit($row['cid'], $dataarray); } else { return lang('Coupon_notactivated'); } }
exit(json_encode(lang('update_failed'))); } if ($sendorders['state'] == 3 || $sendorders['state'] == 4) { exit(json_encode(lang('update_failed'))); } editstate($o->table_sendorder->table, "state", $wheresqlarr, 3); //更改状态操作 if (!empty($sendorders['totalfee'])) { //增加用户积分,后台设置的有就用后台的设置,没有就用购买商品价值 if (!empty($cfg_sendorder_score)) { $tempscore = $cfg_sendorder_score; } else { $tempscore = $sendorders['totalfee']; } include_once INC_PATH . "/member.class.php"; $m = new memberclass(); $tempscore = $sendorders['totalfee']; $note = lang('sendorder_success_point') . $tempscore . lang('sendorderID') . $tempid; $m->scoreedit($sendorders['uname'], $tempscore, $note); } exit(json_encode('OK')); } else { exit(json_encode(lang('update_failed'))); } } elseif ($action == 'upcomment') { $jsondata = json_decode(str_replace("'", '"', file_get_contents('php://input'))); if (!empty($jsondata->comment) && !empty($jsondata->sid)) { $tempcomment = Char_cv($jsondata->comment); $tempsid = GetNum($jsondata->sid); $wheresqlarr = "uname='" . $_USERS['uname'] . "' and sid=" . $tempsid; editstate($o->table_sendorder->table, "comment", $wheresqlarr, $tempcomment);
<?php session_start(); //修改邮箱 InitGP(array("action", "mid", "page")); //初始化变量全局返回 include_once INC_PATH . "/member.class.php"; $m = new memberclass(); AjaxHead(); //禁止页面缓存 header("Content-type: text/html; charset=" . CHARSET); if (empty($action)) { $value = $m->getone($_USERS['uname']); } elseif ($action == 'save') { InitGP(array("passwordTxt", "newEmailTxt", "regEmailTxt", "regCodeTxt", "commit")); //初始化变量全局返回 if (!empty($_POST)) { $passwordTxt = Char_cv($passwordTxt); if (isemail($newEmailTxt) and md5($passwordTxt) == $_USERS['password']) { $msg = $m->edit($_USERS['uname'], $newEmailTxt, $_USERS['password'], ''); if ($msg == "OK") { print "<script language='javascript'>alert(" . lang('update_success') . ");</script>"; jumpurl(url('m.php?name=edituserinfo')); exit; } else { print "<script language='javascript'>alert(" . lang('update_lose') . ");</script>"; jumpurl(url('m.php?name=edituserinfo')); exit; } } else { print "<script language='javascript'>alert(" . lang('update_lose') . ");</script>";
} //空选择 //执行删除多个操作 $delids = explode('|', $delids); foreach ($delids as $id) { if (GetNum($id)) { $info = $Table->del($id); } } if ($info == "OK") { exit("1"); } } elseif ($action == "audit" && !empty($gid)) { //推荐送积分 $gid = GetNum($gid); $arrayadd = array("Audit" => 1); $info = $Table->edit($gid, $arrayadd); if ($info == "OK") { showmsg("更新成功!", "goods_list.php"); //出错! } else { showmsg("更新失败!", "goods_list.php"); //出错! } $member = new memberclass(); $note = "推荐送积分:" . $cfg_recommend_score; $member->scoreedit($uname, $cfg_recommend_score, $note); } else { showmsg("未知请求", "-1"); //出错! }
function carttoorder($id) { global $_USERS; if (!empty($id)) { $wherestr[] = $this->joinid($id); } $wherestr[] = "uname ='" . $_USERS['uname'] . "'"; if (empty($wherestr) || empty($_USERS['uname'])) { return false; } if (!empty($wherestr)) { $wheresql = implode(' AND ', $wherestr); } //条件汇总 //获取数据 $temparray = $this->getdata("", $wheresql); if (!empty($temparray)) { //进入用户操作类 include_once INC_PATH . "/member.class.php"; $m = new memberclass(); foreach ($temparray as $value) { $addarray = $value; $tempstate = $value['type'] == 1 ? 1 : 3; //带发直接状态修改成在途中 unset($addarray['gid']); //丢掉 unset($addarray['anonymous']); //丢掉 $addarray['addtime'] = time(); //添加时间 $addarray['state'] = $tempstate; //订单状态 //处理插入数据库 include_once INC_PATH . "/order.class.php"; $order = OrderClass::init(); $info = $order->add($addarray); if (GetNum($info)) { $seccessid[] = $info; //扣除用户帐户余额操作 if ($value['type'] != 2) { $tempmoney = $value['goodsprice'] * $value['goodsnum']; $note = lang('Buy') . "<a href=\\'" . $value['goodsurl'] . "\\' target=\\'_blank\\'>《" . $value['goodsname'] . "》</a> " . $value['goodsnum'] . lang('Pieces_order_ID') . $info; $m->moneyedit($_USERS['uname'], -$tempmoney, 1, $note); //扣去账户余额 } } else { $order->del($seccessid); //手动回滚操作 return lang('process_CartID') . $value['gid'] . lang('orderid_error'); } } //运费扣费处理 $result = $this->countmoney($temparray); //统计运费 foreach ($result['s'] as $key => $val) { $note = lang('goodsseller') . "[" . $key . "]" . lang('Domestic_Ship') . $val; $m->moneyedit($_USERS['uname'], -$val, 2, $note); //扣去账户余额 } $this->clear($id); //删除购物车商品 return 'OK'; } else { return '订单为空'; } }
} include_once INC_PATH . "/guestbook.class.php"; $Table = new GuestBookClass(); $addarray = array('uid' => $_USERS['uid'], 'uname' => $_USERS['uname'], 'addtime' => $timestamp, 'msg' => $msg, 'state' => 0, 'hide' => 1); $info = $Table->add($addarray); if (GetNum($info)) { print "<script language='javascript'>alert('您的提问发布成功,请耐心等待管理员回复!');</script>"; jumpurl(url('m.php?name=guestbooklist')); } else { print "<script language='javascript'>alert('发布提问失败,请稍微重试!');</script>"; jumpurl(url('m.php?name=guestbooklist')); } } elseif ($action == "upmember") { //会员升级操作 include_once INC_PATH . "/member.class.php"; $m = new memberclass(); if ($_USERS['utype'] == 0) { if ($_USERS['scores'] >= $cfg_vip_score1) { $note = "金卡会员升级"; $m->scoreedit($_USERS['uname'], -$cfg_vip_score1, $note); editstate('users', "utype", "uname='" . $_USERS['uname'] . "'", 1); //更改会员等级操作 editstate('users', "validity", "uname='" . $_USERS['uname'] . "'", time() + 3600 * 24 * $cfg_vip_validity); //更改会员有效期操作 print "<script language='javascript'>alert('升级黄金会员成功!');</script>"; jumpurl(url('m.php')); } else { print "<script language='javascript'>alert('积分不足!升级金卡会员需要积分{$cfg_vip_score1}');history.go(-1);</script>"; exit; } } elseif ($_USERS['utype'] == 1) {