<?php

if ($_POST['formaction'] == 'add' || $_POST['formaction'] == 'edit')

{

	$TITLE				= trim($funcObj->AppendSlashes($_POST['txttitle']));

	$HOST				= trim($funcObj->AppendSlashes($_POST['txthost']));

	$PORT				= trim($funcObj->AppendSlashes($_POST['txtport']));

	$USER 				= trim($funcObj->AppendSlashes($_POST['txtuser']));

	$PASSWORD 			= trim($funcObj->AppendSlashes($_POST['txtpassword']));

	$AUTHENTICATION 	= $_POST['chkauthentication'];

	$BOUNCE_EMAIL		= trim($funcObj->AppendSlashes($_POST['txtbounce']));

	$DEFAULT 			= $_POST['chkdefault'];

	$ID 				= $_POST['ID'];

	

	$error = "";

	

	if (empty($TITLE))

	{

		$error .= "Title/Name is required.<br />";

	}

	

	if (empty($HOST))

	{

		$error .= "SMTP host name is required.<br /> ";

	}

	if (empty($PORT))

	{

		$error .= "SMTP port is required.<br /> ";

	}

	else if (!is_numeric($PORT))

	{

		$error .= "Port number must be a numeric value.<br /> ";

	}

	if (empty($USER))

	{

		$error .= "SMTP user is required.<br /> ";

	}

	else if (!validate_email ($USER))

	{

		$error 	= "Invalid user. It must be in the email format.<br />";

	}

	if (($_POST['formaction'] == 'add') || (!empty($PASSWORD)))

	{

		if (empty($PASSWORD))

		{

			$error .= "Password cannot be left blank.<br /> ";

		}

	}

	if (strlen($error))

	{

		$errorMsg = "<strong>Please correct the following error(s):</strong> <br />

		$error";

	}

}

?>