-
Notifications
You must be signed in to change notification settings - Fork 1
/
achievement.php
120 lines (113 loc) · 4.17 KB
/
achievement.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
117
118
119
120
<?php include 'global.php'; ?>
<link href="css/achievements.css" rel="stylesheet">
</head>
<body>
<?php include 'nav.php';
include 'php/const.php'; ?>
<div class="container">
<div class="media">
<div class="media-left">
<img src="<?php echo $_SESSION['userArray']['image_32']; ?>" class="media-object">
</div>
<div class="media-body">
<h2 class="media-heading"><?php echo $_SESSION['userArray']['name'];?></h2>
</div>
</div>
<?php
$conn = new mysqli($GLOBALS['DB']['HOST'], $GLOBALS['DB']['USER'], $GLOBALS['DB']['PW'], $GLOBALS['DB']['DATABASE']);
$getAchievementColSQL = mysqli_query($conn, "SHOW COLUMNS FROM `userachievements`");
$i = 0;
while ($row2 = mysqli_fetch_array($getAchievementColSQL)) {
if ($i>$GLOBALS['ACHIEVEMENTS']['START_COL']-1) {
$columns[] = $row2['Field'];
}
$i++;
}
//echo var_dump($columns);
$userid = $_GET['userid'];
$checkAchievementSQL = mysqli_query($conn, "SELECT * FROM `userachievements` WHERE `userid`= '" . $userid . "'");
$i = 0;
while ($row = mysqli_fetch_array($checkAchievementSQL)) {
foreach ($columns as $col) {
echo $col;
echo var_dump($row[$col]);
$ownedAchievements[$i] = $row[$col];
$i++;
}
}
echo var_dump($ownedAchievements);
// }
// echo "COL VALS: ";
// echo var_dump($columns);
echo '<div class="row">';
$i = 0;
foreach ($GLOBALS['ACHIEVEMENTS']['NAME'] as $name) {
echo '
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3">
<div class="offer offer-success offer-radius">
<div class="shape">
<div class="shape-text">
top
</div>
</div>
<div class="offer-content">
<h3 class="lead">'
. $GLOBALS['ACHIEVEMENTS']['NAME'][$i] .
'</h3>
<p>'
. $GLOBALS['ACHIEVEMENTS'][''][$i] .
'</p>
</div>
</div>
</div>';
//echo '<div class="col-md-4">' . $GLOBALS['ACHIEVEMENTS']['NAME'][$i] . '</div>';
//echo '<div class="col-md-8">' . $GLOBALS['ACHIEVEMENTS']['DESC'][$i] . '</div>';
}
$i++;
echo '</div>';
?>
</div>
<?php
// $userid = $_GET['userid'];
// $conn = new mysqli($GLOBALS['DB']['HOST'], $GLOBALS['DB']['USER'], $GLOBALS['DB']['PW'], $GLOBALS['DB']['DATABASE']);
// $checkAchievementSQL = mysqli_query($conn, "SELECT * FROM `userachievements` WHERE `userid`= '" . $userid . "'");
// while ($row = mysqli_fetch_array($checkAchievementSQL)) {
// $getAchievementColSQL = mysqli_query($conn, "SHOW COLUMNS FROM `userachievements`");
// $i = 0;
// while ($row2 = mysqli_fetch_array($getAchievementColSQL)) {
// if ($i>$GLOBALS['ACHIEVEMENTS']['START_COL']-1) {
// $columns[] = $row2['Field'];
// }
// echo $i;
// $i++;
// }
// echo "COL VALS: ";
// echo var_dump($columns);
//print_r(array_values($columns));
// echo '
// <div class="container">
// <h3>' . $row['username'] . '</h3>
// <div class="row">';
// $hasAchievements = 0;
// $i = 0;
// foreach ($columns as $col) {
// if ($row[$col] == 1) {
// echo '<div class="col-md-4">' . $achievementName[$i] . '</div>';
// echo '<div class="col-md-8">' . $achievementDesc[$i] . '</div>';
// //echo "yes";
// if (!$hasAchievements) {
// $hasAchievements = 1;
// }
// }
// $i++;
// }
// echo '
// </div>
// </div>
// ';
// }
?>
</div>
</div>
</body>
</html>