<!--#include file="conn.asp"-->
<%if session("nyeee_admin")="" then
response.redirect "login.asp"
end if

dname=HtmlEncode(trim(request.form("dname")))
dusername=HtmlEncode(trim(request.form("username")))
dpassword=HtmlEncode(trim(request.form("password")))
dyewu=HtmlEncode(trim(request.form("dyewu")))
dlei=split(HtmlEncode(trim(request.form("dlei"))),"@")
dfaren=HtmlEncode(trim(request.form("dfaren")))
dpic=HtmlEncode(trim(request.form("dpic")))
dcity=HtmlEncode(trim(request.form("dcity")))
dhttp=HtmlEncode(trim(request.form("dhttp")))
dmail=HtmlEncode(trim(request.form("dmail")))
daddress=HtmlEncode(trim(request.form("daddress")))
dyoubian=HtmlEncode(trim(request.form("dyoubian")))
dtel=HtmlEncode(trim(request.form("dtel")))
dfax=HtmlEncode(trim(request.form("dfax")))
djieshao=HtmlEncode(request.form("djieshao"))
dperson=HtmlEncode(trim(request.form("dperson")))
if dname<>"" then
sql="select * from nyeee_qydata where username='"&dusername&"'"
set rs=server.createobject("adodb.recordset")
rs.open sql,connstr,1,3
if rs.recordcount<>0 then
response.write "<script>alert('此用户名已经存在，请重新选择！');history.back();</script>"
response.end
else
rs.addnew
rs("name")=dname
rs("username")=dusername
rs("password")=dpassword
rs("yewu")=dyewu
rs("leiid")=dlei(0)
rs("lei")=dlei(1)
rs("faren")=dfaren
rs("pic")=dpic
rs("city")=dcity
rs("http")=dhttp
rs("mail")=dmail
rs("address")=daddress
rs("youbian")=dyoubian
rs("tel")=dtel
rs("fax")=dfax
rs("jieshao")=djieshao
rs("person")=dperson
if session("nyeee_admin")<>"" then
rs("mark")="1"
rs("tuijian")=HtmlEncode(trim(request.form("dtuijian")))
end if
rs.update
session("username")=dname
response.redirect "okqy.asp"
end if
end if%>

<html>
<head>
<style type="text/css">
<!-- 
td           { font-size: 12px; line-height: 17px }
body         { font-size: 12px; line-height: 17px }
p            { margin-top: 1; margin-bottom: 1 }
a:link       { text-decoration: none; color: black }
a:visited    { text-decoration: none; color: black }
a:active     { text-decoration: none }
a:hover      { text-decoration: underline; color: red }
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>添加信息</title>
<SCRIPT LANGUAGE="JavaScript">
<!--//
function checkadd()
{   
    if (document.postart.dname.value.length<1)
	{
        alert("单位名称不能为空！");
        document.postart.dname.focus();
        return false;
    }
    if (document.postart.username.value.length<1)
	{
        alert("用户名不能为空！");
        document.postart.username.focus();
        return false;
    }
    if (document.postart.password.value.length<1)
	{
        alert("登录密码不能为空！");
        document.postart.password.focus();
        return false;
    }
    if (document.postart.dcity.value=="选择区域")
	{
        alert("请选择所在区域！");
        document.postart.dcity.focus();
        return false;
    }
    if (document.postart.dlei.value=="选择行业类别")
	{
        alert("请选择行业类别！");
        document.postart.dlei.focus();
        return false;
    }
}
//-->
</SCRIPT>
<script language="Javascript">
function openScript(url, width, height){
	var Win = window.open(url,"openScript",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=no,menubar=no,frameborder=0,status=yes' );
}
function openem()
{ 
openScript('upload.asp',300,60); 
}
</script>
</head>

<body>
 <div align="center">
  <center>
  <form action="" method="post" name="postart" onsubmit="return checkadd()">
  <table border="0" width="100%" cellspacing="0" cellpadding="0" height="489">
    <tr>
      <td width="100%" colspan="2" height="30"><input type="hidden" name="dperson" size="30" value="<%=session("admin")%>"></td>                                      
    </tr>                                        
    <tr>              
      <td width="25%" align="right" height="26">单位名称：</td>                                         
      <td width="76%" height="26"><input type="text" name="dname" size="30"> <font color="#FF0000">*</font></td>                                                                                                                                                 
    </tr>                                                                                                        
    <tr>                                                                         
      <td width="25%" align="right" height="26">用 户 名：</td>                                                                                                                 
      <td width="76%" height="26"><input type="text" name="username" size="30"> <font color="#FF0000">*</font></td>                                                                                                                                                 
    </tr>                                                                         
    <tr>                                                                         
      <td width="25%" align="right" height="26">登录密码：</td>                                                                                                                
      <td width="76%" height="26"><input type="text" name="password" size="30"> <font color="#FF0000">*</font></td>                                                                                                                                                
    </tr>                                                                                                                                     
    <tr>                                                                       
      <td width="25%" align="right" height="26">主营业务：</td>                                                                                                               
      <td width="76%" height="26"><input type="text" name="dyewu" size="50"> </td>                                                                                                                                               
    </tr>                                                                      
    <tr>                                                                                                                                    
      <td width="25%" align="right" height="26">所在区域：</td>                                                                                                                                   
      <td width="76%" height="26">                                                                                                                                   
          <select name="dcity" size="1"><option selected value="选择区域">选择区域</option>                                                                                                                                            
            <%set rs_city = server.createobject("adodb.recordset")                                                                                                                                            
			sql = "select * from city"                                                                                                                                            
			rs_city.open sql,conn,1,1                                                                                                                                            
			do while not rs_city.eof%>                                                                                                                                            
          <option value="<%=rs_city("city")%>"><%=rs_city("city")%></option>                                                                                                                                            
		  <%rs_city.movenext                                                                                                                                            
		  loop                                                                                                                                            
		  rs_city.close                                                                                                                                            
		  set rs_city = nothing%>                                                                                                                                            
         </select> <font color="#FF0000">*</font>                                                                                                                                             
      </td>                                                                                                                                      
    </tr>                                                                         
    <tr>                                                                                                                                     
      <td width="25%" align="right" height="26">行业类别：</td>                                                                                                                                    
      <td width="76%" height="26">                                                                                                                                    
          <select name="dlei" size="1"><option selected value="选择行业类别">选择行业类别</option>                                                                                                                                             
            <%set rs_lei = server.createobject("adodb.recordset")                                                                                                                                             
			sql = "select * from nyeee_lei"                                                                                                                                             
			rs_lei.open sql,conn,1,1                                                                                                                                             
			do while not rs_lei.eof%>                                                                                                                                             
          <option value="<%=rs_lei("id")%>@<%=rs_lei("lei")%>"><%=rs_lei("lei")%></option>                                                                                                                                             
		  <%rs_lei.movenext                                                                                                                                             
		  loop                                            
		  rs_lei.close                                                                                                                                             
		  set rs_lei = nothing%>                                                                                                                                             
         </select> <font color="#FF0000">*</font>                                                                                                                                              
      </td>                                                                                                                                      
    </tr>                                                                  
    <tr>                                                                                                                                      
      <td width="25%" align="right" height="26">单位地址：</td>                                                                                                                                      
      <td width="76%" height="26"><input type="text" name="daddress" size="30"> </td>                                                                                                                                                 
    </tr>                                                                                                                                      
    <tr>                                                                                                                                      
      <td width="25%" align="right" height="26">邮政编码：</td>                                                                                                                                      
      <td width="76%" height="26"><input type="text" name="dyoubian" size="30" maxlength="6"></td>                                                                                                                                      
    </tr>                                                                 
    <tr>                                                                                                                                    
      <td width="25%" align="right" height="26">联 系 人：</td>                                                                                                                                   
      <td width="76%" height="26"><input type="text" name="dfaren" size="30"> </td>                                                                                                                                                 
    </tr>                                                                                                                                      
    <tr>                                                                                                                                      
      <td width="25%" align="right" height="26">联系电话：</td>                                                                                                                                      
      <td width="76%" height="26"><input type="text" name="dtel" size="30"> </td>                                                                                                                                                 
    </tr>                                                                                                                                      
    <tr>                                                                                                                                      
      <td width="25%" align="right" height="26">联系传真：</td>                                                                                                                                      
      <td width="76%" height="26"><input type="text" name="dfax" size="30"></td>                                                                                                                                      
    </tr>                                                                  
    <tr>                                                                                                                                      
      <td width="25%" align="right" height="26">电子信箱：</td>                                                                                                                                      
      <td width="76%" height="26"><input type="text" name="dmail" size="30" value="@"></td>                                                                                                                                      
    </tr>                                                                                                                                                                                                          
    <tr>                                                                                                                                      
      <td width="25%" align="right" height="26">网站地址：</td>                                                                                                                                      
      <td width="76%" height="26"><input type="text" name="dhttp" size="30" value="http://"></td>                                                                                                                                      
    </tr>                                                                                                                                                                                                                                                                                                                          
    <tr>                                                                                                                                     
      <td width="25%" align="right" height="126">详细资料：</td>                                                                                                                                     
      <td width="76%" height="126"><textarea rows="10" name="djieshao" cols="50"></textarea>                                                                                                                                    
      </td>                                                                                                                                             
    </tr>                                                                                                                                                                                                                                       
    <tr>                                                                
      <td width="25%" align="right" height="30">资料图片：</td>                                                                                                                                     
      <td width="76%" height="30"><input type="text" name="dpic" size="30" value=""> [<a href="JavaScript:openem()">上传图片</a>]                                                                
        <font color="#FF0000">无图片请不要修改此项</font></td>                                                                                                                                             
    </tr>                               
    <%if session("nyeee_admin")<>"" then%>                                  
    <tr>                                   
      <td width="25%" align="right" height="30">是否推荐：</td>                                                                                                                                   
      <td width="76%" height="30"><input type="radio" value="no" checked name="dtuijian">不推荐&nbsp;                                   
        <input type="radio" name="dtuijian" value="yes">推荐</td>                                                                                                                                           
    </tr>                                   
    <%end if%>                                                                
  <tr>                                                                                                                               
      <td width="24%" align="right" height="51"> </td>             
      <td width="77%" align="right" height="51">                                                                                                                                 
        <p align="left"><input type="submit" value="提交" name="submit" >&nbsp;                                                  
        <input type="reset" value="取消" name="reset">&nbsp; <input type="button" value="返回" name="cmdexit" onclick=" history.back()"></td>                                                                                                                                     
  </tr>                                                                                                                                                                                                             
  </table>                                                          
  </form>                                                                                                                                     
</div>                                                                                                                                                                                                                                        
</body>                                                                                                                                                                      
                                                                                                                                                                      
</html>                                                                                                                                                                      
