<%@ page contentType="text/html;charset=GBK" %>
<%@ include file="../checkLogin.jsp" %>
<%@ page import="java.sql.*,gbase.db.*,java.util.*,gbase.init.*,gbase.util.*"%>
<%
	
	String message="操作失败";
	String action = request.getParameter("action")==null?"":request.getParameter("action");
	String url="web_info_content.jsp?action="+action;
	DBOperation theDBOperation = new DBOperation();
	
	String web_id=request.getParameter("web_id")==null?"":request.getParameter("web_id");
        String web_name=request.getParameter("web_name")==null?"":request.getParameter("web_name");
        String old_web_url=request.getParameter("old_web_url")==null?"":request.getParameter("old_web_url");
        String web_url=request.getParameter("web_url")==null?"":request.getParameter("web_url").trim();
        String web_type=request.getParameter("web_type")==null?"":request.getParameter("web_type");
        String web_keywords=request.getParameter("web_keywords")==null?"":request.getParameter("web_keywords");
        String web_description=request.getParameter("web_description")==null?"":request.getParameter("web_description");
        String web_user_type=request.getParameter("web_user_type")==null?"":request.getParameter("web_user_type");
        String web_enterprise_name=request.getParameter("web_enterprise_name")==null?"":request.getParameter("web_enterprise_name");
        String web_enterprise_address=request.getParameter("web_enterprise_address")==null?"":request.getParameter("web_enterprise_address");
        String web_contacter_name=request.getParameter("web_contacter_name")==null?"":request.getParameter("web_contacter_name");
        String web_contacter_telno=request.getParameter("web_contacter_telno")==null?"":request.getParameter("web_contacter_telno");
        String web_contacter_email=request.getParameter("web_contacter_email")==null?"":request.getParameter("web_contacter_email");
        String web_contacter_qq=request.getParameter("web_contacter_qq")==null?"":request.getParameter("web_contacter_qq");
        String web_jive_flag=request.getParameter("web_jive_flag")==null?"":request.getParameter("web_jive_flag");
	String web_jive_desc=request.getParameter("web_jive_desc")==null?"":request.getParameter("web_jive_desc");
	String real_url=request.getParameter("real_url")==null?"":request.getParameter("real_url");
	if(real_url.equals(""))real_url="/my_cms_images/logo.jpg";
	String sql="";
	int url_update_flag=1;
	if(!web_url.equals(""))
	{
        sql = "select web_account from web_info  where web_url='"+web_url+"' and web_account!='"+web_account+"'";
        ResultSet rs =theDBOperation.getResultSet(sql);
        if(rs.next())
          url_update_flag=0;
        }
   if(web_url.equals("") || url_update_flag==1){
	if(action.equals("update"))
	{ 
	  sql="update web_info set web_url='"+web_url+"',web_name='"+web_name+"',web_type='"+web_type+"',web_keywords='"+web_keywords+"',web_description='"+web_description+"',web_user_type='"+web_user_type+"',web_enterprise_name='"+web_enterprise_name+"',web_enterprise_address='"+web_enterprise_address+"',web_contacter_telno='"+web_contacter_telno+"',web_contacter_email='"+web_contacter_email+"',web_contacter_qq='"+web_contacter_qq+"',web_jive_flag='"+web_jive_flag+"',web_jive_desc='"+web_jive_desc+"',real_url='"+real_url+"'  where web_account='"+web_account+"'";
	}
	
	
      try {
        int i=theDBOperation.executeSql(sql);
        if(i>0)
          {
          DataProcess theDataProcess=new DataProcess();
          theDataProcess.webInfoSave("","",web_account,web_url,action);
          message = "操作成功!";
          }
        else
          message = "操作失败!";
      }
      catch (Exception ex) {
        message = "操作失败!";
      }
    }
    else
    {
     message="域名"+web_url+"已经被别人使用了，如果域名"+web_url+"是你的，请把域名"+web_url+"解析到111.111.111.111并发邮件到xiantianyou@163.com，请管理员进行确认。";
    }	
%>
<script language="javascript">
	function process ( message,url){
		alert(message);
		self.location = url;
	}
</script>
<html>
	<head>
		<title></title>
	</head>
	<body onload="javascript: process('<%=message%>','<%=url%>');">
	</body>
</html>