Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- require("startup.php");
- if (!(isset($_SESSION["active"]))) {
- session_register("active");
- }
- ?>
- <html>
- <head>
- <?php
- echo "<title>".$name."</title>";
- ?>
- <title> </title>
- <link rel="stylesheet" type="text/css" href="default.css">
- <link rel="alternate" type="application/rss+xml" href="feed.xml" title="xray's blog">
- </head>
- <body>
- <?php
- session_start();
- echo "<div class=\"login\">";
- if (isset($_SESSION["active"]) and $_SESSION["active"]) {
- echo "<a href=\"post.php\">Post</a>";
- }
- else {
- echo " <form action=\"login.php\" method=\"post\">";
- echo " Username: <input type=\"text\" name=\"username\" />";
- echo " Password: <input type=\"password\" name=\"password\" />";
- echo " <input type=\"submit\" name='login' value='login'>";
- echo "</form>";
- }
- echo"</div>";
- if ($_SESSION["posting"]) {
- echo "<div class=posts>";
- echo "<form action=make_post.php method=post>";
- echo "Subject: ";
- echo "<input type=text name=title size=72><br />";
- echo "<textarea cols=82 rows=15 name=body></textarea></textarea><br /><div class=date>";
- echo "<input type=submit name=post value=post></div>";
- echo "</div>";
- }
- if ($_GET) {
- $result = mysql_query("select * from Blog where id=".$_GET["id"]);
- $row = mysql_fetch_array($result);
- if (mysql_num_rows($result) <= 0) {
- echo "Invalid Blog Id";
- die;
- }
- echo "<div class=posts><div class=title>".$row['title']."</div><div class=date>".$row["postdate"]."</div><div class=body>".$row["body"]."</div><br /><br />";
- $result = mysql_query("SELECT * FROM Comments WHERE blogid=".$_GET["id"]);
- while ($row = mysql_fetch_array($result)) {
- echo "<div class=post><i>".$row["postdate"]."</i><br />".$row["body"]."<br /><br />";
- }
- echo "
- <form action=comment.php method=post>
- Comment:<br />
- <textarea cols=20 rows=5 name=body></textarea><br />
- <input type=hidden name=id value=".$_GET["id"].">
- <div class=rightj><input type=submit name=comment value=comment></div>
- </form>
- </div>";
- } else {
- $result = mysql_query("SELECT * from Blog ORDER BY id DESC");
- while ($row = mysql_fetch_array($result)) {
- echo "<div class=posts>";
- echo "<div class=title>".$row['title']." </div><div class=date>".$row['postdate']."</div>";
- echo "<div class=body>".$row['body']."</div>";
- echo "<br />";
- $comments = mysql_query("SELECT * from Comments where blogid=".$row["id"]);
- echo "<a href=\"index.php?id=".$row["id"]."\"> Comments (".mysql_num_rows($comments).")</a>";
- echo "</div>";
- }
- mysql_close($connection);
- }
- ?>
- </body>
- </html>
Add Comment
Please, Sign In to add comment