沃梦达 / 编程技术 / CMS教程 / 正文

dedecms织梦无需登录注册可下单购买的修改

dedecms织梦无需登录注册可下单购买的修改,首先找到/plus/carbuaction.php文件,找到如下代码: //确认用户登录信息if($cfg_ml-IsLogin()){ $userid = $cfg_ml-M_ID;}else{ $username = trim($username); $password = trim($password); if(empty($username) || $password) { ShowMsg("请选登录!",

 dedecms织梦无需登录注册可下单购买的修改,首先找到/plus/carbuaction.php文件,找到如下代码:
//确认用户登录信息
if($cfg_ml->IsLogin())
{
    $userid = $cfg_ml->M_ID;
}
else
{
    $username = trim($username);
    $password = trim($password);
   
    if(empty($username) || $password)
    {
        ShowMsg("请选登录!","-1",0,2000);
        exit();
    }
   
    $rs = $cfg_ml->CheckUser($username,$password);
    if($rs==0)
    {
        ShowMsg("用户名不存在!","-1",0,2000);
        exit();
    }
    else if($rs==-1)
    {
        ShowMsg("密码错误!","-1",0,2000);
        exit();
    }
    $userid = $cfg_ml->M_ID;
}
修改为如下代码:
//确认用户登录信息
if($cfg_ml->IsLogin())
{
    $userid = $cfg_ml->M_ID;
}
else
{
    $username = trim($username);
    $password = trim($password);
   
    if(empty($username) || $password)
    {
        $userid = 0;
    }
    else
    {
        $rs = $cfg_ml->CheckUser($username,$password);
        if($rs==0)
        {
            ShowMsg("用户名不存在!","-1",0,2000);
            exit();
        }
        else if($rs==-1)
        {
            ShowMsg("密码错误!","-1",0,2000);
            exit();
        }
        $userid = $cfg_ml->M_ID;
    }
}
修改的意思就是,如果用户没有登录,那我就把0赋值给 id,这样在后台只要看到是0下的订单,就是游客的。当然游客的话需要记录一些信息,方便查询订单。

本文标题为:dedecms织梦无需登录注册可下单购买的修改

基础教程推荐