<!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" />
<?php 
	session_start(); 
	require_once('inc/conn.php');
	require_once('inc/constant.php');
	require_once('inc/ls_syscode.php');
	require_once('inc/check.php');
	$ls_msg="";
	
	$opendb=new mydb();
	require_once('inc/char_set.php');

	$title_sql = "select * from ls_config";
	$title_query = $opendb->query($title_sql);
	$title_value = mysql_fetch_assoc($title_query);
	$skiptitle=array("ID","Num","enable");;
	$skiptable=array("ls_admin","ls_agentcates","ls_agents","ls_branch","ls_fetchpass","ls_instruction","ls_log","ls_right","ls_statistics","ls_tips","ls_transchange","ls_transfast","ls_transslow","ls_writefiles","ls_ver","ls_writefiles");
	
	 
		
	
		$sqltable="show table status  ";
			$querytable=$opendb->query($sqltable);
			while($rowstable=mysql_fetch_assoc($querytable))
		  	{				
				$tablename=trim($rowstable['Name']);
				 if($tablename=="")return;
				if(!strin($tablename,$skiptable))
				{
					  $sqlcolumns   ="show columns in  ".$tablename." "; 
					  $querycolumns   = $opendb->query($sqlcolumns); 
					  $ls_msg1="表".$tablename.":<br/>";
					  $ls_msg2="";

					  while($rowscolumns=mysql_fetch_assoc($querycolumns))
		  				{		
							$fieldname=$rowscolumns['Field'];
							 if($fieldname=="")break;
							$sql1   = "select * from ls_tips where title='".$fieldname."' and tablename='".$tablename."'  "; 
							$query1   =$opendb->query($sql1);  //  是否在表里存在字段
							if(mysql_num_rows($query1)==0) 
							{		
								if(!strin($fieldname,$skiptitle))
								{
									$inserttips=sprintf("insert into ls_tips(tablename,title,date) values (%s,%s,%s)",
									GetSQLValueString($tablename,"text"),
									GetSQLValueString($fieldname,"text"),
									GetSQLValueString(date("Y-m-d"),"text")
									 
									);
									$query   =$opendb->query($inserttips); 
									$ls_msg2.= $fieldname.", ";
									//echo $ls_msg;
								}
							}
						}
						if( $ls_msg2==""){}  else $ls_msg.= $ls_msg1.$ls_msg2."<br/><br/>";
				}
				 
			}
			
			if($ls_msg=="")$ls_msg="没有添加提示字段"; else $ls_msg.=" 添加成功！";
	 echo $ls_msg;
	


?>
<title>无标题文档</title>
</head>

<body>
</body>
</html>