登录成功'; }else{ echo '密码错误'; exit( include __DIR__ . '/login.php' ); } } elseif (!empty( $_COOKIE['admin'] ) ) { if ( $_COOKIE['admin'] == $config['password'] ) { } } else { echo '请登录'; header('loction:login.php'); exit(include __DIR__.'/login.php'); } } // 仅允许登录后上传 function mustLogin(){ global $config; if ($config['mustLogin']){ checkLogin(); } } // 检查配置文件中目录是否存在是否可写并创建相应目录 function config_path(){ global $config; $img_path = $config['path'].date('Y').'/'.date('m').'/'.date('d'); if (!is_dir($img_path)){ @mkdir($img_path,0755,true); } if (!is_writable($img_path)){ @chmod($img_path,0755); } return $img_path.'/'; } // 图片重命名规则 function imgName(){ return base_convert(date('His').mt_rand(1024,10240),10,36); } // 设置广告 function showAD($where) { global $config; switch ($where){ case 'top': if ($config['ad_top']){ include (APP_ROOT.'/public/static/ad_top.html'); } break; case 'bot': if ($config['ad_bot']){ include (APP_ROOT.'/public/static/ad_bot.html'); } break; default: echo '广告函数出错'; break; } } // 设置一键CDN function static_cdn(){ global $config; if ($config['static_cdn']){ // 开启CDN return ' '; }else{ // 本地文件 return ' '; } } // 开启管理 function tinyfilemanager(){ global $config; if(!$config['tinyfilemanager']){ header('Location: '.$config['domain'].'?not_open_manager'); exit; } } // 获取允许上传的扩展名 function getExtensions(){ global $config; $mime = ''; for ($i=0;$i