<?php
//检查是否被定义过
//如果其它程序包含了这个文件,将强制终止当前程序
if ( !defined('IN_EB') )
{
die("Hacking attempt");
}$page_title = '增加一级分类';
//include(INCLUDES . 'header_admin.php');等价的!
include(INCLUDES . 'header_admin.'.$phpEx);
include_once(LIBS . 'libs_upload.'.$phpEx);
include_once(INCLUDES . 'func_image.' . $phpEx);$ArrVar = array(
'firms' => (int) 0,
'serial' => (int) 0,
'class_name' => (string) '',
'show_innav' => (int) 0,
'disabled' => (int) 0,
'description' => (string) ''
);foreach ($ArrVar as $var => $default)
{
/*request_var()这个函数确保读入的变量类型是正确的,并且确保得到恰当的使用。
所以建议用其替代$HTTP_POST_VARS和$HTTP_GET_VARS。
有些情况下,如$_POST可以用来检查一个变量是否被提交,但是这样的参数不应该被直接分配给变量使用。*/
//request_var(页面变量名,默认值,?);
$$var = request_var($var, $default, true);
}//处理图片上传
$imageup = (!empty($HTTP_POST_FILES['imageup']['name'])) ?  $HTTP_POST_FILES['imageup'] : ''; if($imageup != '')
{
$ArrayImgUp = array(
'path_cat'  => $system_config['path_info'],
'force_height'  => 200,
'force_width'  => 200,
'max_height'  => 200,
'max_width' => 200,
'allow_'  => 0
);

$save_file = upload_img_one($imageup, $ArrayImgUp); // 图片上传
}
else
{
$save_file = '';
}$arr_params=array(
'description' => $description,
'serial' => $serial,
'path_img' => $save_file,
'show_innav' => $show_innav,
'class_name' => $class_name,
'disabled' => $disabled,
);if ($action == 'add')
{
if( acp_data_add($arr_params, EB_CLASS) )
{
$message = '分类已成功添加!';
acp_return(append_sid("/?mod=acp&amp;do=acp_class_add"), $message);
}
}$template->assign_vars(array(
'ACP_CLASS_MANAGE' => append_sid("/?mod=acp&amp;do=acp_class_manage")
));
// 模板输出
$template->set_filenames(array(
'body' => 'acp_class_add.tpl'
));
$template->pparse('body');// 输出footer
include(INCLUDES . 'footer_admin.' . $phpEx);/*
//包含进数据库配置文件,其中定义了mysql的版本,数据库用户名和密码,以及数据库名称等信息if( !defined("PHPBB_INSTALLED") )
{//如果没有安装(安装文件还存在),则跳转到安装文件
header('Location: ' . $phpbb_root_path . 'install/install.' . $phpEx);
exit;
}include($phpbb_root_path . 'includes/constants.'.$phpEx); //这是一个定义了诸多常量的文件
include($phpbb_root_path . 'includes/template.'.$phpEx); //这是一个定义了模板类的文件
include($phpbb_root_path . 'includes/sessions.'.$phpEx); //session和cookies的读取写入文件。phpbb中,如果客户端cookies不能使用时,系统将会使用session
include($phpbb_root_path . 'includes/auth.'.$phpEx); //包含了autn.php文件,其中主要对版块的权限进行了读取
include($phpbb_root_path . 'includes/functions.'.$phpEx); //包含了常用函数
include($phpbb_root_path . 'includes/db.'.$phpEx); //包含数据库,其支持mysql,sqlsever,oracle等,其中有对数据库进行各种操作的类和方法
//为了安全,释放数据库的密码
unset($dbpasswd);
if ( defined('IN_CASHMOD') )
{
include($phpbb_root_path . 'includes/functions_cash.'.$phpEx);
}*/?>

解决方案 »

  1.   

    根据代码去手册里查
    http://www.php.net/manual/en/index.php
      

  2.   

    /*
    你这个文件被注释过了。我增加一些。仍然保留此前的注释。
    */
    <?php
    //检查是否被定义过
    //如果其它程序包含了这个文件,将强制终止当前程序
    if ( !defined('IN_EB') ) //检查是否定义了常量
    {
        die("Hacking attempt"); //没定义的话。直接退出。并输出警告。
    }$page_title = '增加一级分类';//若定义了。继续往下走。定义一个变量并赋值。
    //include(INCLUDES . 'header_admin.php');等价的!
    include(INCLUDES . 'header_admin.'.$phpEx);//读文件。该文件名由三部分组成,字符串连接
    include_once(LIBS . 'libs_upload.'.$phpEx);//同上
    include_once(INCLUDES . 'func_image.' . $phpEx);//同上$ArrVar = array( //定义数组并赋值
    'firms'            => (int) 0,
    'serial'        => (int) 0,
    'class_name'    => (string) '',
    'show_innav'    => (int) 0,
    'disabled'        => (int) 0,
    'description'    => (string) ''
    );foreach ($ArrVar as $var => $default)//用foreach遍历数组。
    {    
        /*request_var()这个函数确保读入的变量类型是正确的,并且确保得到恰当的使用。
        所以建议用其替代$HTTP_POST_VARS和$HTTP_GET_VARS。
        有些情况下,如$_POST可以用来检查一个变量是否被提交,但是这样的参数不应该被直接分配给变量使用。*/
        //request_var(页面变量名,默认值,?);
        $$var = request_var($var, $default, true);
    }//处理图片上传
    $imageup = (!empty($HTTP_POST_FILES['imageup']['name'])) ?  $HTTP_POST_FILES['imageup'] : ''; //没有重名的话。就赋值。if($imageup != '')//没重名的话。进行上传操作。
    {
        $ArrayImgUp = array(
        'path_cat'         => $system_config['path_info'],
        'force_height'     => 200,
        'force_width'     => 200,
        'max_height'     => 200,
        'max_width'        => 200,
        'allow_'     => 0
        );
        
        $save_file = upload_img_one($imageup, $ArrayImgUp); // 图片上传    
    }
    else//重名的话。不执行上传操作。
    {
        $save_file = '';
    }$arr_params=array( //这些就看不出来了。估计是此前的定义的一些变量。
    'description'    => $description,
    'serial'        => $serial,
    'path_img'        => $save_file,
    'show_innav'    => $show_innav,
    'class_name'    => $class_name,
    'disabled'        => $disabled,
    );if ($action == 'add')//此段以下与上传关系不大或者是读入页面、模板等。
    {                    
        if( acp_data_add($arr_params, EB_CLASS) )
        {        
            $message = '分类已成功添加!';    
            acp_return(append_sid("/?mod=acp&amp;do=acp_class_add"), $message);
        }
    }$template->assign_vars(array(
    'ACP_CLASS_MANAGE'    => append_sid("/?mod=acp&amp;do=acp_class_manage")
    ));
    // 模板输出
    $template->set_filenames(array(
    'body' => 'acp_class_add.tpl'
    ));
    $template->pparse('body');// 输出footer
    include(INCLUDES . 'footer_admin.' . $phpEx);/*
    //包含进数据库配置文件,其中定义了mysql的版本,数据库用户名和密码,以及数据库名称等信息if( !defined("PHPBB_INSTALLED") )
    {//如果没有安装(安装文件还存在),则跳转到安装文件
    header('Location: ' . $phpbb_root_path . 'install/install.' . $phpEx);
    exit;
    }include($phpbb_root_path . 'includes/constants.'.$phpEx); //这是一个定义了诸多常量的文件
    include($phpbb_root_path . 'includes/template.'.$phpEx); //这是一个定义了模板类的文件
    include($phpbb_root_path . 'includes/sessions.'.$phpEx); //session和cookies的读取写入文件。phpbb中,如果客户端cookies不能使用时,系统将会使用session
    include($phpbb_root_path . 'includes/auth.'.$phpEx); //包含了autn.php文件,其中主要对版块的权限进行了读取
    include($phpbb_root_path . 'includes/functions.'.$phpEx); //包含了常用函数
    include($phpbb_root_path . 'includes/db.'.$phpEx); //包含数据库,其支持mysql,sqlsever,oracle等,其中有对数据库进行各种操作的类和方法
    //为了安全,释放数据库的密码
    unset($dbpasswd);
    if ( defined('IN_CASHMOD') )
    {
    include($phpbb_root_path . 'includes/functions_cash.'.$phpEx);
    }*/?>