-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathprojectHasFile.php
More file actions
29 lines (28 loc) · 804 Bytes
/
projectHasFile.php
File metadata and controls
29 lines (28 loc) · 804 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
28
29
<?php
$project = 'default';
if (isset($_GET['proj'])) {
$project = strval($_GET['proj']);
// code...
}
if (isset($_GET['fn'])) {
$fn = $_GET['fn'];
// code...
}
//header("Content-Type: application/json");
session_start();
$_SESSION_KEYS = array_keys($_SESSION);
foreach ($_SESSION['$projects$'] as $value) {
if ($project == $value and in_array($value, $_SESSION_KEYS)) {
// var_dump($_SESSION[$value]);
if (count($_SESSION[$value]) == 0) {
die('{"success":0}');
}
foreach($_SESSION[$value]['files'] as $key=>$val){
//for ($i=0; $i < count($_SESSION[$value]['files']); $i++) {
if($fn == $_SESSION[$value]['files'][$key]['filename']){
die(json_encode(array('success'=>1,'code'=>$_SESSION[$value]['files'][$key]['fileContents'])));
}
}
}
}
die('{"success":0}');