2 Star 4 Fork 0

Belong / shopPHP

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
chklogin.php 1.73 KB
一键复制 编辑 原始数据 按行查看 历史
Belong 提交于 2021-07-11 09:49 . php
<?php
session_start();
header("content-type:text/html;charset=utf-8");
require("system/system.inc.php");
/**
* 1表示添加成功
* 2表示用户没有登录
* 3表示商品已添加过
* 4表示添加时出现错误
* 5表示没有商品添加
*/
$reback=0;
if(empty($_SESSION['member'])){
$reback=2;
}
else{
$key=$_GET['key'];
if($key==''){
$reback='5';
}
else{
$boo=false;
$sqls="select id,shopping from tb_user where name='".$_SESSION['member']."'";
$shopcont=$admindb->ExecSQL($sqls,$conn);
//当购物车不为空
if(!empty($shopcont[0]['shopping'])){
$arr=explode('@',$shopcont[0]['shopping']);
foreach($arr as $value){
$arrtmp=explode(',',$value);
//??????????????????????
if($key==$arrtmp[0]){
$reback='3';
$boo=true;
break;
}
}
if($boo==false){
$shopcont[0]['shopping'].='@'.$key.',1';
$update="update tb_user set shopping='".$shopcont[0]['shopping']."' where name='".$_SESSION['member']."'";
$shop=$admindb->ExecSQL($update,$conn);
if($shop){
$reback=1;
}
else{
$reback=4;
}
}
}
//购物车为空
else{
$tmparr=$key.",1";
$update="update tb_user set shopping='".$tmparr."' where name='".$_SESSION['member']."'";
$result=$admindb->ExecSQL($update,$conn);
if($result){
$reback=1;
}
else{
$reback=4;
}
}
}
}
echo $reback;
?>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Belong123/shop-php.git
git@gitee.com:Belong123/shop-php.git
Belong123
shop-php
shopPHP
master

搜索帮助

Bbcd6f05 5694891 0cc6727d 5694891