<?php
require_once "../Connect.php"; /*MySQL configuration and connect*/
if(IsSet($_POST['install'])) {
$query = "DROP TABLE IF EXISTS `Administrators`;
CREATE TABLE `Administrators` (
`AdminID` int(11) NOT NULL AUTO_INCREMENT ,
`FirstName` varchar (50) NOT NULL,
`LastName` varchar (50) NOT NULL,
`Username` varchar (50) NOT NULL,
`Password` varchar (50) NOT NULL,
PRIMARY KEY (`AdminID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;";
$query .= "DROP TABLE IF EXISTS `Posts`;
CREATE TABLE `Posts` (
`PostID` int(11) NOT NULL AUTO_INCREMENT,
`Title` varchar (100) NOT NULL,
`Intro` text NOT NULL,
`Body` text NOT NULL,
`Date` varchar (100) NOT NULL,
`Writer` int (11) NOT NULL,
`PictureID` int (11) NOT NULL,
PRIMARY KEY (`PostID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;";
$query .= "DROP TABLE IF EXISTS `Pictures`;
CREATE TABLE `Pictures` (
`PictureID` int(11) NOT NULL AUTO_INCREMENT,
`Picture` varchar (100) NOT NULL,
`Path` varchar (500) NOT NULL,
`Height` varchar (100) NOT NULL,
`Widht` varchar (100) NOT NULL,
PRIMARY KEY (`PictureID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;";
$query .= "DROP TABLE IF EXISTS `Videos`;
CREATE TABLE `Videos` (
`VideoID` int(11) NOT NULL AUTO_INCREMENT,
`Video` varchar (100) NOT NULL,
`Path` varchar (500) NOT NULL,
`Lenght` varchar (100) NOT NULL,
PRIMARY KEY (`VideoID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;";
$query .= "DROP TABLE IF EXISTS `Guests`;
CREATE TABLE `Guests` (
`GuestID` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar (100) NOT NULL,
`Age` varchar (100) NOT NULL,
`Bloglink` varchar (100) NOT NULL,
`Password` varchar (100) NOT NULL,
PRIMARY KEY (`GuestID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;";
$query .= "DROP TABLE IF EXISTS `Comments`;
CREATE TABLE `Comments` (
`CommentID` int(11) NOT NULL AUTO_INCREMENT,
`GuestID` int(11) NOT NULL,
`Title` varchar (100) NOT NULL,
`Comment` text NOT NULL,
`Date` varchar (100) NOT NULL,
`Bloglink` varchar (100) NOT NULL,
PRIMARY KEY (`CommentID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;";
$result = mysql_query($query) or die(mysql_error());
}
if ( empty($result)) {
echo "<b>An error ocurred! Please try again!";
} else {
echo "<h1>PostON is installed on your webserver!!!</h1><br><a href='../admin/Index.php'>Go to the admin Login!</a>";
}
?>