<?php
@session_start();
include('checkstate.php');
include('function.php');
$id=$_GET['id'];
if($_GET['do']=='add'){       
     $languageid=$_POST['languageid'];
     $companyid=$_POST['companyid'];
     $url=$_POST['url'];  
	 $jsqid=$_POST['jsqid'];
	 $state=$_POST['state'];	 
	 $sql="insert into website(languageid,comid,weburl,jsqid,state) value('".$languageid."','".$companyid."','".$url."','".$jsqid."','".$state."')";
	 mysql_query($sql);
	 echo "<script type='text/javascript'>alert('添加成功');</script>";
 } 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ETW国际案例演示</title>
<link rel="stylesheet" href="media/css.css" type="text/css" media="screen" />
</head>

<body>
<div id="main">
     <div id="top"><a href="loginout.php" title="退出">退出</a></div>
     <div id="menu"><ul>
         <li><a href="index.php">管理首页</a></li><li><a href="allcompany.php">案例企业</a></li><li><a href="keymanage.php">关键字</a></li><li><a href="accountmangage.php">帐户管理</a></li>
     </ul></div>
     
     <div id="center">
        <div id="left">
        <div class="title"><strong>行业分类案例</strong></div>
            <div class="grade"><ul>
              <li><a href="allcompany.php?id=1"><img src="img/grade_img1.jpg" />上市公司</a></li>
              <li><a href="allcompany.php?id=2"><img src="img/grade_img2.jpg" />龙头企业</a></li>
              <li><a href="allcompany.php?id=3"><img src="img/grade_img3.jpg" />中小型企业</a></li>
            </ul></div>
        </div>
        
        <div id="right">
          <div class="location"><strong>当前位置 : 管理首页>> 添加站体</strong></div>
          <div id="content">
         <div class="tablelist">
          <form name="form1" action="comweb.php?id=<?php echo $id; ?>&do=add" method="post" onsubmit="return checknull()">
          <table width="500" border="0" class="table2">
  <tr><td colspan="2"  style="padding-left:180px; font-size:16px; height:30px;">添加站体</td> </tr>
  <tr>
  <tr>
    <td  align="right">公司名称:</td>
    <td><select name="companyid" id="companyid"><option value="">请选择公司名称</option>
<?php $sql="select company, id from custom order by gradeid asc";
	$result=mysql_query($sql);
	while($rs=mysql_fetch_array($result)){ echo "<option value='".$rs['id']."'>".$rs['company']."</option>"; }
?>
    </select></td>
  </tr>
  <tr>
    <td  align="right">语 言:</td>
    <td><select id="languageid" name="languageid"><option value="<?php echo $rs[languageid] ?>">请选择语言</option>
	     <?php $sql="select * from language";   $result=mysql_query($sql);
           while($language=mysql_fetch_array($result)){ echo "<option value='".$language[id]."'>".$language[language]."</option>"; } ?></select></td>
  </tr>
  <tr>
    <td align="right">网站地址:</td>
    <td><input id="url" type="text" name="url" value="" /> * (不包含"http://www.")</td>
  </tr>
  <tr>
   <tr>
    <td align="right">计数器编号:</td>
    <td><input id="jsqid" type="text" name="jsqid" value="" /></td>
  </tr>
    <td align="right">案例状态:</td>
    <td><select name="state"><option value="1">正常</option><option value="0">停止</option></select></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><input type="submit" name="submit" value=" 修 改 " /> &nbsp; <input type="reset" value=" 重 填 " name="reset" /></td>
  </tr>
</table></form></div>

<script type="text/javascript">
 function  checknull(){
    if(document.getElementById("languageid").value=='' || document.getElementById("companyid").value=='' || document.getElementById("url").value==''){
	alert("各项内容都不能为空");
	return false;
	}else{
	return true;
	}
	
 }
</script>              
<div id="content">
           
   <table width="780" border="1" cellpadding="0" cellspacing="0" bordercolor="#666666" class="tables">
  <tr>
    <th width="46" scope="col">序号</th>
    <th width="255" scope="col">站体</th>
    <th width="63" scope="col">语言</th>
    <th width="63" scope="col">状态</th>
    <th width="127" scope="col">网站</th>
  </tr>
  <?php $i=1;
        $sql="select * from website where comid=".$id;
		$result=mysql_query($sql);
		while($row=mysql_fetch_array($result)){?>
  <tr>
    <td><?php echo $i; $i++; ?></td>
    <td><?php echo $row['weburl']; ?></td>
     <td><?php echo getlanguage($row['languageid']); ?></td>
    <td><?php if($row['state']==1){ echo "正常 ";}else{ echo "停止" ; } ?></td>
    <td><?php echo "<a href='comkeym.php?id=".$row['webid']."'>查看修改</a>"; ?></td>
  </tr>
  <?php  } ?>
</table>
  
          </div>
   
  
          </div>
        </div>
     </div>
     
     <div id="foot"><P>copy right &copy; 2008-2009  <font color="#990000">ETW International</font></P></div>
</div>
</body>
</html>
