-
Notifications
You must be signed in to change notification settings - Fork 0
/
article.php
223 lines (216 loc) · 7.06 KB
/
article.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
<?php
$id=$_GET['id'];
require_once 'mobiledetect/Mobile_Detect.php';
$detect = new Mobile_Detect;
if (!filter_var($id, FILTER_VALIDATE_INT) === false) {
require_once("dbconnection.php");
$sql="select * from TBL_NAME where LId='$id'";
$result=mysqli_query($con,$sql);
$count=mysqli_num_rows($result);
if($count>0)
{
$row=mysqli_fetch_array($result,MYSQL_ASSOC);
$include=$row['Include'];
$author=$row['Author'];
$date=$row['Date'];
$title=$row['Title'];
$link=$row['Link'];
$like=$row['LikeCount'];
$unlike=$row['UnlikeCount'];
$pageviews=$row['Views'];
$pageviews++;
$sqlv="update TBL_NAME set Views='$pageviews' where LId='$id'";
$resultv=mysqli_query($con,$sqlv);
echo("<title>$title</title>");
include_once("common.htm");
}
else
{
include_once("error.php");
die();
}
}
else
{
include_once("error.php");
die();
}
?>
<head>
<link rel="stylesheet" href="test.css">
<link rel="stylesheet" href="style.css">
<script>
$(document).ready(function() {
$(".white").hover(function() {
$(this).toggleClass("white");
});
$(".liker").on("click",function() {
var id='<?php echo md5($id); ?>';
$.ajax ({
url:'like.php',
type:'post',
data:'id='+id,
success:function(data) {
$("#like").html(data);
},
});
});
$(".unlike").on("click",function() {
var id='<?php echo md5($id); ?>';
$.ajax ({
url:'unlike.php',
type:'post',
data:'id='+id,
success:function(data) {
$("#unlike").html(data);
},
});
});
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i);
},
any: function() {
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
}
};
$(document).on("click", '.whatsapp', function() {
if( isMobile.any() ) {
var text = $(this).attr("data-text");
var url = $(this).attr("data-link");
var message = encodeURIComponent(text) + " - " + encodeURIComponent(url);
var whatsapp_url = "whatsapp://send?text=" + message;
window.location.href = whatsapp_url;
} else {
alert("Please share this article in mobile device");
}
});
});
</script>
</head>
<body>
<?php include_once("analyticstracking.php") ?>
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_GB/sdk.js#xfbml=1&version=v2.4";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div id="part2">
<div class="row">
<div class="col s2">
<table style="position:fixed;width:10%;">
<tbody>
<tr>
<td><a class="btn-floating btn-large waves-effect waves-light white " href="#" onClick="MyWindow=window.open('http://www.facebook.com/sharer/sharer.php?u=<?php echo $link; ?>','MyWindow',width=600,height=300); return false;"><img class="sharebuttons" src='images/Facebook.png'></a></td>
</tr>
<tr>
<td><a class="btn-floating btn-large waves-effect waves-light white" href="#" onClick="MyWindow=window.open('http://www.twitter.com/share?url=<?php echo $link; ?>','MyWindow',width=600,height=300); return false;"><img class="sharebuttons" src='images/Twitter.png'></a></td>
</tr>
<tr>
<td><a class="btn-floating btn-large waves-effect waves-light white" href="#" onClick="MyWindow=window.open('http://www.plus.google.com/share?url={<?php echo urlencode($link); ?>}','MyWindow',width=600,height=300); return false;"><img class="sharebuttons" src='images/Google+.png'></a></td>
</tr>
<tr>
<td><a data-text="<?php echo('Read this'); ?>" data-link="<?php echo $link; ?>" class="btn-floating btn-large waves-effect waves-light white whatsapp"><img class="sharebuttons" src="images/whatsapp.png"></a>
</td>
</tr>
</tbody>
</table>
</div>
<div class="col s6 matter">
<div class="row">
<div class="col s12">
<h2 class="entry-title"><?php echo $title; ?></h2>
</div>
</div>
<hr/>
<div class="row" style="font-weight:bold;">
<div class="col s4">
<?php echo $date; ?>
</div>
<div class="col s4">
<i class='material-icons liker'>thumb_up</i><a id='like'><?php echo $like; ?></a>
<i class='material-icons unlike'>thumb_down</i><a id='unlike'><?php echo $unlike; ?></a>
</div>
<div class="col s4">
<div style='background:url(pics/<?php echo $author; ?>.jpg);background-size:cover; background-position: center center;' class='team1'></div><?php echo $author; ?>
</div>
</div>
<div class="row">
<?php include_once($include); ?>
<div style="margin-top:40px;" id="disqus_thread"></div>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES * * */
var disqus_shortname = 'vectech';
var disqus_identifier='<?php echo $id; ?>';
/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
</div>
</div>
<?php
if ( $detect->isMobile() ) {
echo('<div class="col s1"> </div><div style="border-left:solid 1px #000000;" class="col s3 more-reading">');
}
else
{
echo('<div class="col s2"> </div>
<div style="border-left:solid 1px #000000;" class="col s2 more-reading">');
}
?>
<h1>More Reading</h1>
<?php
require_once("dbconnection.php");
$sql="select * from TBL_NAME ORDER BY rand() LIMIT 6 ";
$result=mysqli_query($con,$sql);
$count=mysqli_num_rows($result);
while($row=mysqli_fetch_array($result,MYSQL_ASSOC))
{
$title=$row['Title'];
$author=$row['Author'];
$date=$row['Date'];
$category=$row['Category'];
$link=$row['Link'];
$image=$row['Image'];
$id=$row['LId'];
$Id=$row['Id'];
$linkenc=urlencode($link);
echo("
<div class='card small hoverable'>
<div class='card-image' style='background:url($image); background-size:cover; background-position:center center;'>
<a style='background: rgb(0, 0, 0); background: rgba(0, 0, 0, 0.7);height:100%;' class='card-title'>$title</a>
</div>
<div class='card-content'>
<div style='background:url(pics/$author.jpg);background-size:cover; background-position: center center;' class='team1'></div>
<a id='author'>$author</a>
<a id='date'>$date</a>
</div>
<div style='text-align:center;' class='card-action'>
<a style='color:#E65100;' href='$link'>Read Now</a>
</div>
</div>
");
}
?>
</div>
</div>