-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmyList.php
More file actions
62 lines (54 loc) · 1.99 KB
/
myList.php
File metadata and controls
62 lines (54 loc) · 1.99 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ぬるトーク</title>
<link rel="stylesheet" type="text/css" href="main.css">
<style>
#main {
width: 100vw;
height: auto;
}
</style>
</head>
<body>
<div id="header">
<a id="title" href="index.php">ぬるトーク</a>
<ul id="menu">
<li><a href="index.php">ホーム</a></li>
<li><a href="myList.php">趣味の閲覧</a></li>
<li><a href="addList.php">趣味の追加</a></li>
<li><a href="matching.php">マッチング</a></li>
</ul>
</div>
<div id="main">
<h1>あなたの趣味はこちらです</h1>
<div class="listCenter">
<?php
$check = session_start();
if(!isset($check)){
print("セッションの確立に失敗しました");
}
$session_id = session_id();
$url = parse_url(getenv("DATABASE_URL"));
$con = pg_connect("host=" . $url['host'] . " port="
. $url['port'] . " dbname=" . substr($url['path'], 1)
. " user=" . $url['user'] . " password=" . $url['pass']);
$res_uid = pg_query($con, "SELECT uid FROM users WHERE session_id = '".$session_id."'"); #or die("クエリ実行エラーです" . pg_last_error());
$uid = pg_fetch_row($res_uid)[0];
$res_hids = pg_query($con, "SELECT hid FROM user_hobbies WHERE uid = '".$uid."'"); # or die("クエリ実行エラーです" . pg_last_error());
while($hid = pg_fetch_row($res_hids)) {
$hobby_name = pg_query($con, "SELECT hobby_name FROM hobbies WHERE hid=".$hid[0]);
echo '<a style="font-size: 20px ">';
echo pg_fetch_row($hobby_name)[0];
echo '</a><br>';
}
?>
<a href="index.php">戻る</a>
</div>
</div>
<div id="footer">
<span id="footer_text">Copyright© 2019 ぬるんちゅ All Rights Reserved.</span>
</div>
</body>
</html>