-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloadfile.php
39 lines (32 loc) · 989 Bytes
/
loadfile.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
<?php
$fails=urldecode($_POST['file']);
if(!(file_exists($fails) && substr($fails,0,strlen($fails)-strlen(strstr($fails, '/')))=="faili"))
{
echo "Problēma ar faila ielādi! ";
die();
}
if(filemtime($fails)+60>time())
{
echo "Failu jau kāds ir atvēris! Fails būs piejams pēc 1 minūtes kopš faila aizvēršanas";
die();
}
$xmlFails=preg_replace("/^faili\/txt/","faili/xml",$fails);
$xmlFails=preg_replace("/\.txt/",".xml",$xmlFails);
if(file_exists($xmlFails))
{
if(filemtime($xmlFails)+60>time())
{
echo "Failu jau kāds ir atvēris! Fails būs piejams pēc 1 minūtes kopš faila aizvēršanas";
die();
}
}
include("file_processor.php");
echo json_encode($data);
/*
<table class="lines" cellspacing="0" cellpadding="0" border="0">
<?php foreach($lines as $line): ?>
<tr class="line"><td class="text"><?php echo htmlspecialchars($line) ?><td><textarea class="comment"></textarea></td></tr>
<?php endforeach; ?>
</table>
*/
?>