Example #1
0
function IsCategoryPriv($cid = 0, $act = '', $return = '', $issave = '1')
{
    global $dosql, $cfg_adminlevel;
    //超级管理员只记录操作日志
    if ($cfg_adminlevel == 1) {
        //更新操作日志
        $r = $dosql->GetOne("SELECT `infotype` FROM `#@__infoclass` WHERE `id`={$cid}");
        if (isset($r['infotype'])) {
            switch ($r['infotype']) {
                case 0:
                    $m = 'info';
                    break;
                case 1:
                    $m = 'infolist';
                    break;
                case 2:
                    $m = 'infoimg';
                    break;
                case 3:
                    $m = 'soft';
                    break;
                case 4:
                    $m = 'goods';
                    break;
                default:
                    $r2 = $dosql->GetOne("SELECT * FROM `#@__diymodel` WHERE `id`=" . $r['infotype']);
                    if (isset($r2) && is_array($r2)) {
                        $m = $r2['modelname'];
                    } else {
                        $m = '';
                    }
            }
            if ($issave == 1) {
                SetSysEvent($m, $cid, $act);
            }
        }
        return TRUE;
    } else {
        if ($cfg_adminlevel != 1) {
            $r = $dosql->GetOne("SELECT * FROM `#@__adminprivacy` WHERE `groupid`=" . $cfg_adminlevel . " AND `model`='category' AND `classid`={$cid} AND `action`='{$act}'");
            if (isset($r) && is_array($r)) {
                //更新操作日志
                $r = $dosql->GetOne("SELECT `infotype` FROM `#@__infoclass` WHERE `id`={$cid}");
                if (isset($r['infotype'])) {
                    switch ($r['infotype']) {
                        case 0:
                            $m = 'info';
                            break;
                        case 1:
                            $m = 'infolist';
                            break;
                        case 2:
                            $m = 'infoimg';
                            break;
                        case 3:
                            $m = 'soft';
                            break;
                        case 4:
                            $m = 'goods';
                            break;
                        default:
                            $r2 = $dosql->GetOne("SELECT * FROM `#@__diymodel` WHERE `id`=" . $r['infotype']);
                            if (isset($r2) && is_array($r2)) {
                                $m = $r2['modelname'];
                            } else {
                                $m = '';
                            }
                    }
                    if ($issave == 1) {
                        SetSysEvent($m, $cid, $act);
                    }
                }
                return TRUE;
            } else {
                if ($return == '') {
                    ShowMsg('亲,您还没有操作本栏目的权限!', '-1');
                    exit;
                } else {
                    return FALSE;
                }
            }
        } else {
            return FALSE;
        }
    }
}
Example #2
0
<?php

require_once dirname(__FILE__) . '/inc/config.inc.php';
/*
**************************
(C)2010-2014 phpMyWind.com
update: 2014-4-8 21:16:15
person: Feng
**************************
*/
//更新操作日志
SetSysEvent('logout');
$_SESSION = array();
session_destroy();
header('location:login.php');
exit;
Example #3
0
                        $_SESSION['sitekey'] = '';
                    }
                    //提取当前用户账号
                    $_SESSION['admin'] = $row['username'];
                    //提取当前用户权限
                    $_SESSION['adminlevel'] = $row['levelname'];
                    //提取上次登录时间
                    $_SESSION['lastlogintime'] = $row['logintime'];
                    //提取上次登录IP
                    $_SESSION['lastloginip'] = $row['loginip'];
                    //记录本次登录时间
                    $_SESSION['logintime'] = $logintime;
                    //更新登录数据
                    $dosql->ExecNoneQuery("UPDATE `#@__admin` SET loginip='{$loginip}',logintime='{$logintime}' WHERE `username`='{$username}'");
                    //更新操作日志
                    SetSysEvent('login');
                    //判断访问设备
                    if (IsMobile()) {
                        $_SESSION['siteeq'] = 'mobile';
                        header('location:default_mb.php?c=index');
                        exit;
                    } else {
                        $_SESSION['siteeq'] = 'pc';
                        header('location:default.php');
                        exit;
                    }
                }
            }
        }
    }
}