--- a/admin/partialdata/import.php +++ b/admin/partialdata/import.php @@ -1,5 +1,6 @@ <?php -include_once ("../../lib/common.inc.php"); +if (php_sapi_name() == "cli") { + include_once ("../../lib/common.inc.php"); function processFile($fpath, $tablename) { global $conn; @@ -67,7 +68,6 @@ if (in_array(($datamapping0507[$headers[$c]]) , $contractNoticeFields)) { if (($datamapping0507[$headers[$c]]) == "parentCN" || ($datamapping0507[$headers[$c]]) == "CNID") { $data[$c] = substr($data[$c], 2); // take off the "CN" prefix - $data[$c] = str_replace("-A", "00", $data[$c]); // make amendments really big numbers if (!is_numeric($data[$c]) && $data[$c] != "") die($data[$c] . " is not numeric"); if ($data[$c] > 0) { $contractNoticeInsert[] = $data[$c]; @@ -150,5 +150,6 @@ $success+= processFile($path . $fname, "contractnotice"); } +} ?>