-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
148 lines (116 loc) · 5.48 KB
/
Copy pathindex.php
File metadata and controls
148 lines (116 loc) · 5.48 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
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="image_src" href="Icon.png">
<title>Reddit to Youtube Playlist</title>
<meta name="description" content="Create youtube playlists from subreddit posts">
<link rel="stylesheet" href="main.css">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<!--Fonts -->
<link href="https://fonts.googleapis.com/css?family=Lobster|Vollkorn|Roboto:300" rel="stylesheet">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script type='text/javascript'>
function addFields(redditString) {
var input = document.getElementById("subredditInput");
input.value = input.value + "+" + redditString;
}
</script>
</head>
<body class="bg">
<h1 class="center logo">
<a href="http://redditplay.ml"><img src="Icon.png" height="100" width="120"/></a>
<a href="http://redditplay.ml">RedditPlay.ml</a>
<br><small>Reddit links to YouTube playlist</small>
</h1>
<div class="container">
<div class="col-sm-3">
<p class="grey">
Choose subreddits from the list, or type in your own!
</p>
<form action="getplaylist.php" method="get" id="myForm">
<input id="subredditInput" type="text" class="btn-block" name="subreddit" placeholder=" eg: ListenToThis">
<input class="btn btn-block" type="submit" value="Create Playlist">
</form>
<a href="#" rel="noopener noreferrer" target="_blank" class="btn mybtndisabled btn-block disabled"> </a>
<?php
include 'db_connection.php';
#$dbconnect = mysqli_connect($hostname,$username,$password,$database);
$dbconnect = OpenCon();
if ($dbconnect->connect_error) {
die("Database connection failed: " . $dbconnect->connect_error);
}
$sql="SELECT Genre,Name FROM tSubreddits Order By ListOrder";
$query = mysqli_query($dbconnect, $sql)
or die (mysqli_error($dbconnect));
$newgenre= "";
$tableCount = 0;
while ($row = mysqli_fetch_array($query)) {
if($newgenre == ""){
echo "<div class=\"panel-group\">
<div class=\"panel panel-default\">
<div class=\"panel-heading\">
<h4 class=\"panel-title\">
<a data-toggle=\"collapse\" href=\"#collapse" .$tableCount ."\">". $row["Genre"]."</a>
</h4>
</div>
<div id=\"collapse".$tableCount."\" class=\"panel-collapse collapse in\">
<ul class=\"list-group\">
<li class=\"list-group-item\"> <a href=\"#\" onclick=\"addFields('" .$row["Name"]. "');\">" . $row["Name"]. "</a></li>"
;
$newgenre = $row["Genre"];
$tableCount++;
} elseif($row["Genre"] !== $newgenre){
echo " </ul>
<div class=\"panel-footer\"></div>
</div>
</div>
</div>";
$newgenre = $row["Genre"];
$tableCount++;
if($tableCount == 2){
echo "</div>
<div class=\"col-sm-3\">";
} elseif($tableCount == 3){
echo "</div>
<div class=\"col-sm-3\">";
}
elseif($tableCount == 8){
echo "</div>
<div class=\"col-sm-3\">";
}
echo "<div class=\"panel-group\">
<div class=\"panel panel-default\">
<div class=\"panel-heading\">
<h4 class=\"panel-title\">
<a data-toggle=\"collapse\" href=\"#collapse" .$tableCount ."\">". $row["Genre"]."</a>
</h4>
</div>
<div id=\"collapse".$tableCount."\" class=\"panel-collapse collapse in\">
<ul class=\"list-group\">
<li class=\"list-group-item\"> <a href=\"#\" onclick=\"addFields('" .$row["Name"]. "');\">" . $row["Name"]. "</a></li>"
;
} else { echo "
<li class=\"list-group-item\"> <a href=\"#\" onclick=\"addFields('" .$row["Name"]. "');\">" . $row["Name"]. "</a></li>"
;
}
}
echo "</ul>
<div class=\"panel-footer\"></div>
</div>
</div>
</div>"
;
#mysqli_close($dbconnect);
CloseCon($conn);
?>
</div>
</div>
</body>
</html>