<?php
@session_start();
include('checkstate.php');
include('../inc/function.php');
$comid=$_GET['id'];
   if($comid==''){
      echo "<script type=\"text/javascript\">window.location.href=\"allcompany.php\";</script>";
   }else{
      $sql="select * from custom where id=".$comid;
	  $result=mysql_query($sql);
	  $company=mysql_fetch_array($result);
	  if(@$_GET['action']=="add"){
	       $keyword=$_POST['keyword'];
	       $transmean=$_POST['transmean'];
	       $searchid=$_POST['searchengine'];
	       $rank=$_POST['rank'];
	      
		   $insert="insert into keyrank(keyword,transmean,companyid,searchid,rank,edittime,state) value('".$keyword."','".$transmean."','".$comid."','".$searchid."','".$rank."','".time()."','1')";
		   if(mysql_query($insert)){
		     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" />
<script type="text/javascript" src="js/modifykeyinfo.js"></script>
</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>当前位置 : 管理首页 >> <?php echo $company['company'];?></strong></div>
          <div id="content">
            <div class="tablelist" style="padding-left:0; width:100%;">
          <table width="794" border="0" class="tables">
  <tr><td colspan="2"  style="padding-left:180px; font-size:16px; height:30px;">企 业 案 例 关 键 字 管 理</td> </tr>
  <tr>
    <td width="249" align="right">企业类型:</td>
    <td width="535"><?php $grade=sql_select("select gradename from grade where gradeid=".$company['gradeid']);   
                       echo $grade[0][0];  ?></td>
  </tr>
  <tr>
    <td  align="right">语 言:</td>
    <td><?php $language=sql_select("select language from language where id=".$company['languageid']);   
                       echo $language[0][0]; ?></td>
  </tr>
  <tr>
    <td  align="right">公司名称:</td>
    <td><?php echo $company['company'] ?></td>
  </tr>
  <tr>
    <td align="right">网站地址:</td>
    <td>http://www.<?php echo $company['url'] ?></td>
  </tr>
  <tr>
    <td align="right">计数器编号:</td>
    <td><?php echo $company['jsqid'] ?></td>
  </tr>
  <tr>
    <td align="right">案例状态:</td>
    <td><?php if($company['state']==1){ echo "正常"; }else{ echo "<font color='#ff0000'>停止</font>";}?></td>
  </tr>
  <tr><td colspan="2">
    <table width="782" id="alllist" align="center" border="1" cellpadding="0" cellspacing="0"  bordercolor="#003F7D" style="line-height:25px; text-align:center"> 
  <tr>
    <td width="210">关键字</td>
    <td width="207">译 文</td>
    <td width="78">搜索引擎</td>
    <td width="57">排名</td>
    <td width="66">状态</td>
    <td width="96">日期</td>
     <td width="52">操作</td>
  </tr>
  <?php $sql="select * from keyrank where companyid=".$company['id']." order by searchid asc"; $result=mysql_query($sql);
       while($rs=mysql_fetch_array($result)){ ?>
  <tr id="note<?php echo $rs['id']; ?>">
    <td><input type="text" id="keyword<?php echo $rs['id']; ?>" value="<?php echo $rs['keyword']; ?>" size="30"  /></td>
    <td><input type="text" id="trans<?php echo $rs['id']; ?>" value="<?php echo $rs['transmean']; ?>" size="25"  /></td>
    <td><select id="searchid<?php echo $rs['id']; ?>" name="searcheid">
        <option value="<?php echo $rs['searchid']; ?>"><?php echo getenginename($rs['searchid']); ?></option>
	      <?php $sql2="select * from searchengine";   $results=mysql_query($sql2);
           while($searchengine=mysql_fetch_array($results)){ echo "<option value='".$searchengine['id']."'>".$searchengine['enginename']."</option>"; } ?></select></td>
    <td><input type="text" id="rank<?php echo $rs['id']; ?>" value="<?php echo $rs['rank']; ?>" size="5"  /></td>
    <td><select id="state<?php echo $rs['id']; ?>" name="state"><?php if($rs['state']==1){echo "<option value=\"1\">正常</option>"; }else{ echo "<option value=\"0\">停止</option>"; } ?>
	  <option value="1">正常</option><option value="0">停止</option>
	</select></td>
    <td><?php echo date('Y-m-d',$rs['edittime']); ?></td>
    <td><input type="hidden" id="key<?php echo $rs['id']?>" value="<?php echo $rs['id']?>" />
    <a href="#" title="修改" onclick="<?php echo "modifykeyinfo('key".$rs['id']."','keyword".$rs['id']."','trans".$rs['id']."','searchid".$rs['id']."','rank".$rs['id']."','state".$rs['id']."')"; ?>"><img src="img/edit.gif" title="修改" /></a> <a href="#" title="删除" onclick="delkeyinfo('key<?php echo $rs['id']; ?>')"><img src="img/del.gif" /></a></td>
  </tr><?php } ?>
  
  <form action="comkeym.php?action=add&id=<?php echo $comid; ?>" method="post">
    <tr>
    <td><input type="text" name="keyword" size="30" /></td>
    <td><input type="text" name="transmean" size="25" /></td>
    <td><select name="searchengine"><?php $sql="select * from searchengine";   $result=mysql_query($sql);
           while($searchengine=mysql_fetch_array($result)){ echo "<option value='".$searchengine['id']."'>".$searchengine['enginename']."</option>"; } ?></select></td>
    <td><input type="text" name="rank" size="5" /></td>
    <td>正常</td>
    <td colspan="2"><input type="submit" name="submit" value="添加" /></td>
  </tr>
 </form>
</table>

    </td>
  </tr>
</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>
