-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathjoinGoup.php
61 lines (58 loc) · 1.41 KB
/
joinGoup.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
57
58
59
60
61
<?php
session_start();
if(isset($_SESSION['ID']) && !empty($_SESSION['ID'])){
$userID=$_SESSION['ID'];
$memID=$_POST["memID"];
$action=$_POST["action"];
$tm="member".$userID;
include 'dbconnect.php';
if($action=="ac"){
$sql="SELECT ST FROM account WHERE ID= ".$memID;
$result = $conn->query($sql);
if($result->num_rows>0){
$row=$result->fetch_array();
if($row['ST']=="none"){
$sql="UPDATE account SET ST='member', ManagerID=".$userID." WHERE ID=".$memID;
if($conn->query($sql)===TRUE){
$sql="UPDATE ".$tm." set Type='member' where ID=".$memID;
if($conn->query($sql)===TRUE){
$tm1="meal".$userID;
$tm2="A".$memID;
$sql="ALTER TABLE ".$tm1." ADD ".$tm2." Float NOT NULL DEFAULT 0";
if($conn->query($sql)===TRUE){
echo "OK";
}
else{
echo "Error JG 4: ".$conn->error;
}
}
else{
echo "Error JG 3: ".$conn->error;
}
}
else{
echo "Error JG 2: ".$conn->error;
}
}
else{
$sql="DELETE FROM ".$tm." where ID=".$memID;
$conn->query($sql);
echo "Already Member In Other Group.";
}
}
}
else if($action=="Rc"){
echo "ASSE ";
$sql="DELETE FROM ".$tm." where ID=".$memID;
if($conn->query($sql)===TRUE){
echo "OK";
}
else{
echo "Error JG: ".$conn->error;
}
}
$conn->close();
}else{
echo "You Are Not Logged In";
}
?>