51ff3226 |
1 | <?php |
2 | |
3 | function accesslist() { |
fd15ea3a |
4 | global $db,$error,$node,$error_messages; |
51ff3226 |
5 | $node_id=$node['node_id']; |
6 | $access=explode(";",$_POST['access']); |
7 | |
8 | if ($node['node_permission']!=('owner' || 'master' || 'op')) { |
9 | $error=$error_messages['EVENT_PERMISSION_ERROR']; |
10 | return false; |
11 | } |
12 | |
13 | $db->query("update node_access set last_visit=NOW(),node_permission='' where node_id=$node_id and node_permission='access'"); |
14 | foreach ($access as $acc) { |
15 | $set=$db->query("select user_id from users where login='$acc'"); |
16 | $set->next(); |
17 | if ($set->getString('user_id')) { |
18 | $q="update node_access set last_visit='',node_permission='access' where node_id=$node_id and user_id='".$set->getString('user_id')."'"; |
19 | echo $q; |
20 | $changed=$db->update($q); |
21 | if (!$changed) { |
22 | $q="insert into node_access set node_permission='access',node_id=$node_id,user_id=".$set->getString('user_id'); |
23 | $db->query($q); |
24 | } |
fd15ea3a |
25 | logger::log('add access',$node_id,'ok',$acc); |
51ff3226 |
26 | } |
27 | else { $error .= "$acc does not exist..."; } |
28 | } |
29 | } |
30 | ?> |
31 | |
32 | |
33 | |
34 | |