<!--#include file="../include/Conn.asp"-->
<!--#include file="../Include/Char.asp" -->
<!--#include file="../include/md5.asp"-->
<!--#include file="Admin_IsLogin.asp" -->
<%
'Define Variable 
dim i
dim rs
dim mGrade,mSql,mFlag,mBgColor

'initialization 
mFlag=true'add

'Display
if request("action")="edit" then 
 'Read
 mSql="Select * From T_cnpuser Where F_ID="&Request.QueryString("ModifyID")
 Set rs = conn.Execute(mSql)
 if Not rs.Eof then 
   mUserName = rs("F_UserName")
   mPassword = rs("F_Password")
   mQuestion = rs("F_Question")
   mAnswer = rs("F_Answer")
   mIntegral = rs("F_Integral")
   mRealName = rs("F_RealName")
   mEmail = rs("F_Email")
   mAddress = rs("F_Address")
   mTel = rs("F_Tel")
   mFax = rs("F_Fax")
   mMobile = rs("F_Mobile")
   mCompanyName = rs("F_CompanyName")
   'mGrade = rs("F_Grade")
   mMemo = rs("F_Memo")
 End if
 mFlag=false
 rs.Close
End if

if Request.ServerVariables("REQUEST_METHOD")="POST" then
   mUserName = checkStr(Trim(Request.Form("txtUserName")))
   mQuestion = checkStr(Trim(Request.Form("txtQuestion")))
   mPassword = checkStr(Trim(Request.Form("txtPassword")))
   mAnswer = checkStr(Trim(Request.Form("txtAnswer")))
   mRealName = checkStr(Trim(Request.Form("txtRealName")))
   mEmail = checkStr(Trim(Request.Form("txtEmail")))
   mTel = checkStr(Trim(Request.Form("txtTel")))
   mMobile = checkStr(Trim(Request.Form("txtMobile")))
   mFax = checkStr(Trim(Request.Form("txtFax")))
   mAddress = checkStr(Trim(Request.Form("txtAddress")))
   mCompanyName = checkStr(Trim(Request.Form("txtCompanyName")))
   mMemo = checkStr(rTrim(Request.Form("txtMemo")))
   if Request("action")="Insert" then
    mSql = "Select * From T_cnpuser Where F_UserName='"&mUserName&"'"
	Set rs = conn.Execute(mSql)
	if not rs.Eof then
	   rs.Close
	   call msgbox("对不起，该用户名已存在，请更换用户名后再试",1)
	   Response.end
	else
	  rs.Close
	  mSql = "Insert Into T_cnpuser(F_UserName,F_Password,F_Question,F_Answer,F_RealName,F_Email,F_Tel,F_Address,F_Fax,F_Mobile,F_CompanyName,F_Memo,F_IsCheck)"
	  mSql = mSql + "Values('"&mUserName&"','"&md5(mPassword)&"','"&mQuestion&"','"&mAnswer&"','"&mRealName&"','"&mEmail&"','"&mTel&"','"&mAddress&"','"&mFax&"','"&mMobile&"','"&mCompanyName&"','"&mMemo&"',1)"
      conn.Execute(mSql)
      response.redirect "Admin_use.asp?action=IsInsert&pageno="&Request("pageno")
     end if '//rs.eof
  else 
      mSql = "UPDATE T_cnpuser SET"
	  mSql = mSql+" F_UserName='"&mUserName&"',"
      if mPassword <> "" then  mSql = mSql+" F_Password='"&md5(mPassword)&"',"
      mSql = mSql+" F_Question='"&mQuestion&"',"
      mSql = mSql+" F_Answer='"&mAnswer&"',"
      mSql = mSql+" F_RealName='"&mRealName&"',"
      mSql = mSql+" F_Email='"&mEmail&"',"
      mSql = mSql+" F_Address='"&mAddress&"',"
      mSql = mSql+" F_Fax='"&mFax&"',"
      mSql = mSql+" F_Mobile='"&mMobile&"',"
      mSql = mSql+" F_Tel='"&mTel&"',"
      mSql = mSql+" F_CompanyName='"&mCompanyName&"',"
      mSql = mSql+" F_Grade='"&mGrade&"',"
      mSql = mSql+" F_Memo='"&mMemo&"'" 
      mSql = mSql +" WHERE F_ID=" & Request("ModifyID") 
      conn.Execute(mSql)
      Response.redirect "Admin_use.asp?action=IsModify&pageno="&Request("pageno")
   End if
 End if

'Delect Records
if request("action")="Delete" then
  mSql = "DELETE FROM T_cnpuser WHERE F_ID=" &Request.QueryString("DeleteID")
  conn.execute mSql
  Response.write "<script>location.replace('Admin_use.asp?action=IsDelete&pageno="&Request.Querystring("pageno")&"')</script>"
end if
%>

<html>
<head>
<title></title>
<META http-equiv=Content-type content="text/html; charset=gb2312">
<link href="Images/Style.css" rel="stylesheet" type="text/css">
<SCRIPT language="JavaScript">
function jDelete(url)
{
  if((confirm(" 警告:请确定是否删除,删除后不能恢复! "))==true) 
	self.location=url+'&action=Delete';
}
</SCRIPT>
<script language="javascript">
function CheckData(){
  if (document.form1.txtUserName.value=="")
   {
    alert("对不起,用户名不能为空，请输入！");
	document.form1.txtUserName.focus();
	return false;
   }
}
</script>
</head>
<body text="#000000" >
	  <%
      admin_flag="06"
      if instr(session("flag1"),admin_flag)=0 or isnull(session("flag1"))=true then
         Response.write "<br><br><br><br><b><font color=red>对不起，您没有管理本页面的权限!</font></B>"
		 Response.end
	  end if
      %>
<br>
<table class=tableBorder width="95%" border="0" align="center" cellpadding="2" cellspacing="1">
  <tr> 
    <th height=22 colspan="7" align="center" sytle="line-height:150%">企业用户列表</th>
  </tr>
  <tr > 
    <td width="6%" align="center" class=forumHeaderBackgroundAlternate><b>ID</b></td>
    <td width="13%" class=forumHeaderBackgroundAlternate><div align="center"><strong>用户名</strong></div></td>
    <td width="14%" align="center" class=forumHeaderBackgroundAlternate><strong>注册时间</strong></td>
    <td width="23%" align="center" class=forumHeaderBackgroundAlternate><strong>公司名称</strong></td>
    <td width="16%" align="center" class=forumHeaderBackgroundAlternate><strong>公司电话</strong></td>
    <td width="14%" align="center" class=forumHeaderBackgroundAlternate><strong>联系人</strong></td>
    <td width="14%" align="center" class=forumHeaderBackgroundAlternate><b>管理[<font color="#FF0000">删除</font>]</b></td>
  </tr>
  <%
  
       pgno=request("pageno")
	   if pgno="" or pgno<0 then pgno=1
	   response.Cookies("onepage1")=18
      
	   set rs=server.createobject("adodb.recordset")
         sql="select * from  T_cnpuser order by id desc"
         rs.open sql,conn,1,1 
	 if not rs.eof then
	   
	  rs.movefirst
	 
	   rs.pagesize=request.Cookies("onepage1")
	   maxpage=rs.pagecount
	   
	   if rs.recordcount>0 then
	      rs.movefirst
		  rs.absolutepage=cint(pgno)
		end if
	
		   preno=pgno-1
		   postno=pgno+1
	 
	end if

%>
 <%j=0
   i=0
   do while not rs.eof and j<rs.pagesize
      recno=(pgno-1)*rs.pagesize+1
       i=i+1
 
  %>
  <tr bgcolor="<%=mColor%>"   onMouseOut="this.style.backgroundColor=''" onMouseOver="this.style.backgroundColor='#EBEEF6'" > 
    <td  class=forumRow width="6%" align="center"><strong><%=i%></strong></td>
    <td align="center" class=forumRow><%=rs("F_Username")%></td>
    <td class=forumRow width="14%" align="center" ><%=rs("F_Date")%></td>
    <td class=forumRow width="23%" align="center" ><%=rs("F_Company")%></td>
    <td class=forumRow align="center" ><%=rs("F_Tel")%></td>
    <td align="center" class=forumRow ><%=rs("F_Offname")%></td>
    <td class=forumRow width="14%" align="center" ><a href='Company_info_update.asp?id=<%=rs("id")%>'>修改</a> | <a href='Admin_job_delet.asp?al=1&y=0&id=<%=rs("id")%>' onclick="{if(confirm('确定删除选定的纪录吗?')){return true;}return false;}">删除</a></td>
  </tr>
  <%
  j=j+1
  rs.movenext
 loop
  %>
  <tr bgcolor="<%=mColor%>"   onMouseOut="this.style.backgroundColor=''" onMouseOver="this.style.backgroundColor='#EBEEF6'" > 
    <td class=forumRow  colspan="7" align="center">
	<% if rs.recordcount<>0 then%>
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr> 
          <td width="19%"><font color="#FF0000">共有:[<%=rs.recordcount%>]&nbsp;条记录&nbsp;&nbsp; 
            </font></td>
          <td width="51%"><a href="?pageno=1" title="首页">首页</a> 
            <% if preno>0 then%>
            <a href="?pageno=<%=preno%>" title="上一页">上一页</a> 
            <%else%>
            上一页 
            <% end if%>
            <%if postno<=maxpage then%>
            <a href="?pageno=<%=postno%>" title="下一页">下一页</a> 
            <%else%>
            下一页 
            <%end if%>
            <a href="?pageno=<%=maxpage%>" title="末页">末页</a></td>
          <td width="30%"><div align="right"><font color="#4572E7">第<font color="#FF0000"><%=pgno%></font>页/共<font color="#FF0000"><%=maxpage%></font>页</font></div></td>
        </tr>
      </table>
	  <%else
	    response.Write "<center><font color=ff00000>对不起！暂无未申招聘信息</font></center>"
	  %>
	   
	  <%end if%>
	  </td>
  </tr>
</table>
</body>
</html>
