-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.php
More file actions
executable file
·142 lines (108 loc) · 3.17 KB
/
init.php
File metadata and controls
executable file
·142 lines (108 loc) · 3.17 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<?php
ini_set('session.gc_maxlifetime', 3600);
session_set_cookie_params(3600);
session_start();
ini_set('memory_limit', '512M');
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// $entityBody = file_get_contents('php://input');
// echo $entityBody;
if(isset($_POST["filename"]) && isset($_POST["value"]) ){
$_SESSION["xlsxFile"] = $_POST["value"];
echo file_exists($_SESSION["xlsxFile"]); //final confirmation the file exsitence
exit;
}
echo false; exit;
}
$files = glob('spreadsheets/*.xlsx');
// print(json_encode($files));
$json = new stdClass();
foreach($files as $file){
// chown($file, 'daemon');
// chmod($file,0766);
$name = basename($file, '.xlsx');
$json->$name =$file;
}
// print json_encode($json);
// print $json->F18;
$jsonfromPHP = json_encode($json);
?>
<!doctype html>
<html lang="en">
<head>
<script type="text/javascript" src="schedulejs/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="schedulejs/jquery-ui.min.js"></script>
<link rel="stylesheet" media="screen" href="schedulejs/jquery-ui.css"/>
<script>
var files = <?php echo $jsonfromPHP; ?>; //array of filename with path
var buttons = new Object();
$.each(files, (key, value)=>{
buttons[key]= function () {
$.ajax({
type: 'post',
url: 'init.php',
data: {filename: key, value : value},
success: function(data) {
console.log(data);
if(data){
location.replace("index.php"); //only file selection is successful switch to next page
}
}
});
}
}
);
// buttons[buttonsength]= {
// text: "Ok",
// icons: {
// primary: "ui-icon-heart"
// },
// click: function() {
// $( this ).dialog( "close" );
// }
// // Uncommenting the following line would hide the text,
// // resulting in the label being used as a tooltip
// //showText: false
// }
console.log(files);
$( function() {
var dialog = $( "#dialog" ).dialog({
autoOpen: true,
width: 500,
modal: true,
buttons : buttons
});
} );
</script>
<style>
.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset
{
float:none;
}
.ui-dialog .ui-dialog-buttonpane
{
text-align:center;
vertical-align:bottom;
line-height: 3.5em;
display: flex;
justify-content: center;
align-items: center;
}
.ui-button{
display: block;
}
.ui-dialog-content::-webkit-scrollbar {
-webkit-appearance: none;
width: 22px;
height: 22px;
}
.ui-dialog-content::-webkit-scrollbar-thumb {
border-radius: 8px;
border: 2px solid white; /* should match background, can't be transparent */
background-color: rgba(0, 0, 0, .5);
}
</style>
</head>
<body>
<div id="dialog" title="File(.xlsx) found in spreadsheet directory"></div>
</body>
</html>