<?php
include('./data/config.php');
include('./core/db.fun.php');
include('./core/t.fun.php');
include('./core/page.fun.php');

$tag['<#url#>']        = $config['url'];
$tag['<#sitename#>']   = $config['sitename'];
$tag['<#description#>']= $config['description'];
$tag['<#keywords#>']   = $config['keywords'];
$tag['<#beian#>']      = $config['beian'];
$tag['<#tongji#>']     = stripslashes($config['tongji']);
$tag['<#dtime#>']     = time();

$id   = trim($_POST['id']);
$pass =trim($_POST['pass']);
if(!check_code($id)){die('page:erreo_code_Invalid!');}
$con  = id_info($id);
if(!$con){die('文件ID无效，文件不存在或者已被删除');}
if($pass == $con['pass'])
{
	if(isset($_POST['change']))
	{
		$files['id']   = $id;
	    $files['name'] = $_POST['name'];
	    $files['pro'] = $_POST['pro'];
	    $files['po'] = $_POST['po'];
	    $files['pass'] = $_POST['pass'];
	    $files['des'] = strip_tags($_POST['des'],'<p>');
	    update_info($files);
	}
}
if($pass == $con['pass'])
    {
		if($_POST['change'] == '0')
		{$con  = id_info($id);}
	    $file = file_info($id);
		$pro  = $con['pro'];
	    if($pro == 1)
		{$tag['<#pro#>'] =  '<input name="pro" type="radio" style="width:14px;" value="1" checked="checked" /> 开启 <input type="radio" name="pro" value="0"  style="width:14px;" /> 关闭';}
		if($pro == 0)
		{$tag['<#pro#>'] =  '<input name="pro" type="radio" style="width:14px;" value="1"  /> 开启 <input type="radio" name="pro" value="0"  style="width:14px;" checked="checked" /> 关闭';}
		$tag['<#name#>'] = $con['name'];
        $tag['<#size#>'] = size_info($file['size']);
        $tag['<#type#>'] = $file['type'];
        $tag['<#up#>']   = date('Y.m.d H:s',$file['up']);
		$tag['<#dt#>']   = date('Y.m.d H:s',$file['dt']);
        $tag['<#down#>'] = $file['down'];
        $tag['<#des#>']  = $file['des'];
		$tag['<#po#>']   = $con['po'];
		$tag['<#link#>'] = $config['url'].'/t.php/'.$id.'.html';
		$tag['<#id#>']   = $id;
		$tag['<#pass#>'] = $pass;
		echo html_mod('g',$tag);
	}
else
    {
		die('登录失败：密码或ID错误！');
    }
?>