示例#1
0
文件: upload.php 项目: a195474368/ejw
 */
//载入全局配置和函数包
require dirname(__FILE__) . "/../../app.php";
//////////////////////////////
//注册会话
$session = getgpc('session');
//用户体系
$sid = '';
//系统管理员
if ($_G['manager']['id']) {
    $sid = 'manager';
}
//普通用户
if (!$_G['manager']['id'] && $session) {
    Module::loader('passport', 'function');
    $hash = Passport::session_decode($session);
    if ($hash['id']) {
        $sid = 'member';
    }
}
//会话域
if (!$sid) {
    alert(1, '您当前不在登录状态(' . $sid . ')');
} elseif (empty($_FILES) === FALSE) {
    //连接数据库
    System::connect();
    $res = Attach::savefile(array('field' => 'imgFile', 'filetype' => 'image', 'account' => $sid, 'absolute' => TRUE));
    //关闭数据库
    System::connect();
    if ($res) {
        alert(0, NULL, $res);