<!--#include file="head.asp"-->
<style>body{background-color: #fff;}</style>

<%
act=SafeRequest("act")

if act="edit" then

sql="select ayisguolv,ayguolvcon from ayquanju" 
rs.open sql,conn,1,1
ayisguolv=rs("ayisguolv")
ayguolvcon=trim(rs("ayguolvcon"))
rs.close

id=SafeRequestform("id")
mingcheng=SafeRequestform("mingcheng")
if mingcheng="" then call PopErr("分类名称未填写")
shunxu=SafeRequestform("shunxu")
if shunxu="" then call PopErr("分类顺序未填写")
ayshmiaoshu=SafeRequestform("ayshmiaoshu")
ayshurl=SafeRequestform("ayshurl")
ayshqq=SafeRequestform("ayshqq")

if ayisguolv=1 then
if guolvRequestform("mingcheng",ayguolvcon)=false then 
call logadd(request.Cookies("aynameid"),"修改分类含有敏感文字"&mingcheng,0,1) 
call PopErr(""&ayguolvcon&"，以上敏感词语禁用哦！")
end if
if guolvRequestform("ayshmiaoshu",ayguolvcon)=false then 
call logadd(request.Cookies("aynameid"),"修改分类描述含有敏感文字"&ayshmiaoshu,0,1) 
call PopErr(""&ayguolvcon&"，以上敏感词语禁用哦！")
end if
if guolvRequestform("ayshurl",ayguolvcon)=false then 
call logadd(request.Cookies("aynameid"),"修改分类商户url含有敏感文字"&ayshurl,0,1) 
call PopErr(""&ayguolvcon&"，以上敏感词语禁用哦！")
end if
end if

if instr(1,trim(mingcheng),"|")<>0 then call PopErr("分类名称,字符 | 不可以使用哦，请重新填写！")
if instr(1,trim(ayshmiaoshu),"|")<>0 then call PopErr("分类描述,字符 | 不可以使用哦，请重新填写！")
if instr(1,trim(ayshurl),"|")<>0 then call PopErr("分类网址,字符 | 不可以使用哦，请重新填写！")

sql="select * from aykafenlei where aykafenleiid="&clng(id)&" and aykanamesuoyou="&request.Cookies("aynameid")&"" 
rs.open sql,conn,1,3
if rs.bof and rs.eof then 
call PopErr("获取分类信息错误")
else

rs("aykafenleiname")=mingcheng
rs("aykafenleisx")=clng(shunxu)

if ayshmiaoshu<>"" then 
rs("aykafenleishuoming")=ayshmiaoshu
else
rs("aykafenleishuoming")=" "
end if

if ayshurl<>"" then 
rs("aykafenleiurl")=ayshurl
else
rs("aykafenleiurl")=" "
end if 

if ayshqq<>"" then 
rs("aykafenleiqq")=ayshqq
else
rs("aykafenleiqq")=0
end if

if isnull(trim(rs("aykafenleimd5")))=true or trim(rs("aykafenleimd5"))="" then rs("aykafenleimd5")=trim(MD5d(rs("aykafenleiid")))
if isnull(trim(rs("ayfldlmd5url")))=true or trim(rs("ayfldlmd5url"))="" then rs("ayfldlmd5url")=trim(md5user(rs("aykafenleiid")))



rs.update
rs.close
call logadd(request.Cookies("aynameid"),"分类修改成功"&left(mingcheng,20),5,0)
call PopErr2("分类信息修改成功","fenlei")
end if

end if


id=SafeRequest("id")
if id="" then call PopErr("获取参数错误")

%>

<script language=javascript>
function CheckIfEnglish( String )<!--检验表单必须是字母或数字-->
{ 
    var Letters = "abcdefghijklmnopqrstuvwxyz0123456789-";
     var i;
     var c;
      if(String.charAt( 0 )=='-')
	return false;
      if( String.charAt( String.length - 1 ) == '-' )
          return false;
     for( i = 0; i < String.length; i ++ )
     {
          c = String.charAt( i );
	  if (Letters.indexOf( c ) < 0)
	     return false;
     }
     return true;
}
function CheckIfid( String )<!--检验表单必须是数字-->
{ 
    var Letters = "1234567890";
     var i;
     var c;
      if(String.charAt( 0 )=='-')
	return false;
      if( String.charAt( String.length - 1 ) == '-' )
          return false;
     for( i = 0; i < String.length; i ++ )
     {
          c = String.charAt( i );
	  if (Letters.indexOf( c ) < 0)
	     return false;
     }
     return true;
}
function Checkjinid( String )<!--检验表单必须是数字-->
{ 
    var Letters = "1234567890.";
     var i;
     var c;
      if(String.charAt( 0 )=='-')
	return false;
      if( String.charAt( String.length - 1 ) == '-' )
          return false;
     for( i = 0; i < String.length; i ++ )
     {
          c = String.charAt( i );
	  if (Letters.indexOf( c ) < 0)
	     return false;
     }
     return true;
}
function ischinese(s)<!--检验表单必须是中文-->
{
var ret=true;
for(var i=0;i<s.length;i++)
ret=ret && (s.charCodeAt(i)>=10000);
return ret;
}
</script>
<script language=javascript>
function check_add()
{
  
   if(form.shunxu.value=="" || !CheckIfid(form.shunxu.value))
   {alert("分类顺序填写错误");return false}
   
   if(form.mingcheng.value=="" || form.mingcheng.value.length > 25)
   {alert("分类名称填写错误");return false}
   
    if (form.ayshmiaoshu.value.length > 60){
	alert ("商户描述字符不能超过60");return false;	}

  	if (form.ayshurl.value.length > 60){
	alert ("商户网址字符不能超过60");return false;	}
	
	if(form.ayshqq.value!=""){
  	if (!CheckIfid(form.ayshqq.value) || form.ayshqq.value.length < 5){
	alert ("商户QQ填写错误");return false;	}
	if (!CheckIfid(form.ayshqq.value) || form.ayshqq.value.length > 12){
	alert ("商户QQ填写错误");return false;	}
	}
   
}
</script>

<main>
<div  class="container">
<div class="ui-lrctnei">
<%call userleft()%>
<div class="r"> 
<div class="ui-content">
                        
					
                            
<div class="neiye">
            
            <!-------------------------------------- 开始 -------------------------------------->
                        <div class="neibiaoti"></div>
           				<div class="neibiaoti2">分类编辑</div>
                		<div class="gexian"></div>
						  <% 
                          sql="select * from aykafenlei where aykafenleiid="&clng(id)&" and aykanamesuoyou="&request.Cookies("aynameid")&"" 
                          rs.open sql,conn,1,1
                          if rs.bof and rs.eof then 
                          call PopErr("获取分类数据错误")
                          end if
                          %>
                    	<form action="?act=edit" method="post" name="form" id="form" onSubmit="return check_add()">
                        <table class="neitableanquan">
           		  		<tr>
                            <td align="center" width="110">分类名称：</td>
                            <td width="300"><input name="mingcheng" type="text" id="mingcheng" value="<%=server.HTMLEncode(trim(rs("aykafenleiname")))%>" maxlength="25" class="reginput"></td>
                          <td><div class="regtd" > 商品分类名称</div></td>
                        </tr>
                 		<tr>
                            <td align="center">分类排序：</td>
                            <td><input name="shunxu" type="text" id="shunxu" value="<%=rs("aykafenleisx")%>" maxlength="4" class="reginput"></td>
                            <td><div class="regtd" > 数字越小越靠前</div></td>
                        </tr>
                 		<tr>
                            <td align="center">分类说明：</td>
                            <td>
							<input name="ayshmiaoshu" type="text" id="ayshmiaoshu" value="<%if isnull(trim(rs("aykafenleishuoming")))=true or trim(rs("aykafenleishuoming"))="" then response.Write" ":else:response.Write server.HTMLEncode(trim(rs("aykafenleishuoming"))):end if%>" size="40" maxlength="80" class="reginput">
                          </td>
                            <td><div class="regtd" > 显示在商品购买页面 不超过40汉字</div></td>
                        </tr>
                 		<tr>
                            <td align="center">分类网址：</td>
                            <td>
							<input name="ayshurl" type="text" id="ayshurl" value="<%if isnull(trim(rs("aykafenleiurl")))=true or trim(rs("aykafenleiurl"))="" then response.Write" ":else:response.Write server.HTMLEncode(trim(rs("aykafenleiurl"))):end if%>" size="40" maxlength="80" class="reginput">
                          </td>
                            <td><div class="regtd" > 以http://开头完整地址</div></td>
                        </tr>
                 		<tr>
                            <td align="center">分类QQ：</td>
                            <td><input name="ayshqq" type="text" id="ayshqq" value="<%if trim(rs("aykafenleiqq"))<>0 then response.Write trim(rs("aykafenleiqq"))%>" maxlength="12" class="reginput"></td>
                            <td><div class="regtd" > 若为空，商品出售页面则显示商户信息中的联系QQ</div></td>
                        </tr> 
                        
                 		<tr>
                            <td><input name="id" type="hidden" id="id" value="<%=id%>"></td>
                            <td height="60"> <input type="submit" name="Submit" style="cursor:pointer"  class="logindlreg" value=" 确 认 修 改 "></td>
                        </tr>
                    </table>
                    </form>
            <!-------------------------------------- 结束 -------------------------------------->

            <div class="gexian20"></div>
            <div class="mzsmbox2" style="padding-top:20px;">
            商品排序：排序数值越小，排位越靠前，如：排序90的会在排序100之上，在购买页面的商品列表会以此排序<br>
			如果商品分类网址和商品分类QQ未设置，则直接显示商家预留QQ信息<br>
            如果商品说明和商品QQ未设置，则显示商品分类的相关预留信息。
            </div>

        <div class="clearfix"></div>
        


</div>








</div>
</div>
</div>
</div>
</main>


<footer>
<div class="container">
</div>
</footer>

</body>
</html>