From a1bbd6bfb8dd3812c70acdeff793cd9d78bdc219 Mon Sep 17 00:00:00 2001 From: jesse Date: Thu, 19 May 2011 17:14:05 -0700 Subject: Got some processing started for the new post page. --- htdocs/new-post.php | 91 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 78 insertions(+), 13 deletions(-) (limited to 'htdocs/new-post.php') diff --git a/htdocs/new-post.php b/htdocs/new-post.php index e6f4035..7312e5f 100644 --- a/htdocs/new-post.php +++ b/htdocs/new-post.php @@ -14,24 +14,89 @@ require_once "src/header.inc.php"; echo "

Submit Post

"; -echo "
"; -echo "

$desc is a required field.

"; + + } else { + $values[$field] = addslashes($_POST[$field]); + } + } + + if ($values['email'] != $values['email2']) { + $error .= "

Email addresses must match.

"; + } + + if ($error == '') { + $post = new Post(); + + $post->setEmail($values['email']); + $post->setCategory($values['category']); + $post->setTitle($values['title']); + $post->setDescription($values['description']); -echo "

"; + if ($post->save()) { + $post->sendValidation(); -echo "

"; -echo "

"; + // TODO: Revise wording. + echo "

Your posting is awaiting email verification

"; -// TODO: Link to terms of service. -echo "

"; + } else { + $error .= "An internal error has occured."; + } -echo "

"; + } else { + render_form($error); + } + +} else { + render_form(); +} require_once "src/footer.inc.php"; + +function render_form($error="") { + if ($error != '') { + echo "
$error
"; + } + + echo "
"; + echo "

"; + + echo "

"; + echo "

"; + + echo "

"; + echo "

"; + + // TODO: Link to terms of service. + echo "

"; + + echo "

"; +} + + ?> -- cgit v1.2.3