-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsingle.php
More file actions
172 lines (117 loc) · 5.1 KB
/
single.php
File metadata and controls
172 lines (117 loc) · 5.1 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<?php include_once "header.php" ?>
<?php
if (isset($_POST)) {
if(!empty($_POST['gonderi']) AND !empty($_POST['cMessage'])){
$ekle =$db -> prepare("INSERT INTO yorumlar(yapilan_yorum,kullanici_id,icerik_id) VALUES(?,?,?)");
$ekle->execute(array($_POST['cMessage'],$_SESSION["id"],$_POST['gonderi']));
}
}
?>
<!-- Content
================================================== -->
<div id="content-wrap">
<div class="row">
<div id="main" class="eight columns">
<article class="entry">
<?php
if (isset($_GET['gonderi'])) {
$sorgu = $db->query("SELECT * FROM main WHERE main.id=".$_GET['gonderi']." ORDER BY yazi_tarih DESC " , PDO::FETCH_ASSOC);
}
else {
header ("Location:blog.php");
}
if($sorgu -> rowCount()){
foreach ($sorgu as $row) {
?>
<header class="entry-header">
<h2 class="entry-title">
<?php echo $row['yazi_baslik'] ?>
</h2>
<div class="entry-meta">
<ul>
<li><?php echo $row['yazi_tarih'] ?></li>
<span class="meta-sep">•</span>
<li>
<a href="#" title="" rel="category tag"><?php echo $row['yazi_kategori'] ?></a>
</li>
<span class="meta-sep">•</span>
<li><?php echo $row['yazar'] ?></li>
</ul>
</div>
</header>
<div class="entry-content">
<p class="lead"><?php echo $row['yazi_icerigi'] ?></p>
</div>
<?php
}
}
?>
</article>
<!-- Comments
================================================== -->
<div id="comments">
<?php
$sorgu=$db -> query ("SELECT count(yorumlar.id) as adet
FROM yorumlar INNER JOIN main ON main.id=yorumlar.icerik_id
WHERE main.id=".$_GET['gonderi']." AND yorumlar.yayinla=1 ", PDO::FETCH_ASSOC) -> fetch();
if ($sorgu['adet'] > 0) {
echo "<h4>".$sorgu['adet']." Yorum</h4>";
$sorgu=$db -> query ("SELECT yorumlar.yapilan_yorum AS yorum, yorumlar.yorum_tarihi AS tarih , kullanicilar.AdiSoyadi AS yazar
FROM yorumlar INNER JOIN main ON main.id=yorumlar.icerik_id INNER JOIN kullanicilar ON yorumlar.kullanici_id=kullanicilar.id
WHERE main.id=".$_GET['gonderi']." AND yorumlar.yayinla=1 ORDER BY yorumlar.yorum_tarihi " , PDO::FETCH_ASSOC) -> fetchAll();
foreach ($sorgu as $row) {
?>
<!-- commentlist -->
<ol class="commentlist">
<li class="depth-1">
<div class="avatar">
<img width="50" height="50" class="avatar" src="images/user-01.png" alt="">
</div>
<div class="comment-content">
<div class="comment-info">
<cite><?php print $row['yazar']; ?></cite>
<div class="comment-meta">
<time class="comment-time" datetime=""><?php print $row['tarih']; ?></time>
</div>
</div>
<div class="comment-text">
<p><?php print $row['yorum']; ?></p>
</div>
</div>
</li>
</ol> <!-- Commentlist End -->
<?php }
} ?>
<!-- respond -->
<?php if (isset($_SESSION["adi"])) { ?>
<div class="respond">
<h3>Yorum Yap</h3>
<!-- form -->
<form name="contactForm" id="contactForm" method="post" action="">
<input type="hidden" name="gonderi" value="<?php print $_GET['gonderi']; ?>" />
<fieldset>
<div class="message group">
<label for="cMessage">Message <span class="required">*</span></label>
<textarea name="cMessage" id="cMessage" rows="10" cols="50" ></textarea>
</div>
<button type="submit" class="submit">Gönder</button>
</fieldset>
</form> <!-- Form End -->
</div> <!-- Respond End -->
<?php } ?>
</div> <!-- Comments End -->
</div> <!-- main End -->
<?php include_once "sidebar.php" ?>
</div> <!-- end row -->
</div> <!-- end content-wrap -->
<!-- Footer
================================================== -->
<?php include_once "footer.php" ?>
<!-- Java Script
================================================== -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/jquery-1.10.2.min.js"><\/script>')</script>
<script type="text/javascript" src="js/jquery-migrate-1.2.1.min.js"></script>
<script src="js/main.js"></script>
</body>
</html>