-
Notifications
You must be signed in to change notification settings - Fork 0
/
chat_chatmemberList.php
81 lines (55 loc) · 2.17 KB
/
chat_chatmemberList.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
error_reporting(E_ALL);
ini_set('display_errors',1);
include('dbcon.php');
//POST 값을 읽어온다.
$storyindex=isset($_POST['storyindex']) ? $_POST['storyindex'] : '';
$android = strpos($_SERVER['HTTP_USER_AGENT'], "Android");
if ($storyindex != "" ){
//유저가 참여한 채팅방 조회
$sql="select city from story where storyindex= '$storyindex'";
$stmt = $con->prepare($sql);
$stmt->execute();
$row = $stmt->fetch(PDO::FETCH_ASSOC);
//get city
//유저가 참여한 채팅방 조회
$sql="select userindex from chatroom where storyindex= '$storyindex'";
$stmt = $con->prepare($sql);
$stmt->execute();
//get involved userindex
$data = array();
while ($row2 = $stmt->fetch(PDO::FETCH_ASSOC)) {
extract($row2);
$userindex = $row2['userindex'];//유저가 참여한 채팅방 id
//유저가 참여한 채팅방에 참여한 유저정보 추출
$sql3 = "select userindex,username,userbirthyear,usergender,selfintro,facebookid,instaid from userinfo where userindex= '$userindex'";
$stmt3 = $con->prepare($sql3);
$stmt3->execute();
$row3 = $stmt3->fetch(PDO::FETCH_ASSOC);
extract($row3);
$userage = date('Y') - $row3["userbirthyear"]+1;
$sql4 = "select userprofile from userphoto where userindex= '$userindex'";
$stmt4 = $con->prepare($sql4);
$stmt4->execute();
$row4 = $stmt4->fetch(PDO::FETCH_ASSOC);
extract($row4);
array_push($data,
array(
"userindex"=>$row3['userindex'],
"username"=>$row3['username'],
"userage"=>$userage,
"usergender"=>$row3['usergender'],
"selfintro"=>$row3['selfintro'],
"facebookid"=>$row3['facebookid'],
"instaid"=>$row3['instaid'],
"userprofile"=>$row4['userprofile'],
)
);
}
header('Content-Type: application/json; charset=utf8');
$json = json_encode(array("city"=>$row['city'],"involveduserdata"=>$data), JSON_PRETTY_PRINT + JSON_UNESCAPED_UNICODE);
echo $json;
}else {
echo "no storyindex";
}
?>