<!---------------------------------------登录检查------------------------------------------>
<?php
// 开启Session
session_start();
//检查是否登录,没有登录则跳转login.php
if(@$_SESSION['islogin']!=1)
echo "<script>location.href='login.php';</script>";
?>
<!-----------------------------------购物车会话数据支持-------------------------------------->
<?php
//@屏蔽提示信息
$count=0;
$sum=0;
if(@$_SESSION['count']==NULL)
{
$count=0;
}
else
{
$count=$_SESSION['count'];
}
if(@$_SESSION['sum']==NULL)
{
$sum=0;
}
else
{
$sum=$_SESSION['sum'];
}
?>
<!-------------------------------后台数据库支持(提供奶茶信息)--------------------------------->
<?php
$host='127.0.0.1:3306';
$user='root';
$password='123456';
$dbName='comewonka';
$link=new mysqli($host,$user,$password,$dbName);
$link->set_charset("utf8");
if ($link->connect_error)
{
die("连接失败:".$link->connect_error);
}
$sql = "SELECT * FROM `milktea`";
$res=$link->query($sql);
$data=$res->fetch_all();
$link->close();
?>
<!----------------------------------------------------------------------------------------->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>卡旺卡-三联-come wonka</title>
<script type="text/javascript" src="js/jquery.min.js" ></script>
<script type="text/javascript" src="layui/layui.all.js" ></script>
<link rel="stylesheet" href="layui/css/layui.css" />
<style>
body
{
margin: 0px;
padding: 0px;
}
.top
{
position: relative;
width: 1000px;
height: 120px;
background: #0C0C0C;
margin: 0px auto;
}
.logo
{
display: inline-block;
width: 139px;
height: 68px;
margin-top: 26px;
}
.toolbar
{
display: inline-block;
width: 200px;
height: 20px;
color: white;
padding: 4px;
text-align: right;
position: absolute;/*absolute相对于父容器偏移*/
right:0px;
top: 50px;
}
.gwc
{
position: fixed;
right: 25px;
bottom: 150px;
border: 1px solid #CCCCCC;
box-sizing: border-box;
width: 120px;
padding: 20px;
border-radius: 5px;
background-color: #F2F2F299;
}
.main
{
width: 1000px;
min-height: 800px;
margin: 0px auto;
/*border: 1px solid #000000;*/
}
.titleItem
{
box-sizing: border-box;
height: 50px;
padding: 10px;
background: #FFE4B5;
margin: 10px 0px;
border-radius: 22px;
}
.listItem
{
box-sizing: border-box;
display: inline-block;
width: 160px;
height: 220px;
margin: 15px 18px;
border: 1px solid #C2C2C2;
border-radius: 5px;
padding: 4px;
}
.listphoto
{
display: inline-block;
width: 150px;
height: 150px;
}
.listname
{
box-sizing: border-box;
display: inline-block;
width: 150px;
height: 25px;
text-align: center;
font-size: 18px;
font-family: "微软雅黑";
}
.listprice
{
box-sizing: border-box;
display: inline-block;
width: 60px;
height: 25px;
color: orangered;
font-size: 18px;
font-family: "微软雅黑";
margin-left: 15px;
margin-top: 5px;
}
.listadd
{
box-sizing: border-box;
display: inline-block;
height: 25px;
margin-left: 25px;
}
.foot
{
position: relative;
width: 1000px;
height: 120px;
background: #0C0C0C;
margin: 0px auto;
color: white;
}
.footimg
{
display: inline-block;
width: 271px;
height: 34;
position: absolute;/*absolute相对于父容器偏移*/
left:0px;
top: 43px;
}
.foottext
{
display: inline-block;
width: 300px;
height: 50px;
position: absolute;/*absolute相对于父容器偏移*/
right:0px;
top: 35px;
}
</style>
</head>
<body>
<div style="background-color: #0C0C0C;width: 100%;">
<div class="top">
<div class="logo">
<img src="img/logo/logo.png" />
</div>
<div class="gwc">
<div style="padding: 10px;"><a href="gwc.php"><img width="50px" src="img/icon/ic_gwc.png" /></a></div>
<div>
<label style="color: #FF0000;margin: 0px 4px;font-weight: bold;font-size: 18px;"><?php echo $count ?></label>
件商品等待结算,共计<label style="color: #FF0000;margin: 0px 4px;font-weight: bold;font-size: 18px;"><?php echo $sum ?></label>元,
<a href="gwc.php" style="color: #FF0000;font-weight: bold;font-size: 15px;">点击查看</a>
</div>
</div>
<div class="toolbar">
<label>当前用户:<?php echo $_SESSION['username']?></label> | <a href="logout.php" style="color: white;">注销</a>
</div>
</div>
</div>
<div class="main">
<div class="titleItem" style="margin-top: 25px;"> <img style="width: 30px;margin-left: 15px;" src="img/icon/ic_hot.png" /> 本店热销</div>
<div class="listItem">
<div class="listphoto"><img width="150px" height="150px" src="<?php echo $data[0][3]?>"/></div>
<div class="listname"><?php echo $data[0][1]?></div>
<div class="listprice">¥<?php echo $data[0][2]?></div>
<div class="listadd"><a href="addgwc.php?id=<?php echo $data[0][0]?>&price=<?php echo $data[0][2]?>"><img src="img/icon/ic_add.png"/></a></div>
</div>
<div class="listItem">
<div class="listphoto"><img width="150px" height="150px" src="<?php echo $data[1][3]?>"/></div>
<div class="listname"><?php echo $data[1][1]?></div>
<div class="listprice">¥<?php echo $data[1][2]?></div>
<div class="listadd"><a href="addgwc.php?id=<?php echo $data[1][0]?>&price=<?php echo $data[1][2]?>"><img src="img/icon/ic_add.png"/></a></div>
</div>
<div class="listItem">
<div class="listphoto"><img width="150px" height="150px" src="<?php echo $data[5][3]?>"/></div>
<div class="listname"><?php echo $data[5][1]?></div>
<div class="listprice">¥<?php echo $data[5][2]?></div>
<div class="listadd"><a href="addgwc.php?id=<?php echo $data[5][0]?>&price=<?php echo $data[5][2]?>"><img src="img/icon/ic_add.png"/></a></div>
</div>
<div class="listItem">
<div class="listphoto"><img width="150px" height="150px" src="<?php echo $data[3][3]?>"/></div>
<div class="listname"><?php echo $data[3][1]?></div>
<div class="listprice">¥<?php echo $data[3][2]?></div>
<div class="listadd"><a href="addgwc.php?id=<?php echo $data[3][0]?>&price=<?php echo $data[3][2]?>"><img src="img/icon/ic_add.png"/></a></div>
</div>
<div class="listItem">
<div class="listphoto"><img width="150px" height="150px" src="<?php echo $data[6][3]?>"/></div>
<div class="listname"><?php echo $data[6][1]?></div>
<div class="listprice">¥<?php echo $data[6][2]?></div>
<div class="listadd"><a href="addgwc.php?id=<?php echo $data[6][0]?>&price=<?php echo $data[6][2]?>"><img src="img/icon/ic_add.png"/></a></div>
</div>
<div class="listItem">
<div class="listphoto"><img width="150px" height="150px" src="<?php echo $data[7][3]?>"/></div>
<div class="listname"><?php echo $data[7][1]?></div>
<div class="listprice">¥<?php echo $data[7][2]?></div>
<div class="listadd"><a href="addgwc.php?id=<?php echo $data[7][0]?>&price=<?php echo $data[7][2]?>"><img src="img/icon/ic_add.png"/></a></div>
</div>
<div class="titleItem"> <img style="width: 30px;margin-left: 15px;" src="img/icon/1.png" /> 经典奶茶</div>
<div class="listItem">
<div class="listphoto"><img width="150px" height="150px" src="<?php echo $data[0][3]?>"/></div>
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
本例实现的是一个简单的PHP商城系统,背景是奶茶销售。主要功能包括:①用户登录;②用户账号注销;③注册用户;④商品浏览;⑤商品加入购物车;⑥结算及支付。所用到的技术是PHP+MySQL。通过本例你可以了解PHP与数据库的连接,通过数据库获取数据的方法,PHP会话在登录注册注销已经商品加入购物车中的应用。数据库脚本在压缩包中,本例数据库密码为123456。在谷歌浏览器或360极速浏览器(极速模式)进行浏览可以获得最好的体验。
资源推荐
资源详情
资源评论
收起资源包目录
PHP销售系统(小型商城).rar (145个子文件)
layui.css 68KB
layer.css 14KB
layui.mobile.css 10KB
laydate.css 7KB
code.css 1KB
common.css 402B
iconfont.eot 40KB
59.gif 10KB
22.gif 10KB
24.gif 8KB
13.gif 7KB
16.gif 7KB
39.gif 6KB
64.gif 6KB
63.gif 6KB
50.gif 6KB
loading-0.gif 6KB
4.gif 6KB
1.gif 5KB
42.gif 5KB
71.gif 5KB
21.gif 5KB
20.gif 5KB
29.gif 5KB
70.gif 4KB
5.gif 4KB
17.gif 4KB
27.gif 4KB
9.gif 4KB
44.gif 4KB
11.gif 4KB
8.gif 4KB
3.gif 4KB
23.gif 4KB
34.gif 4KB
41.gif 4KB
38.gif 4KB
65.gif 3KB
32.gif 3KB
45.gif 3KB
7.gif 3KB
12.gif 3KB
26.gif 3KB
60.gif 3KB
2.gif 3KB
40.gif 3KB
25.gif 3KB
19.gif 3KB
66.gif 3KB
18.gif 3KB
46.gif 3KB
10.gif 3KB
28.gif 3KB
51.gif 3KB
57.gif 3KB
67.gif 3KB
0.gif 3KB
48.gif 3KB
43.gif 3KB
30.gif 2KB
61.gif 2KB
33.gif 2KB
69.gif 2KB
14.gif 2KB
47.gif 2KB
36.gif 2KB
49.gif 2KB
58.gif 2KB
6.gif 2KB
54.gif 2KB
53.gif 2KB
56.gif 2KB
62.gif 2KB
31.gif 2KB
55.gif 2KB
35.gif 2KB
15.gif 2KB
loading-2.gif 2KB
37.gif 1KB
68.gif 1KB
52.gif 777B
loading-1.gif 701B
pay.jpg 128KB
shouzhajinning.jpg 83KB
manmanxianguo.jpg 66KB
shouzhaningmengwulong.jpg 65KB
hongdou.jpg 61KB
quantao.jpg 60KB
shouzhamitaowulong.jpg 56KB
heiquantao.jpg 48KB
tanpeiwulongnaifu.jpg 48KB
sijichunnaifu.jpg 47KB
layui.all.js 255KB
jquery.js 95KB
jquery.min.js 85KB
mobile.js 33KB
table.js 30KB
laydate.js 27KB
layer.js 22KB
layedit.js 12KB
共 145 条
- 1
- 2
资源评论
三只小松
- 粉丝: 2
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功