-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlog_c.php
56 lines (50 loc) · 1.73 KB
/
log_c.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
54
55
56
<?php
require('./config/config.php');
require('./code/init.php');
require('./code/dbaccess.class.php');
require('./code/dbaccess-users.class.php');
require('./code/dbaccess-log.class.php');
$db = new Database();
if (!$db->connx) {
setSysMsg('_nobase');
header(URL_HEADER . 'home.php?prj=' . $_GET['prj']);
exit;
}
$dbaLog = new dbaccessLog($db);
$dbaUsers = new dbaccessUsers($db);
list($id_user, $rank, $error) = $dbaUsers->connectUser($_COOKIE['login'], $_COOKIE['pw'], $_GET['prj'], TRUE);
if ($id_user == -1) {
setSysMsg($error);
header(URL_HEADER . 'log.php?prj=' . $_GET['prj']);
exit;
}
if ($rank > 2) {
setSysMsg('_noaccess');
header(URL_HEADER . 'log.php?prj=' . $_GET['prj']);
exit;
}
switch ($_REQUEST['cmd']) {
case 'newannounce':
list($ok, $msgcode) = $dbaLog->createAnnounce($_GET['prj'], $_POST['announce'], $id_user);
setSysMsg($msgcode);
header(URL_HEADER . 'log.php?cat=A&prj=' . $_GET['prj']);
break;
case 'editannounce' :
list($ok, $msgcode) = $dbaLog->editAnnounce($_GET['prj'], $_POST['id_log'], $_POST['newannounce']);
setSysMsg($msgcode);
header(URL_HEADER . 'log.php?cat=A&prj=' . $_GET['prj']);
break;
case 'deleteannounce' :
if (!(isset($_GET['id_log']) and preg_match('`^[0-9]+$`', $_GET['id_log']))) {
setSysMsg('_wrongurl');
header(URL_HEADER . 'log.php?cat=A&prj=' . $_GET['prj']);
exit;
}
list($ok, $msgcode) = $dbaLog->deleteAnnounce($_GET['prj'], $_GET['id_log']);
setSysMsg($msgcode);
header(URL_HEADER . 'log.php?cat=A&prj=' . $_GET['prj']);
break;
default:
header(URL_HEADER . 'log.php?cat=A&prj=' . $_GET['prj']);
}
?>