DROP TABLE IF EXISTS `cms_news`;
CREATE TABLE `cms_news` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
`shortstory` text COLLATE latin1_general_ci,
`longstory` text COLLATE latin1_general_ci,
`published` int(10) NOT NULL DEFAULT '0',
`image` varchar(255) COLLATE latin1_general_ci DEFAULT '/Public/Images/news/TS_Web60.png',
`campaign` int(1) NOT NULL DEFAULT '0',
`campaignimg` varchar(255) COLLATE latin1_general_ci NOT NULL,
`author` int(6) NOT NULL DEFAULT '1',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
<?php $pagerank = 6; include "templates/header.php"; ?>
<div id="site_content">
<?php include "templates/sidebar.php"; ?>
<div id="content_container">
<div id="content">
<h1>Obbo Hotel News Step2</h1><hr/>
<?php
if(!isset($_SESSION["longstory"]))
{
header("Location: ".$_CONFIG['hotel']['url']."/ase/index.php?url=news");
exit;
}
if(isset($_POST["proceed"]))
{
$author = mysql_result(mysql_query("SELECT username FROM users WHERE id = '".$_SESSION['user']['id']."' LIMIT 1"), 0);
mysql_query("INSERT INTO cms_news (title,shortstory,longstory,published,image,author, campaign, campaignimg) VALUES ('" . filter($_SESSION["title"]) . "', '" . filter($_SESSION["shortstory"]) . "', '".($_SESSION["longstory"])."', '" . time() . "', '" . filter($_POST["topstory"]) . "', '" . filter($author) . "', 0, 'default')") or die(mysql_error());
unset($_SESSION["title"], $_SESSION["shortstory"], $_SESSION["longstory"]);
header("Location: ".$_CONFIG['hotel']['url']."/ase/index.php?url=dash");
exit;
}
echo '<center><b>It\'s time to choose the image for your story. Choose one from the drop down list and click "Check Image"';
echo '<form method="post">';
echo '<br />';
echo '<select name="topstory" id="topstory" style="font-size: 14px;"';
if ($handle = opendir('/swfs/c_images/Top_Story_Images/'))
{
while (false !== ($file = readdir($handle)))
{
if ($file == '.' || $file == '..')
{
continue;
}
echo '<option value="' . $file . '"';
if (isset($_POST['topstory']) && $_POST['topstory'] == $file)
{
echo ' selected';
}
echo '>' . $file . '</option>';
}
}
echo '</select>';
if(isset($_POST["check"]))
{
echo '<br /> <br /> <input type="submit" value=" Check image " name="check" /> <br /><br />';
echo '<font size="3">Topstory image<br /></font><img src="/swfs/c_images/Top_Story_Images/' . $_POST["topstory"] . '" align="right />';
echo '</center> <align="right"> <br /> <br /> <input type="submit" value=" Proceed (use image) " name="proceed" /> <br />';
echo '</form>';
}
else
{
echo '<br /> <br /> <input type="submit" value=" Check image " name="check" /> <br />';
echo "</form>";
}
?>
</div>
</div>
</div>
<?php include "templates/footer.php"; ?>