-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexecuteScripts.php
More file actions
27 lines (27 loc) · 841 Bytes
/
executeScripts.php
File metadata and controls
27 lines (27 loc) · 841 Bytes
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
<?php
if(empty($_GET['timestamp']))
return;
$time = $_GET['timestamp'];
if(substr(PHP_OS, 0, 3) == 'WIN')
{
$handle = fopen("config/config.txt","r");
while(!feof($handle))
{
$line = fgets($handle);
$parts = explode("=", $line);
$configs[$parts[0]]=$parts[1];
}
fclose($handle);
if(empty($_GET['docx']))
shell_exec($configs['pythonPath']."\python.exe scripts\main.py temp\input_$time temp\output_$time > temp\log_$time");
else
shell_exec($configs['pythonPath']."\python.exe scripts\main.py temp\input_$time.docx temp\output_$time > temp\log_$time");
}
else
{
if(empty($_GET['docx']))
shell_exec("python scripts/main.py temp/input_$time temp/output_$time > temp/log_$time 2>&1 &");
else
shell_exec("python scripts/main.py temp/input_$time.docx temp/output_$time > temp/log_$time 2>&1 &");
}
?>