I have situation where we have 2 departments (department1 and department2). Say both are on the same government domain, but are different departments.
Now say if they share data between their two systems via a shared directory that each department sends flat files to.
Basically each department passes and updates information based on sending each other flat files.
The directory is setup so that when either department drops a flat file in the shared directory the directory automatically reads and updates the database based on the contents of the file.
Now for the meat of the question. Now as this is constantly happening every day 24/7.
Say I then want to use the data in the files for other purposes and write a completely different script that allows you to search for a file in the shared directory by name. It will open the file, read the contents into an array and then parse the file into a human readable format on the browser.
By running a second script on the same directory that is currently being used to update can I cause any sort of problems?
After I created this script and ran it, there was an instance were a file got hung and it caused no files in the entire directory to be read until the error was fixed.
Was this me, did I do that? My code does not update or modify any data, it just reads the files in the directory.
Should I remove this script?
Here is the second script I am running.
Now say if they share data between their two systems via a shared directory that each department sends flat files to.
Basically each department passes and updates information based on sending each other flat files.
The directory is setup so that when either department drops a flat file in the shared directory the directory automatically reads and updates the database based on the contents of the file.
Now for the meat of the question. Now as this is constantly happening every day 24/7.
Say I then want to use the data in the files for other purposes and write a completely different script that allows you to search for a file in the shared directory by name. It will open the file, read the contents into an array and then parse the file into a human readable format on the browser.
By running a second script on the same directory that is currently being used to update can I cause any sort of problems?
After I created this script and ran it, there was an instance were a file got hung and it caused no files in the entire directory to be read until the error was fixed.
Was this me, did I do that? My code does not update or modify any data, it just reads the files in the directory.
Should I remove this script?
Here is the second script I am running.
Code:
<?php
//Load CJIS Layout Data into array
$arrestDemographic = array(array('Arrest Number',0,9),
array('Arrest Incident',9,11),
array('Arrest Citation',20,8),
array('Arrest Date', 28,8),
array('Arrest Time',36,4),
array('OCA',40,12),
array('Real Last Name',52,30),
array('Real First Name', 82,30),
array('Real Middle Name',112,30),
array('Real Suffix',142,10),
array('Real UID Initials',152,4),
array('Real UID Count',156,10),
array('Real Date of Birth',166,8),
array('Real Height',174,4),
array('Real Weight',174,3),
array('Real Race',180,1),
array('Real Ethnicity',181,1),
array('Real Sex',182,1),
array('Real Eye',183,3),
array('Real Hair',186,3),
array('Latest Address',189,30),
array('Latest Address Description',219,30),
array('Real City',249,20),
array('Real State',269,2),
array('Real Zip',271,10),
array('Real County Code',281,3),
array('Real OLN',284,25),
array('Real SSN',309,10),
array('Verified',319,1),
array('Arrest Location',320,50),
array('Arresting Officer MPD No',370,10),
array('License State',380,2),
array('License Number',382,18),
array('License Year',400,4),
array('SMT1',404,10),
array('SMT1 Desc of Neumonic',414,60),
array('SMT1 Desc of SMT',474,30),
array('SMT2',504,10),
array('SMT2 Desc of Neumonic',514,60),
array('SMT2 Desc of SMT',574,30),
array('SMT3',604,10),
array('SMT3 Desc of Neumonic',614,60),
array('SMT3 Desc of SMT',674,30),
array('Persistent Offender',704,1),
array('Violent Offender',705,1),
array('Arrest Refused',707,1),
array('Jail Tracking Number',707,8)
);
$warrantData = array(array('CJIS Warrant Type',0,1),
array('Warrant Number',1,15),
array('Incident Number',16,11),
array('NCIC',27,4),
array('TCA Code',31,25),
array('TCA Qualifier'),
array('TCA Type',58,6),
array('Case Number',60,15),
array('Domestic Violence Flag',75,1),
array('TCA Class',76,2),
array('Officer Flag',78,1)
);
$aliasData = array(array('Alias Last Name',1,30),
array('Alias First Name',31,30),
array('Alias Middle Name',61,30),
array('Alias Suffix',91,10),
array('Alias UID Initials',101,4),
array('Alias UID Count',106,10)
);
//Function to return characters between two numbers in a string
function getData($string, $startingPoint, $length){
$x = $string;
$y = $startingPoint;
$z = $length;
return substr($x, $y, $z);
}
function loadView($array, $string){
$x = $array;
$y = $string;
$count = count($x);
echo "<table border=\"1\" cellpadding=\"3\" cellspacing=\"0\">\n";
echo "<tr><th bgcolor=\"#CCCCCC\">Arrest Element</th>
<th bgcolor=\"#CCCCCC\">Start Point</th>
<th bgcolor=\"#CCCCCC\">Length</th>
<th bgcolor=\"#CCCCCC\">Value</th>
<tr>";
for($i=0; $i < $count; $i++){
echo "<tr>
<td>".$x[$i][0]."</td>
<td align=\"right\">".$x[$i][1]."</td>
<td align=\"right\">".$x[$i][2]."</td>
<td align=\"right\">".getData($string, $x[$i][1], $x[$i][2])."</td>
</tr>";
}
echo "</table>";
}
function countBy($countTo, $breakWhen){
$y = $countTo;
$z = $breakWhen;
for($i=1; $i<=$y; $i++){
echo $i;
if($i % $z == 0){//value must be a divisible to 0 so modulus works
echo '<br />';
}
}
// countBy(100,25);
}
function strCharacters($string){
$y = $string;
$x = strlen($y);
echo "<table border=\"1\" cellpadding=\"1\" cellspacing=\"0\">";
echo "<tr>";
for($i=0; $i<=$x; $i++){
echo "<td width=\"15\">".$y[$i]."</td>";
}
echo "</tr>";
echo "<tr>";
for($i=1; $i<=$x; $i++){
echo "<td width=\"15\">".$i."</td>";
}
echo "</tr>";
echo "</table>";
}
function correctArrest($arrestNumber, $fileType){//adds file type to arrest number (D,W,A)
$x = $arrestNumber;
$z = $fileType;
if(!isset($x) && !strlen($x) == 10){
return "Arrest number not entered correctly";
}
else{
if(!isset($z)){
return trim($x."D");
}
else {
return trim($x.$z);
}
}
}
function setDocumentPath($arrestNumber, $folder){
//creates document path with
$x = $arrestNumber;
$y = $folder;
if(isset($x) && !is_numeric(substr($x,-1,1))){
if(!isset($y)){
return "\\\\host\\DATA\Success\Arrest\Final\\".$x;
}
else {
return "\\\\host\\DATA\".$folder."\Arrest\Final\\".$x;
}
}
}
?>