📄 sys_shop2.php
字号:
<?php
require_once("functions/login_flag.php");//是否已经登录
include_once("functions/func_common.php");
include_once("functions/class_mysql.php");//加载数据库类文件
include_once("configs/Configs.php");//加载配置文件;
require_once("all_processing.php");
if ($_POST['is_upload']=='upload') {
//查询是否在战争中;
//include_once("warfare_safe.php");
$g_id=$_POST['god'];
//根据不同的action_type值显示不同的物品;1:武器,2:凯甲,3:道具,4:兵符,5:坐骑,6:书藉,7:宝物;
$query=$db->query("select * from m_goods where s_type='3' and id='".$g_id."'");
$list=$db->fetch_array($query);
$ids = $list['id']; //基础物品表-ID;
$style_num= 9;//基础物品表-类别数字;
$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']; //基础物品表-分类;
//所要花费的元宝;
$cashmoney_sum=$price;
//查询玩家当前的金钱和元宝数
$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("没有足够的元宝来购买物品!");
}
$db->query("update player_info set `cashmoney`=(`cashmoney`-'".$cashmoney_sum."') where `u_id`='".$_COOKIE['UserId']."' ;");//扣除玩家的元宝;
//写入玩家内政物品表;
$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!='') {
$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("购买完成!","?");
}
?>
<!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><div class="page_build_title">百宝阁</div></td>
</tr>
</table>
</div>
<div id="mb_04">
<!--替换区域开始-->
<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%"><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
//当前页数
$page=isset($_GET['page'])? $_GET['page'] : 1;
$each_page=10; //每页记录数
$res=$db->query("select * from m_goods where s_type='3' and open_if='0' order by s_price asc ");
$total=$db->num_rows($res);
$total_page=ceil($total/$each_page); //总页数
$page=($page<0)?1:$page;
$offset=($page-1)*$each_page;
if ($total){
$res_bao2=$db->query("select * from m_goods where s_type='3' and open_if='0' order by id asc limit $offset,$each_page ");
$i=1;
while ($goods_list=$db->fetch_array($res_bao2)) {
?>
<form class="shop<?php echo $i;?>" name="shop<?php echo $i;?>" method="POST">
<input type="hidden" name="is_upload" value="upload"/>
<input type="hidden" name="page" value="<?php echo $_GET['page']; ?>"/>
<input type="hidden" name="god" value="<?php echo $goods_list['id'];?>"/>
<!--------循环----------->
<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">宝物</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"><input type="image" alt="" src="images/images/000.gif" border="0" onkeydown="return keycode()"/></div>
<div class="d1f_09">-------------------------------------------------------------------------------------------</div>
<!--------循环----------->
</form>
<?php
$i++;
}}
$db->close();
?>
<table width="100%" height="10" border="0" cellpadding="0" cellspacing="0">
<tr>
<td> </td>
</tr>
</table>
<!--替换区域结束-->
<?php
if ($page>1) {
?>
<a href="?page=<?php echo $page-1; ?>">上一页</a>
<?php
}else {
?>
上一页 <?php } ?>
<?php
if ($page<$total_page) {
?>
<a href="?page=<?php echo $page+1; ?> ">下一页 </a>
<?php }else {
?>
下一页
<?php } ?>
页码:<?php echo $page; ?>/<?php echo $total_page; ?>
</div>
<?php
include_once("function_area_re.php");
$db->close();
?>
<div id="mb_05"></div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -