-
Notifications
You must be signed in to change notification settings - Fork 0
/
blog.php
264 lines (257 loc) · 12.1 KB
/
blog.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
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
<?php
include 'assets/php/db_connect.php';
?>
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Club MS8</title>
<link rel="icon" href="assets/img/favicon.png" sizes="16x16">
<meta name="author" content="Samartha">
<meta name="description" content="ClubMS8 is a group of auto-mototive enthusiast in the town of sagar. To be specific, we are the group of proud MS800 owners.">
<!-- fonts -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="assets/css/styles.css">
</head>
<body>
<div class="content">
<?php include 'header.php'; ?>
<section id="hero" class="full-page-section bg-image" data-aos="fade">
<div class="container hero-con">
<div class="row" data-aos="fade-right">
<div class="col-md-12">
<h1 class="big-text" id="title">BLOG</h1>
<h4 class="tag" id="sub-title">If speed costs, how fast you wanna go?</h4>
</div>
</div>
</div>
</section>
<br>
<section>
<div class="container" id="main-blog-con">
<div class="row">
<div class="col-md-12 text-center">
<h3 class="big-text">Recent posts</h3>
</div>
</div>
<div class="row">
<?php
$main_query="SELECT a.*, b.name, b.username from blog a, users b where a.active=1 and a.author_id=b.id order by a.date desc limit 1";
$main_exec=mysqli_query($conn,$main_query);
while($main_rows=mysqli_fetch_array($main_exec)){
?>
<div class="col-md-9">
<div class="dark-card" data-aos="fade-right" data-aos-delay="300">
<div class="dark-card-img">
<img src="assets/img/blog/<?php echo $main_rows['image']; ?>" alt="ms800hub" height="100%">
</div>
<div class="dark-card-body">
<div class="row">
<div class="col-8">
<h5><?php echo $main_rows['title'];$main_blog_id=$main_rows["id"] ?></h5>
<p class="text-muted text-primary"><?php echo $main_rows['name']; ?></p>
<p> <?php echo $main_rows['date']; ?></p>
</div>
<div class="col-4 text-right">
<a href="blog.php?bid=<?php echo $main_rows["id"] ?>" class="btn btn-primary">more</a>
</div>
</div>
</div>
</div>
</div><?php } ?>
<div class="col-md-3">
<div class="row">
<?php
$main_query2="SELECT a.*, b.name, b.username from blog a, users b where a.id != '$main_blog_id' and a.active=1 and a.author_id=b.id order by a.date desc limit 2";
$main_exec2=mysqli_query($conn,$main_query2);
while($main_rows2=mysqli_fetch_array($main_exec2)){
?>
<div class="col-md-12">
<div class="dark-card" data-aos="fade-right" data-aos-delay="300">
<div class="dark-card-img lim-h-150">
<img src="assets/img/blog/<?php echo $main_rows2['image']; ?>" alt="ms800hub" height="100%">
</div>
<div class="dark-card-body">
<div class="row">
<div class="col-8">
<p><?php echo $main_rows2['title'];?></p>
</div>
<div class="col-4 text-right">
<a href="blog.php?bid=<?php echo $main_rows2["id"] ?>" class="btn btn-primary">more</a>
</div>
</div>
</div>
</div>
</div><?php } ?>
</div>
</div>
<br>
</div>
</div>
</section>
<br>
<section>
<div class="container" id="blog_thumb_cont">
<div class="row">
<div class="col-md-12 text-center">
<h3 class="big-text">All posts</h3>
</div>
</div>
<div class="row">
<?php
$gal_query="SELECT a.*, b.name, b.username from blog a, users b where a.active=1 and a.author_id=b.id order by a.date desc";
$gal_exec=mysqli_query($conn,$gal_query);
while($gal_rows=mysqli_fetch_array($gal_exec)){
?>
<div class="col-md-4">
<div class="blog-thumb" onclick="openBlog('<?php echo $gal_rows['id'];?>')">
<div class="row no-gutters">
<div class="col-5">
<div class="blog-image">
<img src="assets/img/blog/<?php echo $gal_rows['image']; ?>" alt="" height="100%">
</div>
</div>
<div class="col-7">
<div class="blog-desc">
<h5><?php echo $gal_rows['title']; ?></h5>
<p><?php echo $gal_rows['date']; ?> </p>
</div>
</div>
</div>
</div>
</div><br> <?php } ?>
</div>
</div>
</section>
<?php
if(isset($_GET['bid'])){
$id=$_GET['bid'];
$blog_query="SELECT a.*, b.name, b.username, b.name from blog a, users b where a.active=1 and a.author_id=b.id and a.id='$id'";
$blog_exec=mysqli_query($conn,$blog_query);
while ($blog_rows=mysqli_fetch_array($blog_exec)) {
?>
<script type="text/javascript">
document.getElementById('hero').style.backgroundImage="url(assets/img/blog/<?php echo $blog_rows['image']; ?>)"
document.getElementById('title').style.fontSize="30px";
document.getElementById('title').innerHTML="<?php echo $blog_rows['title']; ?>";
document.getElementById('sub-title').innerHTML="";
document.getElementById('main-blog-con').style.display="none";
document.getElementById('blog_thumb_cont').style.display="none";
</script>
<div class="container">
<div class="blog-full">
<div class="row no-gutters justify-content-center">
<div class="col-md-10 text-center">
<div class="blog-image-full" >
<img id="blog-image-full" src="assets/img/blog/<?php echo $blog_rows['image']; ?>" alt="ms800hub.rf.gd">
</div>
</div>
</div>
<div class="row justify-content-center">
<div class="col-md-10">
<div class="blog-desc-full" id="blog-desc-full">
<div class="row">
<div class="col-12">
<h3><?php echo $blog_rows['title'] ?></h3>
<small class="text-primary">by <?php echo $blog_rows['name']; ?> | pc : <a target="_blank" href="https://instagram.com/<?php echo $blog_rows['tag']; ?>"><?php echo $blog_rows['tag']; ?></a> | <?php for ($i=5; $i <=9 ; $i++) {
echo $blog_rows['date'][$i];
} ?></small>
<br>
<p class="text-justify"><?php echo $blog_rows['body']; ?></p>
<button class="btn btn-primary back-button" type="button" name="back-button" onclick="goBackBlog()"> <i class="fa fa-arrow-left"></i></button>
<button class="btn btn-primary share-button" type="button" name="share-button" onclick="openShare()"> <i class="fa fa-share"></i></button>
<span class="share-panel" id="share-panel">
<i class="fa fa-facebook" onclick="share('facebook')"></i>
<i class="fa fa-whatsapp" onclick="share('whatsapp')"></i>
<i class="fa fa-link" onclick="share('link')"></i>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
}
?>
<script type="text/javascript">
document.getElementById('blog_thumb_cont').style.display="none";
</script>
<script type="text/javascript">
if(screen.width>760){
var img_height=document.getElementById('blog-image-full').height;
// alert(img_height);
// document.getElementById('blog-desc-full').style.height=img_height+"px";
}
</script>
<script type="text/javascript">
function openShare(){
var sharepanel=document.getElementById('share-panel');
if(sharepanel.style.visibility=="visible"){
sharepanel.style.width="0px";
sharepanel.style.opacity="0";
sharepanel.style.visibility="hidden";
}
else{
sharepanel.style.width="60px";
sharepanel.style.visibility="visible";
sharepanel.style.opacity="1";
}
}
function share(arg){
// alert(window.location);
link=window.location;
if(arg=='facebook'){
window.open('https://www.facebook.com/sharer/sharer.php?u=' + link, 'facebook-popup', 'height=350,width=600');
}
if(arg=='whatsapp'){
link='https://api.whatsapp.com/send?text=%20' + link;
window.open(link);
}
if(arg=='link'){
var x=document.createElement('input');
x.value=link;
x.style.position = 'absolute';
x.style.left = '-9999px';
document.body.appendChild(x);
x.select();
document.execCommand('copy');
document.body.removeChild(x);
window.alert('link copied : '+ link);
// window.prompt("Copy to clipboard: Ctrl+C, Enter", link);
}
openShare();
}
</script>
<?php
}
?>
<br>
</div>
<br>
<?php include 'footer.php'; ?>
<script type="text/javascript">
document.getElementById('blog').classList.add('active2');
// document.getElementById('foo').style.position="static";
</script>
<script type="text/javascript">
function openBlog(id) {
// document.getElementById('blog_thumb_cont').style.display="none";
// document.getElementById('main-blog-con').style.display="none";
link= "blog.php?bid="+id;
window.location.href=link;
}
function goBackBlog(){
window.location.href="blog.php";
}
</script>
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
</body>
</html>