Cleaned up ugly HTML and renamed index.php to simplog.php

This commit is contained in:
2013-07-27 23:38:17 +02:00
parent 40de6d2290
commit e886d4f461
10 changed files with 82 additions and 37 deletions

View File

@@ -3,6 +3,9 @@
// Include config file
require "../includes/config.php";
require "../includes/dbconnect.php";
require "../includes/htmlcode.php";
start_html("New post created");
$query = "INSERT INTO blog (date, title, posttext) VALUES
@@ -18,5 +21,6 @@ print "Post added";
// Close MySQL link
mysql_close($link);
end_html();
?>

View File

@@ -1,6 +1,9 @@
<html><title>Edit post</title>
<body>
<?php
require "../includes/htmlcode.php";
start_html("Find post to edit");
?>
<h1>Find post to edit</h1>
<form action="editpost.php" method="get">
Date: (YYYY-MM-DD) <input type="date" name="date">
<br /><br />
@@ -9,6 +12,6 @@ Title: <input type="text" name="title">
<input type="submit" value="Find post">
</form>
</body>
</html>
<?php
end_html();
?>

View File

@@ -3,7 +3,10 @@
// Include config file
require "../includes/config.php";
require "../includes/dbconnect.php";
require "../includes/htmlcode.php";
start_html("Edit post");
print "<h1>Edit post</h1>";
$query = "SELECT * FROM blog WHERE date='$_GET[date]' AND title='$_GET[title]'";
$result = mysql_query($query)
@@ -24,13 +27,15 @@ Text: <br />
<textarea cols='50' rows='10' name='post'>$line[posttext]</textarea>
<br />
<input type='submit' value='Update post'>
</form>";
</form>
<hr width='50%' align='left'>
<br />";
}
// Close MySQL link
mysql_free_result($result);
mysql_close($link);
require "../includes/dbclose.php";
end_html();
?>

View File

@@ -1,13 +0,0 @@
<html><title>simplog user interface</title>
<body>
<h1>simplog user interface</h1>
<p>
<a href="newpost.html">Create new post</a>
</p>
<p>
<a href="editpost.html">Edit existing post</a>
</p>
</body>
</html>

16
user/index.php Normal file
View File

@@ -0,0 +1,16 @@
<?php
require "../includes/htmlcode.php";
start_html("simlog user interface");
?>
<h1>simplog user interface</h1>
<p>
<a href="new.php">Create new post</a>
</p>
<p>
<a href="edit.php">Edit existing post</a>
</p>
<?php
end_html();
?>

View File

@@ -1,6 +1,9 @@
<html><title>Create a new post</title>
<body>
<?php
require "../includes/htmlcode.php";
start_html("Create new post");
?>
<h1>Create new post</h1>
<form action="createpost.php" method="post">
Date: (YYYY-MM-DD) <input type="date" name="date">
<br />
@@ -12,5 +15,6 @@ Text: <br />
<input type="submit" value="Create post">
</form>
</body>
</html>
<?php
end_html();
?>

View File

@@ -3,6 +3,9 @@
// Include config file
require "../includes/config.php";
require "../includes/dbconnect.php";
require "../includes/htmlcode.php";
start_html("Post updated");
$query = "UPDATE blog SET date='$_POST[date]', title='$_POST[title]',
@@ -18,5 +21,6 @@ print "Post updated";
// Close MySQL link
mysql_close($link);
end_html();
?>