diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2008-09-28 21:40:47 +0000 |
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2008-09-28 21:40:47 +0000 |
| commit | fb1b67b6922a20fdc3538dd6ae4659dfc1d8d7d2 (patch) | |
| tree | 9ad7b7c72f451fd5bdcb2c33a6586c586309ab10 /central/trunk/register.php | |
| parent | 9d6ed35e4faa192ea734bfc353a6be65b977a6e6 (diff) | |
| download | instadisc-fb1b67b6922a20fdc3538dd6ae4659dfc1d8d7d2.tar.gz instadisc-fb1b67b6922a20fdc3538dd6ae4659dfc1d8d7d2.tar.bz2 instadisc-fb1b67b6922a20fdc3538dd6ae4659dfc1d8d7d2.zip | |
Central: Removed UI
Refs #63
Diffstat (limited to 'central/trunk/register.php')
| -rw-r--r-- | central/trunk/register.php | 109 |
1 files changed, 0 insertions, 109 deletions
| diff --git a/central/trunk/register.php b/central/trunk/register.php deleted file mode 100644 index 8a02d0c..0000000 --- a/central/trunk/register.php +++ /dev/null | |||
| @@ -1,109 +0,0 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | /* InstaDisc Server - A Four Island Project */ | ||
| 4 | |||
| 5 | include('includes/instadisc.php'); | ||
| 6 | include('includes/template.php'); | ||
| 7 | |||
| 8 | if (!isset($_GET['submit'])) | ||
| 9 | { | ||
| 10 | showForm('','','',array()); | ||
| 11 | } else { | ||
| 12 | $numOfErrors = 0; | ||
| 13 | $errors = array(); | ||
| 14 | |||
| 15 | if ($_POST['username'] == '') | ||
| 16 | { | ||
| 17 | addError($numOfErrors, $errors, 'username', 'Username is a required field'); | ||
| 18 | } | ||
| 19 | |||
| 20 | if ($_POST['password'] == '') | ||
| 21 | { | ||
| 22 | addError($numOfErrors, $errors, 'password', 'Password is a required field'); | ||
| 23 | } | ||
| 24 | |||
| 25 | if ($_POST['email'] == '') | ||
| 26 | { | ||
| 27 | addError($numOfErrors, $errors, 'email', 'Email is a required field'); | ||
| 28 | } | ||
| 29 | |||
| 30 | if ($numOfErrors > 0) | ||
| 31 | { | ||
| 32 | showForm($_POST['username'], $_POST['password'], $_POST['email'], $errors); | ||
| 33 | } else { | ||
| 34 | $send = instaDisc_sendActivationEmail($_POST['username'], $_POST['password'], $_POST['email']); | ||
| 35 | if ($send === TRUE) | ||
| 36 | { | ||
| 37 | $template = new FITemplate('registered'); | ||
| 38 | $template->add('SITENAME', instaDisc_getConfig('siteName')); | ||
| 39 | $template->display(); | ||
| 40 | } else { | ||
| 41 | addError($numOfErrors, $errors, '', $send); | ||
| 42 | showForm($_POST['username'], $_POST['password'], $_POST['email'], $errors); | ||
| 43 | } | ||
| 44 | } | ||
| 45 | } | ||
| 46 | |||
| 47 | function showForm($username, $password, $email, $errors) | ||
| 48 | { | ||
| 49 | $template = new FITemplate('register'); | ||
| 50 | $template->add('SITENAME', instaDisc_getConfig('siteName')); | ||
| 51 | |||
| 52 | if (isset($errors[1])) | ||
| 53 | { | ||
| 54 | $template->adds_block('ERROR', array('ex'=>'1')); | ||
| 55 | |||
| 56 | foreach ($errors as $name => $value) | ||
| 57 | { | ||
| 58 | $template->adds_block('ERRORS', array( 'NAME' => $name, | ||
| 59 | 'MSG' => $value['msg'])); | ||
| 60 | } | ||
| 61 | } | ||
| 62 | |||
| 63 | $template->add('USERNAME_ERR', ifErrors($errors, 'username')); | ||
| 64 | $template->add('PASSWORD_ERR', ifErrors($errors, 'password')); | ||
| 65 | $template->add('EMAIL_ERR', ifErrors($errors, 'email')); | ||
| 66 | |||
| 67 | doErrors($template, $errors, 'username'); | ||
| 68 | doErrors($template, $errors, 'password'); | ||
| 69 | doErrors($template, $errors, 'email'); | ||
| 70 | |||
| 71 | $template->add('USERNAME', $username); | ||
| 72 | $template->add('PASSWORD', $password); | ||
| 73 | $template->add('EMAIL', $email); | ||
| 74 | |||
| 75 | $template->display(); | ||
| 76 | } | ||
| 77 | |||
| 78 | function ifErrors($errors, $id) | ||
| 79 | { | ||
| 80 | foreach ($errors as $name => $value) | ||
| 81 | { | ||
| 82 | if ($value['field'] == $id) | ||
| 83 | { | ||
| 84 | return ' error'; | ||
| 85 | } | ||
| 86 | } | ||
| 87 | |||
| 88 | return ''; | ||
| 89 | } | ||
| 90 | |||
| 91 | function doErrors($template, $errors, $id) | ||
| 92 | { | ||
| 93 | foreach ($errors as $name => $value) | ||
| 94 | { | ||
| 95 | if ($value['field'] == $id) | ||
| 96 | { | ||
| 97 | $template->adds_block(strtoupper($id) . '_ERRS', array( 'NAME' => $name, | ||
| 98 | 'VALUE' => $value['msg'])); | ||
| 99 | } | ||
| 100 | } | ||
| 101 | } | ||
| 102 | |||
| 103 | function addError(&$numOfErrors, &$errors, $field, $msg) | ||
| 104 | { | ||
| 105 | $numOfErrors++; | ||
| 106 | $errors[$numOfErrors] = array('field' => $field, 'msg' => $msg); | ||
| 107 | } | ||
| 108 | |||
| 109 | ?> | ||
