Location: PHPKode > projects > Horizon Blogging Software > admin/writeentry.php
<?php
$time_start = microtime(TRUE);
define('IN_HBS',TRUE);
include("../inc/include.php");
?>
<?php include("password_protect.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>HBS Administrative Control Panel</title>
<script language="javascript" type="text/javascript" src="../inc/javascript/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript" src="../inc/javascript/mootools.js"></script>
<script language="javascript" type="text/javascript" src="../inc/javascript/calendar.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
	mode : "textareas",
	theme : "advanced",
	plugins : "table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,flash,searchreplace,print,contextmenu",
	theme_advanced_buttons1_add_before : "save,separator",
	theme_advanced_buttons1_add : "fontselect,fontsizeselect",
	theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,zoom,separator,forecolor,backcolor",
	theme_advanced_buttons2_add_before: "cut,copy,paste,separator,search,replace,separator",
	theme_advanced_buttons3_add_before : "tablecontrols,separator",
	theme_advanced_buttons3_add : "emotions,iespell,flash,advhr,separator,print",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_path_location : "bottom",
	plugin_insertdate_dateFormat : "%Y-%m-%d",
	plugin_insertdate_timeFormat : "%H:%M:%S",
	extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
	external_link_list_url : "example_data/example_link_list.js",
	external_image_list_url : "example_data/example_image_list.js",
	flash_external_list_url : "example_data/example_flash_list.js"
});
</script>
</head>

<?php include ("default_style.css"); ?>

<body>
<div align="center"><img src="images/header.png" />
</div>
<table id="table" align="center">
<tr>
<td id="menu">
<?php include ("navigation.php"); ?>
</td>
<td id="content">

<table width="100%">
<tr>
  <td style="background-color:#FFFFD9; border: #FFFFB7 1px solid;">
<?php
$current_date = date("m/d/Y");
$current_time = date("H:i");
?>

<form name="createArticle" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">

<p align="center"><strong><label for="month">Date: </label></strong> 

<input type="text" name="date" id="date" class="ncalendar" size="10" value="<?php echo $current_date; ?>" />

<strong><label for="time">Time: </label></strong> <input type="text" name="time" id="time" size="5" value="<?php echo $current_time; ?>" />

<strong><label for="title">Title: </label></strong> <input type="text" name="title" name="title" size="40" /></p>
<p><textarea cols="60" rows="20" name="entry" id="entry"></textarea></p>

<p align="center"><input type="submit" name="submit" id="submit" value="Write Entry"></p>

</form>
<?php
if (isset($_POST['submit'])) {
	$category = $_POST['category'];

    $date = htmlspecialchars(strip_tags($_POST['date']));
    $time = htmlspecialchars(strip_tags($_POST['time']));
    $title = htmlspecialchars(strip_tags($_POST['title']));
    $entry = $_POST['entry'];

    $timestamp = strtotime($date . " " . $time);

    $entry = nl2br($entry);

    if (!get_magic_quotes_gpc()) {
        $title = addslashes($title);
        $entry = addslashes($entry);
    }

	db();
	
    $sql = "INSERT INTO " . $mysql["db_prefix"] . "main (timestamp,title,entry) VALUES ('$timestamp','$title','$entry')";
    $result = mysql_query($sql) or print("Can't insert into table " . $mysql["db_prefix"] . "main<br />" . $sql . "<br />" . mysql_error());

    if ($result != false) {
        print "
<div style='width: 98%; background-color: #FFCACA; font-weight: bold; font-family: Verdana; font-size: 14px; padding: 5px; border: 1px dashed #FF0000;' align='center'><div align='center'>Your entry has successfully been added!<br /><a href='index.php'>Admin Home</a> 
or <a href='../index.php'>View Entry</a></div></div>
";
    }

    mysql_close();
}
?>
</td>
</tr>
</table>

</td>
</table>
<?php include("footer.php");?>

</body>
</html>
Return current item: Horizon Blogging Software