-
Notifications
You must be signed in to change notification settings - Fork 0
/
user_detail.php
116 lines (102 loc) · 3.12 KB
/
user_detail.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
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
<?
include "header.php";
include "config.php"; //데이터베이스 연결 설정파일
include "util.php"; //유틸 함수
?>
<div class="container">
<?
$conn = dbconnect($host,$dbid,$dbpass,$dbname);
mysqli_autocommit($conn,FALSE); //disable auto-commit
mysqli_query($conn, "set session transaction isolation level serializable"); // set session consistency level to serializable
mysqli_begin_transaction($conn, MYSQLI_TRANS_START_READ_ONLY); // set transaction as read only because it only reads from tables
$username = $_GET['username'];
$join_sql = ("SELECT * FROM user NATURAL JOIN rank WHERE username='".$username."'");
$join_res = mysqli_query($conn, $join_sql);
if(!$join_res){
mysqli_rollback($conn); // If failure happens, rollback
msg('Query Error : '.mysqli_error($conn));
}else{
mysqli_commit($conn); // If no error happens, leave commit
}
$sql = ("SELECT * FROM user WHERE username='".$username."'");
$res = mysqli_query($conn, $sql);
if(!$res){
mysqli_rollback($conn); // If failure happens, rollback
msg('Query Error : '.mysqli_error($conn));
}else{
mysqli_commit($conn); // If no error happens, leave commit
}
?>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
h1 {
padding: 0;
position: relative;
left: 0;
outline: none;
background-color: black;
color: white;
text-align: center;
font-size: 50px;
}
img {
float: left;
padding-top: 30px;
padding-right: 30px;
}
li {
padding-top: 10px;
}
</style>
<div class="user_information">
<h1>
<?php
$row = mysqli_fetch_array($res);
echo $row['username'];
?>
</h1>
<img src="images/user_icon.jpeg"/>
<?php
$rownum = mysqli_num_rows($res);
for($i = 0; $i<$rownum; $i++){
echo "<li>Team : {$row['team']}</li>";
echo "<li>승률 : {$row['win_rate']}</li>";
echo "<li>킬뎃 : {$row['kill_death']}</li>";
echo "<li>최다킬 : {$row['most_kill']}</li>";
}
$join_row = mysqli_fetch_array($join_res);
$rownum = mysqli_num_rows($join_res);
for($i = 0; $i<$rownum; $i++){
echo "<li>타입 : {$join_row['type']}</li>";
echo "<li>순위 : {$join_row['ranking']}</li>";
echo "<li>시즌 : {$join_row['season']}</li>";
}
?>
<p>
<?php
$join_sql = ("SELECT * FROM user NATURAL JOIN game WHERE user.username='".$username."' and user.username=game.winner");
$join_res = mysqli_query($conn, $join_sql);
if(!$join_res){
mysqli_rollback($conn); // If failure happens, rollback
msg('Query Error : '.mysqli_error($conn));
}else{
mysqli_commit($conn); // If no error happens, leave commit
}
$rownum = mysqli_num_rows($join_res);
if($rownum!=0){
echo "<li>우승한 경기 : ";
for($i = 0; $i<$rownum; $i++){
$join_row = mysqli_fetch_array($join_res);
echo"{$join_row['game_ID']}번 경기 ";
echo"(주무기: {$join_row['winner_item']})";
if($i+1 != $rownum){
echo ",";
}
}
echo "</li>";
}
?>
</p>
</div>
</div>
<? include("footer.php") ?>