Location: PHPKode > projects > ProjectPress > projectpress/pm-admin/add_news.php
<?php 
/**
 * ProjectPress add news form
 *
 * @package ProjectPress
 * @since 2.0
 */

// Starts the session.
session_start();

define('access',true);

include(dirname(dirname(__FILE__)) . '/config.inc.php');
include(PM_DIR . 'pm-includes/global.inc.php');
require(PM_DIR . 'pm-includes/functions.php');
include(PM_DIR . 'pm-includes/header.php');

is_admin();

// Enable for error checking and troubleshooting.
//display_errors();

if(isset($_POST['submit'])) {
	$username = pmdb::connect()->escape($_SESSION['username']);
	$title = pmdb::connect()->escape($_POST['title']);
	$text = pmdb::connect()->escape($_POST['text']);

	//run the query which adds the data gathered from the form into the database
	$result = pmdb::connect()->query("INSERT INTO ". DB ."news (dtime, author, title, text) VALUES (NOW(),'$username','$title','$text')");
}

	/**
	 * Creates a new template for the add member page.
	 */
	$addnews = new Template(PM_DIR . "pm-includes/tpl/add_news.tpl");
	$addnews->set("pmurl", get_pm_option('siteurl'));
	$addnews->set("phpself", $PHP_SELF);
	
	/**
	 * Outputs the page with add member form.
	 */
	echo $addnews->output();

include(PM_DIR . 'pm-includes/footer.php');
Return current item: ProjectPress