-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathblog.php
More file actions
executable file
·67 lines (57 loc) · 1.84 KB
/
blog.php
File metadata and controls
executable file
·67 lines (57 loc) · 1.84 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
<?php
session_start();
include('settings.php');
?>
<!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>
<title>Online Judge</title>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" />
<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
<script type="text/javascript" src="jquery.js"></script>
</head>
<body class="blog">
<!-- wrap starts here -->
<div id="wrap">
<?php include('header.php'); ?>
<div id="content-outer" class="clear">
<div id="left">
<div class="entry">
<?php
$cn = mysql_connect('localhost', $DBUSER, $DBPASS);
mysql_select_db($DBNAME, $cn);
$query = "select count(*) from blog";
$logged = mysql_query($query);
$logg = mysql_fetch_array($logged);
$count = $logg['count(*)'];
if(isset($_GET['blogID'])) $current_blog=$_GET['blogID'];
else $current_blog=$count;
if($current_blog>1)
echo "<a href='blog.php?blogID=".($current_blog-1)."'>Previous </a>";
if($current_blog<$count)
echo "<a href='blog.php?blogID=".($current_blog+1)."'> Next </a>";
if($current_blog > $count || $current_blog < 1){
echo "<h4>Invalid Blog.<h4>";
}
else{
$fwrite=fopen("blog/complete/".$current_blog.".php","r");
$query="select blogName,time from blog where blogID=".$current_blog."";
$logged = mysql_query($query);
$logg = mysql_fetch_array($logged);
echo "<h2><strong>".$logg['blogName']."</strong></h2>";
if($fwrite==NULL) echo "<h4>Blog Not Found</h4>";
else{
echo"<p><h5>".date('jS F Y \a\t G:i', strtotime($logg['time']))."</h5></p>";
include('blog/complete/'.$current_blog.".php");
}
}
fclose($fwrite);
?>
</div>
</div>
<?php include("sidebar.php"); ?>
<?php include("footer.php"); ?>
</div>
</div>
</body>
</html>