Location: PHPKode > projects > Openology PHP Application Integration > openology/backend/sys_redat_ok.php
<?php
header('content-type:text/html;charset=UTF-8');
require(dirname(__FILE__)."/config.php");
$conn = connectMySql();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="en-EU" lang="en-EU">
<head>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>
<title><?php echo $TEXT['revert'];?></title>
<link href='style.css' rel='stylesheet' type='text/css'>
</head>
<body>
<table id="tt" width="90%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td id="tl">&nbsp;</td>
    <td> &nbsp;<b><?php echo $TEXT['revert'];?></b>&nbsp; [<a href="javascript:history.go(-1);"><u><?php echo $TEXT['goBack'];?></u></a>]</td>
</tr>
<tr>
    <td height="215" bgcolor="#FFFFFF">
<?php
if(!is_dir($base_dir.$bak_dir)) @mkdir($base_dir.$bak_dir,0777);
////////保存出錯的SQL語句
$errFile = $base_dir.$bak_dir."/error";
if(!is_dir($errFile)) @mkdir($errFile,0777);
$errFile = $errFile."/err.txt";
$refiles = ereg_replace("^,","",$refiles);
$refiles = split("\*",$refiles);
$fnum = count($refiles);
$fperr = fopen($errFile,"w");
for($i=0;$i<$fnum;$i++)
{
	$filename = $refiles[$i];
	$filename = $base_dir.$bak_dir."/".$filename;
	if(!file_exists($filename)||is_dir($filename)) continue;
	$fp = fopen($filename,"r");
	$j = 0;
	$query = fgets($fp,1024);
	while(!feof($fp))
	{
		$line = fgets($fp,1024);
		if(ereg("^~Insert",$line))
		{
			$query = trim(ereg_replace("^~","",$query));
			@mysql_query($query,$conn);
			if(mysql_error()=="") $j++;
			else fwrite($fperr,$query."\r\n");
			$query = "";
			$query.=$line;
		}
		else
		{
			$query.=$line;
		}
	}
	//插入最后一笔记录
	$query = trim(ereg_replace("^~","",$query));
	@mysql_query($query,$conn);
	if(mysql_error()=="") $j++;
	else fwrite($fperr,$query."\r\n");
	//输出完成提示
	echo $filename." OK 共: $j 条记录已插入!<br>\r\n";
	fclose($fp);
}
//////////////
fclose($fperr);
?>
</td>
</tr>
</table>
</body>
</html>
Return current item: Openology PHP Application Integration