about summary refs log tree commit diff stats
path: root/central
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
parent77bc692bb7694aa635be1ca3752894e976477ebb (diff)
downloadinstadisc-92722ab8471764037187a3169cee28b686367c7c.tar.gz
instadisc-92722ab8471764037187a3169cee28b686367c7c.tar.bz2
instadisc-92722ab8471764037187a3169cee28b686367c7c.zip
Central: Converted register.php
Refs #25
Diffstat (limited to 'central')
-rw-r--r--central/trunk/register.php86
-rw-r--r--central/trunk/theme/activated.tpl21
-rw-r--r--central/trunk/theme/register.tpl72
-rw-r--r--central/trunk/theme/registered.tpl14
4 files changed, 127 insertions, 66 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}
diff --git a/central/trunk/theme/activated.tpl b/central/trunk/theme/activated.tpl index 43c716f..ee265e7 100644 --- a/central/trunk/theme/activated.tpl +++ b/central/trunk/theme/activated.tpl
@@ -1,14 +1,15 @@
1<HTML> 1<HTML>
2 <HEAD> 2 <HEAD>
3 <TITLE><!--SITENAME--> InstaDisc Central Server</TITLE> 3 <TITLE><!--SITENAME--> InstaDisc Central Server</TITLE>
4 </HEAD> 4 </HEAD>
5 <BODY>
6 <CENTER>
7 <H1>InstaDisc Activation</H1>
8 5
9 <P>Thank you for activating! You've now been signed up for the InstaDisc service. 6 <BODY>
10 You will recieve an email with the information to input into your InstaDisc client. 7 <CENTER>
11 </CENTER> 8 <H1>InstaDisc Activation</H1>
12 </BODY> 9
10 <P>Thank you for activating! You've now been signed up for the InstaDisc service.
11 You will recieve an email with the information to input into your InstaDisc client.
12 </CENTER>
13 </BODY>
13</HTML> 14</HTML>
14 15
diff --git a/central/trunk/theme/register.tpl b/central/trunk/theme/register.tpl new file mode 100644 index 0000000..41fa6e9 --- /dev/null +++ b/central/trunk/theme/register.tpl
@@ -0,0 +1,72 @@
1<HTML>
2 <HEAD>
3 <TITLE><!--SITENAME--> InstaDisc Central Server</TITLE>
4 <LINK REL="stylesheet" TYPE="text/css" HREF="uniform.css">
5 </HEAD>
6
7 <BODY>
8 <CENTER>
9 <H1>InstaDisc Registration</H1>
10
11 <P>If you would like to sign up for our InstaDisc service, please fill out the form below.
12 </CENTER>
13
14 <FORM CLASS="uniform" ACTION="./register.php?submit=" METHOD="POST">
15
16 <!--BEGIN ERROR-->
17 <DIV ID="errorMsg">Uh oh! Validation errors!<P>
18 <OL>
19 <!--END ERROR-->
20
21 <!--BEGIN ERRORS-->
22 <LI><A HREF="#error<!--ERRORS.NAME-->"><!--ERRORS.MSG--></A></LI>
23 <!--END ERRORS-->
24
25 <!--BEGIN ERROR-->
26 </OL>
27 </DIV>
28 <!--END ERROR-->
29
30 <FIELDSET CLASS="inlineLabels">
31 <LEGEND>User Details</LEGEND>
32
33 <DIV CLASS="ctrlHolder<!--USERNAME_ERR-->">
34 <!--BEGIN USERNAME_ERRS-->
35 <P ID="error<!--USERNAME_ERRS.NAME-->" CLASS="errorField"><EM>*</EM>
36 <!--USERNAME_ERRS.MSG-->
37 </P>
38 <!--END USERNAME_ERRS-->
39
40 <LABEL FOR="username"><EM>*</EM> Username: </LABEL>
41 <INPUT TYPE="text" ID="username" NAME="username" CLASS="textInput" VALUE="<!--USERNAME-->">
42 </DIV>
43
44 <DIV CLASS="ctrlHolder<!--PASSWORD_ERR-->">
45 <!--BEGIN PASSWORD_ERRS-->
46 <P ID="error<!--PASSWORD_ERRS.NAME-->" CLASS="errorField"><EM>*</EM>
47 <!--PASSWORD_ERRS.MSG-->
48 </P>
49 <!--END PASSWORD_ERRS-->
50
51 <LABEL FOR="password"><EM>*</EM> Password: </LABEL>
52 <INPUT TYPE="password" ID="password" NAME="password" CLASS="textInput" VALUE="<!--PASSWORD-->">
53 </DIV>
54
55 <DIV CLASS="ctrlHolder<!--EMAIL_ERR-->">
56 <!--BEGIN EMAIL_ERRS-->
57 <P ID="error<!--EMAIL_ERRS.NAME-->" CLASS="errorField"><EM>*</EM>
58 <!--EMAIL_ERRS.MSG-->
59 </P>
60 <!--END EMAIL_ERRS-->
61
62 <LABEL FOR="email"><EM>*</EM> Email: </LABEL>
63 <INPUT TYPE="text" ID="email" NAME="email" CLASS="textInput" VALUE="<!--EMAIL-->">
64 </DIV>
65 </FIELDSET>
66
67 <DIV CLASS="buttonHolder">
68 <INPUT TYPE="submit" NAME="submit" VALUE="Submit">
69 </DIV>
70 </FORM>
71 </BODY>
72</HTML>
diff --git a/central/trunk/theme/registered.tpl b/central/trunk/theme/registered.tpl new file mode 100644 index 0000000..9a473e1 --- /dev/null +++ b/central/trunk/theme/registered.tpl
@@ -0,0 +1,14 @@
1<HTML>
2 <HEAD>
3 <TITLE><!--SITENAME--> InstaDisc Central Server</TITLE>
4 </HEAD>
5
6 <BODY>
7 <CENTER>
8 <H1>InstaDisc Registration</H1>
9
10 <P>Thank you for registering! An activation email has been sent to the address you provided. When you recieve it, copy the
11 code inside to the <A HREF="activate.php">Activation page</A>.
12 </CENTER>
13 </BODY>
14</HTML>