function makehtml ($msgContent, $filePath, $fileName) {//Generate HTML file
if (!is_dir ($filePath)) {@mkdir ($filePath);}
$handle = fopen (str_replace (' \ ', '). /', $filePath. $fileName), ' w+ ') or Die ("can ' t create file! $fileName");
Fwrite ($handle, $msgContent);
Fclose ($handle);
}
function Md5_filename ($fileid, $fileztype, $fileuid) {//File encryption method
return MD5 ($fileid. $fileztype. $fileuid). HTM ';
}
function GetSQL () {//How many generation HTM files at a time
Global $limit, $start, $id;
$sysType = ';
if (!empty ($id)) {
$sysType = "and Systype = $id";
}
$sql = "SELECT * from filecontent where siteindex=1 $sysType limit $start, $limit";
$result = mysql_query ($sql) or Die (' query error ');
while ($rs = Mysql_fetch_array ($result)) {
$fileName =md5_filename ($rs [0], $rs [' Z_type '], $rs [' Filesendid ']);
$path = Get_path ($rs [' Systype ']). $rs [' Z_type ']. ' /';
$parent = substr (GETCWD (), 0,strrpos (GETCWD (), ' \ ');
$filePath = $parent. ' \ '. $path;
makehtml ($rs [' content '], $filePath, $fileName);
}
Mysql_free_result ($result);
}
$info = "<script language=" javascript
var pgo =0;
function Jumpurl () {
document.write (' generated file <a href=make_html.php?id= $id &start= $start &limit= $limit &end= $end > If the browser does not respond please click here </a> ');
location= ' make_html.php?id= $id &start= $start &limit= $limit &end= $end '; &NBSP;&NBSP;&NBSP;&NBSP
}
settimeout (' Jumpurl () ');
</script> ";
if ($start > $end) {
die (' Complete all build tasks! ');
} else {
getsql ();
echo $info;
.}