Location: PHPKode > projects > ProjectPress > projectpress/profile/notes/add_note.php
<?php
/**
 * ProjectPress add note
 *
 * @package ProjectPress
 * @since 2.0
 */

// Starts the session.
session_start();
define('access',true);
require_once(dirname(dirname(dirname(__FILE__))). '/config.inc.php');
require_once(PM_DIR . 'pm-includes/global.inc.php');
require_once(PM_DIR . 'pm-includes/functions.php');

if($current_user->hasPermission('access_site') != true) { pm_redirect(PM_URI . '/index.php'); }

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

if($_POST)
{
$first_name = pmdb::connect()->escape($_POST['first_name']);
$last_name = pmdb::connect()->escape($_POST['last_name']);
$note = pmdb::connect()->escape($_POST['note']);
$n_user = pmdb::connect()->escape($_POST['n_user']);
$username = $_SESSION['username'];

pmdb::connect()->query("INSERT INTO ". DB ."notes (note,n_user,author,first_name,last_name,email,date_created) VALUES('".$note."','".$n_user."','".$username."','".$_SESSION['first_name']."','".$_SESSION['last_name']."', (SELECT email FROM ". DB ."members where username = '$username'),'".strtotime(date("Y-m-d H:i:s"))."')");
}
else { }
?>

<li class="noteBox">
	<div class="avatar">
		<?php echo get_user_avatar($username,$email,50); ?>
	</div>
	
	<div class="note-list">
		<a href="<?php echo PM_URI ?>/profile/profile.php?username=<?php echo $author; ?>"><?php echo get_name($author); ?></a>&nbsp;
		<?php echo $note; ?> <br /><br />
	</div>
	
	<label class="name">
		<span style="float:left;padding-right:5px;">
			<?php echo date("Y-m-d H:i:s"); ?>
		</span>
	</label>
	<a href="#" nu="n_user-<?php echo $r->n_user; ?>" id="NID-<?php echo $r->n_id;?>" class="n_delete">Delete</a>
</li>
Return current item: ProjectPress