<?php
/*
乘风下载管理系统
作者QQ：178575
作者Email：yliangcf@163.com
作者网站：http://www.qqcf.com
详细简介：http://www.qqcf.com/cfdown.htm
上面有程序在线演示，安装演示，使用疑难解答，最新版本下载等内容
因为这些内容可能时常更新，就没有放在程序里，请自己上网站查看
*/
?>
<?php 
$id=ChkStr($_REQUEST["id"],2);

$Sql="Select * From cfdown_info where id=".$id;
$Result=mysql_query($Sql);
if(!$Rs=mysql_fetch_assoc($Result)) die('记录不存在');
?>

<script>
function infomodifycheck(){

var assort = document.form_infoadd.assort.value;
var title = document.form_infomodify.title.value;
var downurl = document.form_infoadd.downurl.value;
var addtime = document.form_infomodify.addtime.value;
var listid = document.form_infomodify.listid.value;

var infokeyword = document.form_infomodify.infokeyword.value;
var infodesc = document.form_infomodify.infodesc.value;
var infolabel = document.form_infomodify.infolabel.value;


if (assort==""){
 window.alert ('请选择分类!');
 document.form_infomodify.assort.focus();
 return false;
}

if(title==""){
 alert ('标题必须填写');
 document.form_infomodify.title.focus();
 return false;
}

if(addtime==""){
 alert ('时间必须填写');
 document.form_infomodify.addtime.focus();
 return false;
}

if(listid==""){
 alert ('置顶数字必须填写');
 document.form_infomodify.listid.focus();
 return false;
}

if(listid<0){
 alert ('置顶数字必须大于或等于0');
 document.form_infomodify.listid.focus();
 return false;
}

if (infokeyword!=""&&getByteLen(infokeyword)>255){
 alert ('允许最长字符数:255个,已输入字符数:'+getByteLen(infokeyword)+'个,输入过多请减少');
 document.form_infomodify.infokeyword.focus();
 return false;
}

if (infodesc!=""&&getByteLen(infodesc)>255){
 alert ('允许最长字符数:255个,已输入字符数:'+getByteLen(infodesc)+'个,输入过多请减少');
 document.form_infomodify.infodesc.focus();
 return false;
}

if (infolabel!=""&&getByteLen(infolabel)>255){
 alert ('允许最长字符数:255个,已输入字符数:'+getByteLen(infolabel)+'个,输入过多请减少');
 document.form_infomodify.infolabel.focus();
 return false;
}

return true;
}


function getByteLen(val) {
var len = 0;

for (var i = 0; i < val.length; i++) {
 var a = val.charAt(i);
 if (a.match(/[^\x00-\xff]/ig) != null){
  len += 2;
 }else{
  len += 1;
 }
}

return len;
}


var chars = ['0','1','2','3','4','5','6','7','8','9','a','b','d','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','D','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];

function generateMixed(n) {
     var res = "";
     for(var i = 0; i < n ; i ++) {
         var id = Math.ceil(Math.random()*61);
         res += chars[id];
     }
     return res;
}
</script>

<a href="<?php echo ChkStr($_SERVER["HTTP_REFERER"],1)?>" class="actionBtn" style="margin-top:10px;">返回列表</a>

  <form id="form_infomodify" name="form_infomodify" method="post" action="?action=infomodifysave&id=<?php echo $id;?>&refurl=<?php echo urlencode($_SERVER["HTTP_REFERER"]);?>" onsubmit="return infomodifycheck()">
<table class="tb_1"><tr class="tr_1"> 
      <td colspan="2">下载修改</td>
    </tr>
<tr>
  <td class="td_r">用户：</td>
  <td><?php echo $Rs["username"];?></td>
</tr>
    <tr> 
      <td width="150" class="td_r">分类：</td>
      <td>
      
<select name="assort" id="assort">
<option  value="">请选择分类</option>
<?php 
$Sql="Select * From cfdown_infoclass Order By id";

$Result2=mysql_query($Sql);
while($Rs2=mysql_fetch_assoc($Result2))
{

?>
<option value="<?php echo $Rs2["id"];?>"<?php if ($Rs["assort"]==$Rs2["id"]) echo " selected";?>><?php echo $Rs2["infoclassname"];?></option>
<?php 
} 
?>
</select>*必选项

		
		</td>
    </tr>
	
	<tr>
      <td class="td_r">标题：</td>
      <td><input name="title" type="text" id="title" value="<?php echo htmlspecialchars($Rs["title"]);?>" size="82">*必填项</td>
    </tr>
    
        <tr>
          <td class="td_r">大小：</td>
          <td><input name="filesize" type="text" id="filesize" value="<?php echo $Rs["filesize"];?>" size="20" />(K或M或G)</td>
        </tr>
        
    <tr> 
      <td class="td_r">内容：</td>
      <td>
<input type="hidden" id="content" name="content" value="<?php echo htmlspecialchars($Rs["content"]);?>" style="display:none" /><input type="hidden" id="FCKeditor1___Config" value="" style="display:none" /><iframe id="FCKeditor1___Frame" src="../../js/FckEditor/editor/fckeditor.html?InstanceName=content&amp;Toolbar=Default" width="530" height="350" frameborder="0" scrolling="no"></iframe></td>
    </tr>
        <tr>
          <td class="td_r">下载地址：</td>
          <td><input name="downurl" type="text" id="downurl" size="82" value="<?php echo $Rs["downurl"];?>" />*必填项</td>
        </tr>
    <tr>
      <td class="td_r">下载缩短唯一字符：</td>
      <td><input name="idstr" type="text" id="idstr" value="<?php echo $Rs["idstr"];?>" size="20" readonly style='background:#e8e8e8;'> <a  href="javascript:;" onclick='document.getElementById("idstr").readOnly=false;document.getElementById("idstr").style.background="#ffffff";'>*设置成可修改</a></td>
    </tr>
    
<script>
$(function(){
 $("#downsite_0").click(function(){$("#t_downsite_0").show();$("#t_downsite_1").show();});
 $("#downsite_1").click(function(){$("#t_downsite_0").hide();$("#t_downsite_1").show();});

 $("#downsite_<?php echo $Rs["downsite"];?>").click();
});
</script>
          <td class="td_r">下载位置</td>
         <td><input type="radio" name="downsite" value="0" id="downsite_0"<?php if($Rs["downsite"]==0) echo " checked";?>>
        外部服务器
         <input name="downsite" type="radio" id="downsite_1" value="1"<?php if($Rs["downsite"]==1) echo " checked";?>>
        内部服务器 
</td>
        </tr>
        <tr id="t_downsite_0">
          <td class="td_r">外部提取密码:</td>
          <td><input name="outpwd" type="text" id="outpwd" value="<?php echo $Rs["outpwd"];?>" size="20" />不需密码下载请留空,这里是指下载地址为百度、蓝奏等类的下载地址如地址需要密码时填写在这里</td>
        </tr>
		
    <tr id="t_downsite_1">
      <td class="td_r">内部提取密码:</td>
      <td><input name="pwd" type="text" id="pwd" value="<?php echo $Rs["pwd"];?>" size="20">不需密码下载请留空，<a href="javascript:" onclick="$(function () { confirm('确认要使用随机值吗，生成随机值后需再提交表单才生效?', '', function (isConfirm) {if (isConfirm) {document.getElementById('pwd').value=generateMixed(4);}}, {confirmButtonText: '确定', cancelButtonText: '取消', width: 400});});">点击这里取四位随机值</a>，这里是指打开本系统内这个下载的页面时需要的密码</td>
    </tr>

    <tr>
      <td class="td_r">加入时间：</td>
      <td><input name="addtime" type="text" id="addtime" value="<?php echo $Rs["addtime"];?>" size="20">*必填项</td>
    </tr>
    <tr>
      <td class="td_r">最后访问时间：</td>
      <td><input name="lasttime" type="text" id="lasttime" value="<?php echo $Rs["lasttime"];?>" size="20" readonly style='background:#e8e8e8;'></td>
    </tr>
    <tr>
      <td class="td_r">置顶数字：</td>
      <td><input name="listid" type="text" id="listid" value="<?php echo $Rs["listid"];?>" size="5">*必填项(0不置顶，大于0则置顶且数字越大越在上，数字相同越晚发布越在上)</td>
    </tr>
    
   
<tr class="tr_1"> 
      <td colspan="2">SEO信息</td>
    </tr>
    <tr>
      <td class="td_r">文章关键字：</td>
      <td><input name="infokeyword" type="text" id="infokeyword" size="82"  value="<?php echo $Rs["infokeyword"];?>"></td>
    </tr>
    <tr>
      <td class="td_r">文章描述：</td>
      <td><input name="infodesc" type="text" id="infodesc" size="82"  value="<?php echo $Rs["infodesc"];?>"></td>
    </tr>
    <tr>
      <td class="td_r">文章标签：</td>
      <td><input name="infolabel" type="text" id="infolabel" size="82"  value="<?php echo $Rs["infolabel"];?>"></td>
    </tr>
    
    <tr> 
    <td></td>
      <td> 
          <input type="submit" name="Submit33222" value="修改" class="btn">      </td>
    </tr>
</table>
  </form>

