about summary refs log tree commit diff stats
path: root/central/trunk/register.php
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2008-08-15 13:42:19 +0000
committerKelly Rauchenberger <fefferburbia@gmail.com>2008-08-15 13:42:19 +0000
commit92722ab8471764037187a3169cee28b686367c7c (patch)
tree84fd65e2de0f7a8733f5a72b081b3edce570469d /central/trunk/register.php
parent77bc692bb7694aa635be1ca3752894e976477ebb (diff)
downloadinstadisc-92722ab8471764037187a3169cee28b686367c7c.tar.gz
instadisc-92722ab8471764037187a3169cee28b686367c7c.tar.bz2
instadisc-92722ab8471764037187a3169cee28b686367c7c.zip
Central: Converted register.php
Refs #25
Diffstat (limited to 'central/trunk/register.php')
-rw-r--r--central/trunk/register.php86
1 files changed, 30 insertions, 56 deletions
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']))
33 $send = instaDisc_sendActivationEmail($_POST['username'], $_POST['password'], $_POST['email']); 33 $send = instaDisc_sendActivationEmail($_POST['username'], $_POST['password'], $_POST['email']);
34 if ($send === TRUE) 34 if ($send === TRUE)
35 { 35 {
36?> 36 $template = new FITemplate('registered');
37<HTML> 37 $template->add('SITENAME', instaDisc_getConfig('siteName'));
38 <HEAD> 38 $template->display();
39 <TITLE><?php echo(instaDisc_getConfig('siteName')); ?> InstaDisc Central Server</TITLE>
40 </HEAD>
41 <BODY>
42 <CENTER>
43 <H1>InstaDisc Registration</H1>
44
45 <P>Thank you for registering! An activation email has been sent to the address you provided. When you recieve it, copy the
46 code inside to the <A HREF="activate.php">Activation page</A>.
47 </CENTER>
48 </BODY>
49</HTML>
50<?php
51 } else { 39 } else {
52 addError($numOfErrors, $errors, '', $send); 40 addError($numOfErrors, $errors, '', $send);
53 showForm($_POST['username'], $_POST['password'], $_POST['email'], $errors); 41 showForm($_POST['username'], $_POST['password'], $_POST['email'], $errors);
@@ -57,49 +45,33 @@ if (!isset($_GET['submit']))
57 45
58function showForm($username, $password, $email, $errors) 46function showForm($username, $password, $email, $errors)
59{ 47{
60?> 48 $template = new FITemplate('register');
61<HTML> 49 $template->add('SITENAME', instaDisc_getConfig('siteName'));
62 <HEAD> 50
63 <TITLE><?php echo(instaDisc_getConfig('siteName')); ?> InstaDisc Central Server</TITLE>
64 <LINK REL="stylesheet" TYPE="text/css" HREF="uniform.css">
65 </HEAD>
66 <BODY>
67 <CENTER>
68 <H1>InstaDisc Registration</H1>
69
70 <P>If you would like to sign up for our InstaDisc service, please fill out the form below.
71 </CENTER>
72
73 <FORM CLASS="uniform" ACTION="./register.php?submit=" METHOD="POST">
74<?php
75 if (isset($errors[1])) 51 if (isset($errors[1]))
76 { 52 {
77?><DIV ID="errorMsg">Uh oh! Validation errors!<P> 53 $template->adds('ERROR', array('ex'=>'1'));
78<OL><?php 54
79 foreach ($errors as $name => $value) 55 foreach ($errors as $name => $value)
80 { 56 {
81?><LI><A HREF="#error<?php echo($name); ?>"><?php echo($value['msg']); ?></A></LI><?php 57 $template->adds('ERRORS', array( 'NAME' => $name,
58 'MSG' => $value['msg']));
82 } 59 }
83?></OL></DIV><?php
84 } 60 }
85?> 61
86<FIELDSET CLASS="inlineLabels"><LEGEND>User Details</LEGEND> 62 $template->add('USERNAME_ERR', ifErrors($errors, 'username'));
87<DIV CLASS="ctrlHolder<?php ifErrors($errors, 'username'); ?>"> 63 $template->add('PASSWORD_ERR', ifErrors($errors, 'password'));
88<?php doErrors($errors, 'username'); ?> <LABEL FOR="username"><EM>*</EM> Username: </LABEL> 64 $template->add('EMAIL_ERR', ifErrors($errors, 'email'));
89 <INPUT TYPE="text" ID="username" NAME="username" CLASS="textInput" VALUE="<?php echo($username); ?>"> 65
90</DIV> 66 doErrors($template, $errors, 'username');
91<DIV CLASS="ctrlHolder<?php ifErrors($errors, 'password'); ?>"> 67 doErrors($template, $errors, 'password');
92<?php doErrors($errors, 'password'); ?> <LABEL FOR="password"><EM>*</EM> Password: </LABEL> 68 doErrors($template, $errors, 'email');
93 <INPUT TYPE="password" ID="password" NAME="password" CLASS="textInput" VALUE="<?php echo($password); ?>"> 69
94</DIV> 70 $template->add('USERNAME', $username);
95<DIV CLASS="ctrlHolder<?php ifErrors($errors, 'email'); ?>"> 71 $template->add('PASSWORD', $password);
96<?php doErrors($errors, 'email'); ?> <LABEL FOR="email"><EM>*</EM> Email: </LABEL> 72 $template->add('EMAIL', $email);
97 <INPUT TYPE="text" ID="email" NAME="email" CLASS="textInput" VALUE="<?php echo($email); ?>"> 73
98</DIV> 74 $template->display();
99</FIELDSET>
100<DIV CLASS="buttonHolder">
101 <INPUT TYPE="submit" VALUE="Submit">
102</DIV></FORM><?php
103} 75}
104 76
105function ifErrors($errors, $id) 77function ifErrors($errors, $id)
@@ -108,19 +80,21 @@ function ifErrors($errors, $id)
108 { 80 {
109 if ($value['field'] == $id) 81 if ($value['field'] == $id)
110 { 82 {
111 echo(' error'); 83 return ' error';
112 return;
113 } 84 }
114 } 85 }
86
87 return '';
115} 88}
116 89
117function doErrors($errors, $id) 90function doErrors($template, $errors, $id)
118{ 91{
119 foreach ($errors as $name => $value) 92 foreach ($errors as $name => $value)
120 { 93 {
121 if ($value['field'] == $id) 94 if ($value['field'] == $id)
122 { 95 {
123?> <P ID="error<?php echo($name); ?>" CLASS="errorField"><EM>*</EM> <?php echo($value['msg']); ?></P><?php echo("\n"); 96 $template->adds(strtoupper($id) . '_ERRS', array( 'NAME' => $name,
97 'VALUE' => $value['msg']));
124 } 98 }
125 } 99 }
126} 100}