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);
|
||||
|
||||
|
||||
?>
|
Reference in New Issue
Block a user