This repository was archived by the owner on Dec 23, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathajax.php
More file actions
118 lines (109 loc) · 3.15 KB
/
Copy pathajax.php
File metadata and controls
118 lines (109 loc) · 3.15 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
require_once('sys.includes.php');
//include('header-unlogged.php');
if(isset($_POST['action']) && !empty($_POST['action'])) {
$action = $_POST['action'];
switch($action) {
case 'get_organization' : get_organization();break;
case 'remove_organization' : remove_organization();break;
case 'add_new_client_organization' : add_new_client_organization();break;
case 'add_new_user_organization' : add_new_user_organization();break;
case 'admin_remove_organization' : admin_remove_organization();break;
case 'admin_activate_user_organization' : admin_activate_user_organization();break;
}
}
function get_organization()
{
global $dbh;
$level = $_POST['selectedid'];
if($level!=''){
$sql = $dbh->prepare("SELECT * FROM " . TABLE_GROUPS . " WHERE organization_type = '".$level."' ORDER BY name ASC");
//var_dump($sql);
//echo 'test';exit;
$sql->execute();
$sql->setFetchMode(PDO::FETCH_ASSOC);
while ( $row = $sql->fetch() ) {
echo "<option value=".$row['id'].">".$row['name']."</option>";
}
}
}
function remove_organization()
{
global $dbh;
$group_id = $_POST['group_id'];
$client_id = $_POST['client_id'];
$sql = $dbh->prepare("DELETE FROM " . TABLE_MEMBERS . " WHERE " . TABLE_MEMBERS . ".client_id = ". $client_id." AND " . TABLE_MEMBERS . ".group_id =".$group_id);
//var_dump($sql);
//echo 'test';exit;
if($sql->execute()){
echo "done";
}else{
echo "not done";
}
}
function admin_remove_organization() {
global $dbh;
$m_id = $_POST['m_id'];
$sql = $dbh->prepare("DELETE FROM " . TABLE_MEMBERS . " WHERE " . TABLE_MEMBERS . ".id = ". $m_id);
//var_dump($sql);
//echo 'test';exit;
if($sql->execute()){
echo "done";
}else{
echo "not done";
}
}
function add_new_client_organization () {
if($_SESSION['loggedin_id']) {
global $dbh;
$gp_id = $_POST['cat_id'];
if($_SESSION['userlevel'] == 9) {
$client_id = $_POST['client_id'];
}
else {
$client_id = $_SESSION['loggedin_id'];
}
$sql = $dbh->prepare("INSERT INTO `".TABLE_MEMBERS."` (`timestamp`, `added_by`, `client_id`, `group_id`,`m_org_status`) VALUES (CURRENT_TIMESTAMP, '".$_SESSION['loggedin']."', '".$client_id."', '".$gp_id."', '0');");
//var_dump($sql);
//echo 'test';exit;
if($sql->execute()){
echo "done";
}else{
echo "not done";
}
}
}
function add_new_user_organization() {
if($_SESSION['loggedin_id']) {
global $dbh;
$gp_id = $_POST['cat_id'];
if($_SESSION['userlevel'] == 9) {
$client_id = $_POST['client_id'];
$status = 0;
}
else {
$client_id = $_SESSION['loggedin_id'];
$status = 0;
}
$sql = $dbh->prepare("INSERT INTO `".TABLE_MEMBERS."` (`timestamp`, `added_by`, `client_id`, `group_id`, m_org_status) VALUES (CURRENT_TIMESTAMP, '".$_SESSION['loggedin']."', '".$client_id."', '".$gp_id."',".$status.");");
//re$sql);
if($sql->execute()){
echo "done";
}else{
echo "not done";
}
}
}
function admin_activate_user_organization(){
global $dbh;
$m_id = $_POST['m_id'];
$sql = $dbh->prepare("UPDATE " . TABLE_MEMBERS . " SET `m_org_status` = '1' WHERE " . TABLE_MEMBERS . ".id = ". $m_id);
//var_dump($sql);
//echo 'test';exit;
if($sql->execute()){
echo "done";
}else{
echo "not done";
}
}
?>