forked from devsecopsmaturitymodel/DevSecOps-MaturityModel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbib.php
38 lines (34 loc) · 850 Bytes
/
bib.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
error_reporting(E_ERROR);
function readCSV($filename, $delimiter)
{
if (!file_exists($filename) || !is_readable($filename))
return FALSE;
$header = NULL;
$data = array();
if (($handle = fopen($filename, 'r')) !== FALSE) {
while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) {
if (!$header)
$header = $row;
else
$data[] = array_combine($header, $row);
}
fclose($handle);
}
return $data;
}
function elementIsSelected($elementName)
{
foreach (getCsv() as $element) {
if ($elementName == $element["element"]) {
return true;
}
}
return false;
}
$csvFile = 'selectedData.csv';
function getCsv() {
$csvFile = 'selectedData.csv';
$csv= readCSV($csvFile, ",");
return $csv;
}