Split project into multiple files, added a way to post to the blog and rewrote README file
This commit is contained in:
28
user/createpost.php
Normal file
28
user/createpost.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
// Include config file
|
||||
require "../config.php";
|
||||
|
||||
// Connect to MySQL database
|
||||
$link = mysql_connect($host, $user, $password)
|
||||
or die("Could not connect...");
|
||||
|
||||
mysql_select_db($database)
|
||||
or die("Could not open database");
|
||||
|
||||
|
||||
$query = "INSERT INTO blog (date, title, posttext) VALUES
|
||||
('$_POST[date]','$_POST[title]','$_POST[post]')";
|
||||
|
||||
if (!mysql_query($query))
|
||||
{
|
||||
die ("Something went wrong!");
|
||||
}
|
||||
print "Post added";
|
||||
|
||||
|
||||
// Close MySQL link
|
||||
mysql_close($link);
|
||||
|
||||
|
||||
?>
|
16
user/newpost.html
Normal file
16
user/newpost.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<html><title>Create a new post</title>
|
||||
<body>
|
||||
|
||||
<form action="createpost.php" method="post">
|
||||
Date: (YYYY-MM-DD) <input type="date" name="date">
|
||||
<br />
|
||||
Title: <input type="text" name="title">
|
||||
<br />
|
||||
Text: <br />
|
||||
<textarea cols="50" rows="10" name="post"></textarea>
|
||||
<br />
|
||||
<input type="submit">
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user