-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconsultaArchivosFecha.php
76 lines (64 loc) · 2.33 KB
/
consultaArchivosFecha.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
require_once 'php/includes/DbConnect.php';
dirList('./users','newestFirst');
function dirList ($directory, $sortOrder){
//Get each file and add its details to two arrays
$results = array();
$handler = opendir($directory);
$i = 0;
while ($file = readdir($handler)) {
if ($file != '.' && $file != '..' && $file != "robots.txt" && $file != ".htaccess"){
$currentModified = filectime($directory."/".$file);
if(date('Y-m-d',$currentModified) == "2023-06-15"){
$file_dates[] = date('Y-m-d',$currentModified);
$file_names[] = $file;
$result[$i]['name'] = $file;
$result[$i]['date'] = date('Y-m-d',$currentModified);
$i++;
}
}
}
closedir($handler);
//Sort the date array by preferred order
if ($sortOrder == "newestFirst"){
arsort($file_dates);
}else{
asort($file_dates);
}
//Match file_names array to file_dates array
$file_names_Array = array_keys($file_dates);
foreach ($file_names_Array as $idx => $name) $name=$file_names[$name];
$file_dates = array_merge($file_dates);
$i = 0;
//print_r($file_names);
//print_r($file_dates);
//print_r($result);
consulta($result);
//Loop through dates array and then echo the list
/*foreach ($file_dates as $file_dates){
$date = $file_dates;
$j = $file_names_Array[$i];
$file = $file_names[$j];
$i++;
echo "File name: ".$file." - Date Added: ". $date. "<br/>";
}*/
}
function consulta($array){
$datos = array();
$db = new DbConnect();
$conn = $db->connect();
for($i = 0; $i < count($array); $i++){
$sql = "SELECT * FROM `tabla_inicio` WHERE cif='{$array[$i]['name']}' AND fecha='2023-06-15' AND fase = 'privado' AND estado = 'hecho' UNION ALL ";
$sentencia=$conn->prepare("SELECT * FROM `tabla_inicio` WHERE cif='{$array[$i]['name']}' AND fecha='2023-06-15' AND fase = 'privado'");
echo $sql;
$sentencia->execute();
if($sentencia->rowCount() > 0){
$row = $sentencia->fetchAll(PDO::FETCH_ASSOC);
$datos = $row;
}else{
// echo "error";
}
}
print_r($datos);
}
?>