$SqlPassword1 = rtrim(htmlspecialchars(insql($_POST['SqlPassword1'])), '\\');
    } else {
        $SqlPassword1 = $SqlPassword;
    }
    $SqlDataBase1 = rtrim(htmlspecialchars(insql($_POST['SqlDataBase1'])), '\\');
    $Pre1 = rtrim(htmlspecialchars(insql($_POST['Pre1'])), '\\');
    $amsurl1 = rtrim(htmlspecialchars(insql($_POST['amsurl1'])), '\\');
    if ($amsurl1 && strrchr($amsurl1, '/') != '/') {
        $amsurl1 .= '/';
    }
    $thread1 = rtrim(htmlspecialchars(insql($_POST['thread1'])), '\\');
    $clthread1 = rtrim(htmlspecialchars(insql($_POST['clthread1'])), '\\');
    $ggwthread1 = rtrim(htmlspecialchars(insql($_POST['ggwthread1'])), '\\');
    $timezone1 = rtrim(htmlspecialchars(insql($_POST['timezone1'])), '\\');
    $configdata = "<?php\ndefined('IN_NIUXAMS') or exit('Access Denied.');\n\$adname = '{$adname1}';\n\$adpassword = '******';\n\$SqlServer = '{$SqlServer1}';\n\$SqlUserName = '******';\n\$SqlPassword = '******';\n\$SqlDataBase = '{$SqlDataBase1}';\n\$Pre = '{$Pre1}';\n\$amsurl = '{$amsurl1}';\n\$thread = '{$thread1}';\n\$clthread = '{$clthread1}';\n\$ggwthread = '{$ggwthread1}';\n\$timezone = '{$timezone1}';\n";
    file_put_contents('config.php', $configdata) or errwin('出错啦!config.php无法修改!请将程序目录和文件的文件权限设置属性0755或0777。');
    $conn = new mysql();
    $conn->inoplog('修改基本参数', 'cssz', 1, getname());
    okwin('恭喜你,修改参数成功了!');
    exit;
}
///////////////////////////
$title = '基本参数设置';
require 'mo.head.php';
?>
<style>
.cssz{
	border-width:1px 0px 0px 1px;
}
.left{
	border-width:0px 1px 1px 0px;
    $filename = basename($_FILES['userfile']['name']);
    $extend = explode('.', $filename);
    $va = count($extend) - 1;
    $fileext = '.' . strtolower($extend[$va]);
    $accfileext = explode('|', $upimgtype);
    if (!in_array($fileext, $accfileext)) {
        errwin('文件类型错误!');
    }
    if ($_FILES['userfile']['error'] == 0 && is_uploaded_file($_FILES['userfile']['tmp_name'])) {
        $uploaddir = $datadir . '/updata/';
        if (!file_exists($uploaddir)) {
            mkdir($uploaddir, 0755, true);
        }
        $upfilename = date("YmdHis", time()) . $fileext;
        $uploadfile = $uploaddir . $upfilename;
        move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile) or errwin('上传失败!');
    }
    $dx = filesize($uploadfile);
    $cc = getimagesize($uploadfile);
    require 'mo.head.php';
    ?>
<style type="text/css">
input.text,select.text,textarea.text {
	padding: .3em;
	font-size: 1em;
}
#kuan, #gao{
	width: 3em;
}
#imgdm{
	width:80%;
/* 程序名称: 牛叉广告管理优化大师(NiuXams)
/* 程序功能: 快速低成本建立自己网站的广告管理、智能投放系统!
/* 程序开发: 牛叉软件(NiuXSoft.Com)
/* 版权所有: [NiuXams] (C)2013-2099 NiuXSoft.Com
/* 官方网站: niuxsoft.com  Email: niuxsoft@163.com
/* ---------------------------------------------------- */
/* 使用条款:
/* 1.该软件个人非商业用途免费使用.
/* 2.免费使用禁止修改版权信息和官方推广链接.
/* 3.禁止任何衍生版本.
/* ---------------------------------------------------- */
define('NIUXAMS_ACCESS', 'editggw');
require 'common.php';
$menu = $_POST['menu'];
$gid = $_REQUEST['gid'];
$ggwd = file_get_contents($datadir . '/' . $gid . '.php') or errwin('出错啦!打开文件出错,请输入正确的gid!');
$arrayd = explode("\r\n", $ggwd);
array_shift($arrayd);
///////////////////////////
if ($menu == 'editggw') {
    $ggwtitle = insql($_POST['ggwtitle']);
    $ggwclass = insql($_POST['ggwclass']);
    $ggwwidth = insql($_POST['ggwwidth']);
    $ggwheight = insql($_POST['ggwheight']);
    $xzggcl = insql($_POST['xzggcl']);
    $bjgg = insql($_POST['bjgg']);
    $ggwlei = insql($_POST['ggwlei']);
    $ggwzu = insql($_POST['ggwzu']);
    $gid = insql($_POST['gid']);
    $gtime = insql($_POST['gtime']);
    if (!$ggwtitle) {
function Access()
{
    global $Pre, $datadir, $adname, $adpassword, $subadmin;
    session_start();
    $Nxalgnm = $_SESSION[$Pre . 'Nxalgnm'];
    $Nxalgpw = $_SESSION[$Pre . 'Nxalgpw'];
    $status = 0;
    if ($Nxalgnm == $adname && $Nxalgpw == $adpassword) {
        $status = 1;
    } else {
        $Nxalgnm = $_COOKIE[$Pre . 'Nxalgnm'];
        $Nxalgpw = $_COOKIE[$Pre . 'Nxalgpw'];
        foreach ($subadmin as $key => $value) {
            if ($Nxalgnm == $key && $Nxalgpw == md5($key . $value[0] . $key)) {
                if (defined('NIUXAMS_ACCESS')) {
                    $accessdata = file($datadir . '/access/' . $value[1] . '.access.php');
                    array_shift($accessdata);
                    array_shift($accessdata);
                    $Allowaccess = explode('|', rtrim(array_shift($accessdata)));
                    if (!in_array('-', $Allowaccess) && !in_array(NIUXAMS_ACCESS, $Allowaccess) && NIUXAMS_ACCESS != $value[1]) {
                        errwin('抱歉,您没有此功能的权限!');
                    }
                }
                $status = 1;
                break;
            }
        }
    }
    if ($status == 0) {
        header('Location: login.html');
        exit;
    }
}