rendered paste body<pre><?php// setup standard vars for db$id = '';$state = '';$sectionId = 4;$mask = 0;$createdBy = 62;$modified = '0000-00-00 00:00:00';$modifiedBy = 0;$checkedOut = 0;$checkedOutTime = '0000-00-00 00:00:00';$publishUp = '2000-01-01 00:00:00';$publishDown = '0000-00-00 00:00:00';$images = '';$urls = '';$attribs = 'pageclass_sfx=\nback_button=\nitem_title=1\nlink_titles=\nintrotext=1\nsection=0\nsection_link=0\ncategory=0\ncategory_link=0\nrating=\nauthor=\ncreatedate=\nmodifydate=\npdf=\nprint=\nemail=\nkeyref=\ndocbook_type=';$version = 1;$parentId = 0;$ordering = 0;$metakey = '';$metadesc = '';$access = 0;$hits = 0;//start with the index$filename="G:\\WEB\\home.asp";$file=fopen($filename,"r") or exit("Unable to open " . $filename . "! ");$contents = fread($file, filesize($filename));preg_match_all( '/<a href="\.\.\/topiclist\/(index[0-9]*\.asp)#[^"]*"/i', $contents, $catout, PREG_SET_ORDER );fclose($file);// insert category index pages in to arrayforeach ($catout as $item) {$page[] = $item[1];}// grab article info from category index pagefor($i = 0 ; $i < count($page) ; $i++) {$filename = "G:\\WEB\\topiclist\\" . $page[$i];$file = fopen($filename,"r") or exit("Unable to open " . $filename . "! ");$contents = fread($file, filesize($filename));fclose($file);preg_match_all('/<li><a href="\.\.\/([^"]*)"[^>]*>(.*)<\/a>([^\r\n]*)[\r\n]/i', $contents, $output, PREG_SET_ORDER );foreach ($output as $item) {$filepath = str_replace("/", "\\", $item[1]);if (!strstr($filepath, '\\')) {$filepath = $filepath . "\\index.asp";} elseif (!strstr($filepath, '.asp')) {$filepath = $filepath . "index.asp";}if (@fopen("G:\\WEB\\" . $filepath, "r")) {$category[$i][] = $filepath;$maintitle[$i][] = mysql_escape_string(preg_replace('/([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{2,4})[: -]{1,3}/', '', strip_tags($item[2]))); //title$mainintroText[$i][] = mysql_escape_string(strip_tags($item[3])); //intro text}}}$handle = fopen("import.sql", "w") or exit("Unable to open " . $filename . "! ");fwrite($handle, "INSERT INTO `jos_content` (`id`, `title`, `title_alias`, `introtext`, `fulltext`, `state`, `sectionid`, `mask`, `catid`, `created`, `created_by`, `created_by_alias`, `modified`, `modified_by`, `checked_out`, `checked_out_time`, `publish_up`, `publish_down`, `images`, `urls`, `attribs`, `version`, `parentid`, `ordering`, `metakey`, `metadesc`, `access`, `hits`) VALUES\n");// get article contentfor($i = 0 ; $i < count($category) ; $i++) {for($j = 0 ; $j < count($category[$i]) ; $j++) {$filename = "G:\\WEB\\" . $category[$i][$j];$file = fopen($filename,"r") or exit("Unable to open " . $filename . "! ");$contents = fread($file, filesize($filename));fclose($file);preg_match('/<font size="\+1"[^>]*>[\s]*(.*)[^\r\n]*/i', $contents, $output1 );$main[$i][$j][0] = mysql_escape_string(preg_replace('/"/', '', strip_tags($output1[1]))); // title_aliaspreg_match('/<font size="\-1"><i>([a-zA-Z0-9":, \.]*)[-\r\n]/i', $contents, $output2 );if (empty($output2)) {$main[$i][$j][1] = '';} else {$main[$i][$j][1] = mysql_escape_string(strip_tags($output2[1])); // created_by_alias}preg_match('/<font size="\-1"><i>[^-]*[- ]{1,2}([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{2,4})[<\s]/i', $contents, $output3 );if (empty($output3)) {$main[$i][$j][2] = "2000-01-01 00:00:00"; // created} else {$main[$i][$j][2] = date('Y-m-d H:i:s',mktime(0, 0, 0, $output3[1], $output3[2], $output3[3])); // created}preg_match('/<!-- (CONTENT BEGINS|All Content Starts Here|CONTENT HERE|CONTENT START)[^>]*>(.*?)<!-- (CONTENT ENDS|All Content Ends Here|CONTENT END|END CONTENT|Begin Dynamic Html rollovers for links)[^>]*>/si', $contents, $output4);if (empty($output4)){preg_match('/<!-- (Ad Banner END)[^>]*>(.*?)<!-- (CONTENT ENDS|All Content Ends Here|CONTENT END|END CONTENT|Begin Dynamic Html rollovers for links)[^>]*>/si', $contents, $output4);}$bodycontent = $output4[2];preg_match('/<!--\r\n<p>\r\n<div.*?>CONTINUED.*?<\/div>/', $bodycontent, $test);echo $i . ": " . $j . "\n";print_r($test);echo "\n";$k = 2;while (empty($test)) {preg_match('/([\w]*?\\\)/i', $category[$i][$j], $matches);$k = sprintf('%02d', $k);$filename = "G:\\WEB\\" . $matches[1] . "index" . $k . ".asp";$file=fopen($filename,"r") or exit("Unable to open " . $filename . "! ");$contents = fread($file, filesize($filename));fclose($file);preg_match('/<!-- (CONTENT BEGINS|All Content Starts Here|CONTENT HERE|CONTENT START)[^>]*>(.*?)<!-- (CONTENT ENDS|All Content Ends Here|CONTENT END|END CONTENT|Begin Dynamic Html rollovers for links)[^>]*>/si', $contents, $output );if (empty($output)){preg_match('/<!-- (Ad Banner END)[^>]*>(.*?)<!-- (CONTENT ENDS|All Content Ends Here|CONTENT END|END CONTENT|Begin Dynamic Html rollovers for links)[^>]*>/si', $contents, $output );}preg_match('/<!--\r\n<p>\r\n<div.*?>CONTINUED.*?<\/div>/', $output[2], $test);$bodycontent = $bodycontent . $output[2];$k++;}$bodycontent = preg_replace('/(?<!<!--)\r\n<p>\r\n<div.*?>CONTINUED.*?<\/div>/', '{mospagebreak}', $bodycontent);$main[$i][$j][3] = mysql_escape_string($bodycontent); // full text// setup the variables for the database$title = $maintitle[$i][$j];$titleAlias = $main[$i][$j][0];$introText = $mainintroText[$i][$j];$fullText = $main[$i][$j][3];$catid = $i+13;$created = $main[$i][$j][2];$createdByAlias = $main[$i][$j][1];$write = "('" . $id . "', '" . $title . "', '" . $titleAlias . "', '" . $introText . "', '" . $fullText . "', '" . $state . "', '" . $sectionId . "', '" . $mask . "', '" . $catid . "', '" . $created . "', '" . $createdBy . "', '" . $createdByAlias . "', '" . $modified . "', '" . $modifiedBy . "', '" . $checkedOut . "', '" . $checkedOutTime . "', '" . $publishUp . "', '" . $publishDown . "', '" . $images . "', '" . $urls . "', '" . $attribs . "', '" . $version . "', '" . $parentId . "', '" . $ordering . "', '" . $metakey . "', '" . $metadesc . "', '" . $access . "', '" . $hits . "'),\n";fwrite($handle, $write);}}fwrite($handle, ";");fclose($handle);?></pre>