-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.php
53 lines (50 loc) · 1.72 KB
/
api.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
<?php
include_once("getData.php");
include_once("file.php");
switch ($_GET['req']) {
case 'checkLoginPassword':
$login = $_GET['login'];
$password = $_GET['password'];
$match = FALSE;
$ret = get_user_data($login);
if($ret['password'] == $password){
$match = TRUE;
}
// make a function that check if login and password match
// $match = checkLoginPassword($login, $password);
echo $match;
break;
case 'getUserProjects':
$user = $_GET['user'];
$projects = get_project_list($user);
// make a function that returns all the projects of the user
// I m now using this $page_url = url('http://localhost:8888/getData.php?req=getProjectList&data%5BuserId%5D='.$user);
// $projects = getUserProjects($user);
echo json_encode($projects, JSON_NUMERIC_CHECK);
break;
case 'getProjectEditIframe':
$project = $_GET['project'];
$iframe = "project_edit.php?project=$project";
// make a function that returns an iframe of a project edition
// maybe adding in parameters the login and password ?
// $iframe = getEditIframe($project);
echo $iframe;
break;
case 'getProjectDisplayIframe':
$project = $_GET['project'];
$iframe = "project_display.php?project=$project";
// make a function that returns an iframe of a project display like in preview.html
// $iframe = getDisplayIframe($project);
echo $iframe;
break;
case 'deleteProject':
$project = $_GET['project'];
$result = delete_project($project);
removeDir("project/{$_POST['data']['id']}");
// make a function that delete project
// maybe adding in parameters the login and password ?
// $result = deleteProject($project);
echo $result;
break;
}
?>