📄 sys_shop.php
字号:
<?php
require_once("functions/login_flag.php");//是否已经登录
include_once("functions/class_mysql.php");//加载数据库类文件
include_once("functions/func_common.php");
include_once("configs/Configs.php");//加载配置文件;
require_once("all_processing.php");
if ($_GET['is_upload']=='upload') {
if ($sys_safe_if) {
echomsg("交易暂时关闭","?");
}else {
//查询是否在战争中;
//include_once("warfare_safe.php");
$query=$db->query("select * from m_goods where id='".$_GET['god']."' ;");
$list=$db->fetch_array($query);
$ids = $list['id']; //基础物品表-ID;
$style_num= $list['s_stylenum'];//基础物品表-类别数字;
$shoping = $list['s_name']; //基础物品表-商品名称;
$type = $list['s_type']; //基础物品表-物品分类;
$sort = $list['s_sort']; //基础物品表-类别;
$price = $list['s_price']; //基础物品表-出售价格;
$effect = $list['s_effect']; //基础物品表-效果;
$level = $list['s_level']; //基础物品表-等级;
$s_type = $list['s_type']; //基础物品表-分类;
//金锭,金砖各一千个;
if ($shoping=='金锭') {
//查询玩家内政表里有多少金锭和金砖到一千个禁止购买;
$query_player_case=$db->query("select id from interior_goods where i_uid='".$_COOKIE['UserId']."' and i_goodsname='金锭';");
$player_case_num=$db->num_rows($query_player_case);
if ($player_case_num>=$cashmoney_max_nummber) echomsg("金锭数量己达上限!");
}
if ($shoping=='金砖') {
//查询玩家内政表里有多少金锭和金砖到一千个禁止购买;
$query_player_case=$db->query("select id from interior_goods where i_uid='".$_COOKIE['UserId']."' and i_goodsname='金砖';");
$player_case_num=$db->num_rows($query_player_case);
if ($player_case_num>=$cashmoney_max_nummber2) echomsg("金砖数量己达上限!");
}
////////////////////判断是否有购买数量,购买所有商品是否有足购的钱////////////////////////////////////////////////////
if ($_GET['goods_type_num']==7) {
//所要花费的元宝;
$cashmoney_sum=$price;
}else {
//所要花费的金钱;
$money_sum=$price;
}
//查询玩家当前的金钱和元宝数
$query=$db->query("select `golds` from resource where `u_id`='".$_COOKIE['UserId']."' and c_id='".$_COOKIE['CityId']."';");
$list_con=$db->fetch_array($query);
if ($list_con['golds']<$money_sum) {
echomsg("没有足够的钱来购买物品!");
}
//查询玩家当前的金钱和元宝数
$query=$db->query("select `cashmoney` from player_info where `u_id`='".$_COOKIE['UserId']."';");
$list_con=$db->fetch_array($query);
if ($list_con['cashmoney']<$cashmoney_sum) {
echomsg("没有足够的元宝来购买物品!");
}
////////////循环判断用户提交数据,并进行操作///////////////////////////////////
if ($_GET['goods_type_num']=='7') {
/////////////////////如果用元宝来买的情况///////////////////////
$cashmoney=$price;//物品相应数量应该减少的元宝;
$db->query("update resource set `cashmoney`=(`cashmoney`-'".$cashmoney."') where `u_id`='".$_COOKIE['UserId']."' and c_id='".$_COOKIE['CityId']."';");//扣除玩家的元宝;
//写入玩家内政物品表;
$db->query("insert into interior_goods (`id`,`i_uid`,`s_id`,`i_style`,`i_style_num`,`i_goodsname`,`i_effect`,`i_state`,`i_level`,`s_type`) values (null,'".$_COOKIE['UserId']."','".$ids."','".$sort."','".$style_num."','".$shoping."','".$effect."','2','".$level."','".$s_type."') ");
}else {
/////////////////////不是用元宝来买的情况///////////////////////////
$reduce_money=$price;//物品相应数量应该减少的钱数;
$db->query("update resource set `golds`=(`golds`-'".$reduce_money."'),`free_stores`=(`free_stores`-'".$reduce_money."') where `u_id`='".$_COOKIE['UserId']."' and c_id='".$_COOKIE['CityId']."';");//扣除玩家的金钱,减少仓库的存储量;
//写入玩家内政物品表;
if ($sort=='兵书'||$sort=='经书') {
$sort='书藉';//把兵书,经书,医书,奇书,统一定为书藉类型;
}
$query_bao=$db->query("select id ,num from interior_goods where i_goodsname='".$shoping."' and i_uid='".$_COOKIE['UserId']."' ");
$list_bao=$db->fetch_array($query_bao);
$i_bao=$list_bao['id'];
$n_bao=$list_bao['num'];
if ($i_bao!=''&&$_GET['goods_type_num']==3) {
$n_bao=$n_bao+1;
$db->query("update interior_goods set num='".$n_bao."' where id='".$i_bao."' ");
}else{
$db->query("insert into interior_goods (i_uid,s_id,i_style,i_style_num,i_goodsname,i_effect,i_state,i_level,s_type,num) values ('".$_COOKIE['UserId']."','".$ids."','".$sort."','".$style_num."','".$shoping."','".$effect."','2','".$level."','".$s_type."' ,'1') ");
}
//更新资源页面;
refresh();
echomsg("购买完成!","?action_type=".$_GET['goods_type_num']);
}
}}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>本地交易市场</title>
<link href="css/id.css" rel="stylesheet" type="text/css">
<link href="css/css.css" rel="stylesheet" type="text/css">
<link type="text/css" href="css/build.css" rel="stylesheet">
<link href="css/rsx.css" rel="stylesheet" type="text/css">
<style>
body{
margin-top:0px;
}
</style>
<script type="text/javascript">
function keycode() {
if(event.keyCode==13) {
event.returnValue=false;
}
}
</script>
</head>
<body>
<!--导航-->
<?php require_once("market_daohang.htm");?>
<div id="mb_01">
<table width="90%" height="30" border="0" cellpadding="0" cellspacing="0" style="margin-top:6px ">
<tr>
<td><a href="?action_type=1"><img src="images/images/006.gif" width="81" height="23" /></a></td>
<td><a href="?action_type=2"><img src="images/images/007.gif" width="81" height="23" /></a></td>
<td><a href="?action_type=3"><img src="images/images/008.gif" width="81" height="23" /></a></td>
<td><a href="?action_type=4"><img src="images/images/009.gif" width="81" height="23" /></a></td>
<td><a href="?action_type=5"><img src="images/images/011.gif" width="81" height="23" /></a></td>
<td><a href="?action_type=6"><img src="images/images/010.gif" width="81" height="23" /></a></td>
<td> </td>
</tr>
</table>
</div>
<div id="mb_04">
<?php
if ($sys_safe_if) {
echo '<br/>';
echo '交易暂时关闭';
}else{
?>
<!--替换区域开始-->
<table width="84%" height="30" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="6%"> </td>
<td width="12%"><strong>商 品</strong></td>
<td width="15%"><strong>类 别</strong></td>
<td width="21%" align="left"><strong>物品效果</strong></td>
<td width="33%"><div align="right"><strong>价 格</strong></div></td>
<td width="13%"><div align="right"><strong>操 作</strong></div></td>
</tr>
</table>
<div class="d1f_09">-------------------------------------------------------------------------------------------</div>
<?php
//根据不同的action_type值显示不同的物品;1:武器,2:凯甲,3:道具,4:兵符,5:坐骑,6:书藉,7:宝物;
switch ($_GET['action_type'])
{
case 1:
{
$query=$db->query("select * from m_goods where s_stylenum='1' and `s_type`='1' and open_if='0' order by s_price asc;");
break;
}
case 2:
{
$query=$db->query("select * from m_goods where s_stylenum='2' and `s_type`='1' and open_if='0' order by s_price asc;");
break;
}
case 3:
{
$query=$db->query("select * from m_goods where s_stylenum='8' and `s_type`='1' and open_if='0' and id!='105' and id!='106' order by s_price asc;");
break;
}
case 4:
{
$query=$db->query("select * from m_goods where s_stylenum='6' and `s_type`='1' and open_if='0' order by s_price asc;");
break;
}
case 5:
{
$query=$db->query("select * from m_goods where s_stylenum='3' and `s_type`='1' and open_if='0' order by s_price asc;");
break;
}
case 6:
{
$query=$db->query("select * from m_goods where (s_stylenum='4' or s_stylenum='5') and `s_type`='1' and open_if='0' order by s_price asc;");
break;
}
}
$i=1;
while ($goods_list=$db->fetch_array($query)) {
?>
<!--------循环----------->
<div class="d1f_08"><img src="images/yw_bao/all38x38/<?php echo $goods_list['id'];?>.jpg" width="40" height="40"/></div>
<div class="fxg_04"><?php echo $goods_list['s_name'];?></div>
<div class="fxg_04"><?php echo $goods_list['s_sort'];?></div>
<div class="fxg_05 style1" align="left"><?php echo $goods_list['s_effect'];?></div>
<div class="fxg_04 veb"><?php echo $goods_list['s_price']; echo '金';?></div>
<div class="fxg_02 veb" ><a href="?god=<?php echo $goods_list['id'];?>&goods_type_num=<?php echo $_GET['action_type'];?>&is_upload=upload" onkeydown="return keycode()"><img alt="" src="images/images/000.gif" border="0"/></a></div>
<div class="d1f_09">-------------------------------------------------------------------------------------------</div>
<!--------循环----------->
<?php
$i++;
}
$db->close();
?>
<table width="40%" height="40" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="bottom"> </td>
</tr>
</table>
<?php
}
include_once("function_area_re.php");
$db->close();
?>
<!--替换区域结束-->
</div>
<div id="mb_05"></div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -