Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include 'bd/blocks/bd.php';
- $result = mysqli_query($db,"SELECT keywords,description,author FROM page WHERE page='blog'");
- $myrow = mysqli_fetch_array($result);
- if(isset($_GET['date']) ){ //&& !empty($_GET['date'])
- $date = $_GET['date'];
- }
- /*
- elseif (!isset($_GET['date']) && empty($_GET['date'])) {
- header("Location: index.php");
- exit;
- }*/
- else{
- // header("Location: index.php");
- echo("<script>location.href = 'index.php';</script>");
- exit;
- }
- //$date= "$date";
- //$dates=substr($date,0,7);
- $dates= date("Y-m", strtotime($date));
- $sql="SELECT count(date) c FROM blog WHERE date='$dates' ";
- $sql="SELECT count(date) c FROM blog WHERE date like '{$dates}%' ";
- $result2 = mysqli_query($db,$sql);
- //since the data contain month-year.. you should use other name for this fieldname.
- $res=mysqli_fetch_array($result2);
- if($res['c']==0){
- echo("<script>alert('no blog found'); location.href = 'index.php';</script>");
- exit;
- }
- /*
- echo mysqli_num_rows($result2);
- if(mysqli_num_rows($result2)){
- header("Location: index.php");
- exit;
- }
- */
- $date_title=$date;
- $date_begin =$date;
- $date++;
- $date_end=$date;
- $date_begin=$date_begin.'-00';
- $date_end=$date_end.'-00';
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <meta http-equiv="Content-Language" content="en" />
- <meta name="description" content="<?php echo $myrow['description']; ?>" />
- <meta name="keywords" content="<?php echo $myrow['keywords']; ?>" />
- <meta name="author" content="<?php echo $myrow['author']; ?>" />
- <title><?php echo 'archive for '. $date_title .'';?></title>
- <!-- HEADER -->
- <?php include 'bd/blocks/head.php'; ?>
- <!--ENDS HEADER -->
- </head>
- <body>
- <!-- WRAPPER -->
- <div id="wrapper">
- <!-- navigation & HEADER -->
- <?php include 'bd/blocks/header.php'; ?>
- <!-- ENDS navigation & HEADER-->
- <!-- MAIN -->
- <div id="main">
- <!-- posts -->
- <div id="posts">
- <!-- single-post -->
- <?php
- $sql="SELECT id,text,author,view,img,choose,title,date FROM blog WHERE date > '$date_begin' AND date < '$date_end' ORDER BY id DESC";
- $result = mysqli_query($db,$sql);
- while($myrow = mysqli_fetch_array($result)){
- $let55=explode(" ",$myrow["text"]);
- $me=0;
- $newtxt="";
- while($me<55){
- $newtxt.="".$let55[$me]." ";
- $me+=1;
- }
- printf('
- <div class="post">
- <p class="post-title custom">%s</p>
- <p class="post-meta">%s <span>by %s</span></p>
- <p class="post-comments custom">%s</p><br><br>
- <div class="%s-img"><a href="single.php?id=%s"><img src="%s" alt="" widht="610" height="230"/></a><span></span></div>
- <p class="brief">%s...</p>
- <p><a href="single.php?id=%s" class="more">More</a></p>
- </div>',$myrow["title"] , $myrow["date"] , $myrow["author"] ,$myrow["view"] ,$myrow["choose"] , $myrow["id"] , $myrow["img"] , $newtxt , $myrow["id"]);}
- ?>
- <!-- ENDS single-post -->
- <!-- blog-pager -->
- <ul class="blog-pager">
- <li><a href="#">NEWER</a></li>
- <li><a href="#">OLDER</a></li>
- </ul>
- <!-- ENDS blog-pager -->
- </div>
- <!-- ENDS posts -->
- <!-- sidebar -->
- <?php include 'bd/blocks/side-block.php'; ?>
- <!-- ENDS sidebar -->
- </div>
- <!-- ENDS sidebar -->
- </div>
- <!-- ENDS MAIN -->
- </div>
- <!-- ENDS WRAPPER -->
- <!-- FOOTER -->
- <?php include 'bd/blocks/footer.php'; ?>
- <!-- ENDS FOOTER -->
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement