<?php
if ( !defined( 'SMARTY_DIR' ) ) {
	include_once( 'init.php' );
}

if ($_GET["action"] == "update") {

	$osDB->query('UPDATE ! set text = ? where userid = ? and id = ?', array( USERTEMPLATE_TABLE, $_POST["txttemplate"], $_SESSION['UserId'], $_GET["id"] ) );

	header( 'location: mytemplates.php' );

	exit;

}

$t->assign( 'template', $osDB->getRow( 'SELECT id, text FROM ! WHERE userid = ? and id = ?', array( USERTEMPLATE_TABLE, $_SESSION['UserId'], $_GET["id"] ) ) );

$t->display ( 'mytemplatesedit.tpl' );

?>