From 92722ab8471764037187a3169cee28b686367c7c Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Fri, 15 Aug 2008 13:42:19 +0000 Subject: Central: Converted register.php Refs #25 --- central/trunk/register.php | 86 ++++++++++++++++------------------------------ 1 file changed, 30 insertions(+), 56 deletions(-) (limited to 'central/trunk/register.php') diff --git a/central/trunk/register.php b/central/trunk/register.php index 8322861..0d4d61d 100644 --- a/central/trunk/register.php +++ b/central/trunk/register.php @@ -33,21 +33,9 @@ if (!isset($_GET['submit'])) $send = instaDisc_sendActivationEmail($_POST['username'], $_POST['password'], $_POST['email']); if ($send === TRUE) { -?> - - - <?php echo(instaDisc_getConfig('siteName')); ?> InstaDisc Central Server - - -
-

InstaDisc Registration

- -

Thank you for registering! An activation email has been sent to the address you provided. When you recieve it, copy the - code inside to the Activation page. -

- - -add('SITENAME', instaDisc_getConfig('siteName')); + $template->display(); } else { addError($numOfErrors, $errors, '', $send); showForm($_POST['username'], $_POST['password'], $_POST['email'], $errors); @@ -57,49 +45,33 @@ if (!isset($_GET['submit'])) function showForm($username, $password, $email, $errors) { -?> - - - <?php echo(instaDisc_getConfig('siteName')); ?> InstaDisc Central Server - - - -
-

InstaDisc Registration

- -

If you would like to sign up for our InstaDisc service, please fill out the form below. -

- -
-add('SITENAME', instaDisc_getConfig('siteName')); + if (isset($errors[1])) { -?>
Uh oh! Validation errors!

-

    adds('ERROR', array('ex'=>'1')); + foreach ($errors as $name => $value) { -?>
  1. adds('ERRORS', array( 'NAME' => $name, + 'MSG' => $value['msg'])); } -?>
-
User Details -
- - -
-
- - -
-
- - -
-
-
- -
add('USERNAME_ERR', ifErrors($errors, 'username')); + $template->add('PASSWORD_ERR', ifErrors($errors, 'password')); + $template->add('EMAIL_ERR', ifErrors($errors, 'email')); + + doErrors($template, $errors, 'username'); + doErrors($template, $errors, 'password'); + doErrors($template, $errors, 'email'); + + $template->add('USERNAME', $username); + $template->add('PASSWORD', $password); + $template->add('EMAIL', $email); + + $template->display(); } function ifErrors($errors, $id) @@ -108,19 +80,21 @@ function ifErrors($errors, $id) { if ($value['field'] == $id) { - echo(' error'); - return; + return ' error'; } } + + return ''; } -function doErrors($errors, $id) +function doErrors($template, $errors, $id) { foreach ($errors as $name => $value) { if ($value['field'] == $id) { -?>

*

adds(strtoupper($id) . '_ERRS', array( 'NAME' => $name, + 'VALUE' => $value['msg'])); } } } -- cgit 1.4.1