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/activate.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/activate.php')
| -rw-r--r-- | central/trunk/activate.php | 103 |
1 files changed, 0 insertions, 103 deletions
| diff --git a/central/trunk/activate.php b/central/trunk/activate.php deleted file mode 100644 index 9706a69..0000000 --- a/central/trunk/activate.php +++ /dev/null | |||
| @@ -1,103 +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 | $getpending = "SELECT * FROM pending WHERE username = \"" . mysql_real_escape_string($_POST['username']) . "\" AND code = \"" . mysql_real_escape_string($_POST['code']) . "\""; | ||
| 16 | $getpending2 = mysql_query($getpending); | ||
| 17 | $getpending3 = mysql_fetch_array($getpending2); | ||
| 18 | if ($getpending3['username'] != $_POST['username']) | ||
| 19 | { | ||
| 20 | addError($numOfErrors, $errors, '', 'Account could not be found'); | ||
| 21 | } | ||
| 22 | |||
| 23 | if ($numOfErrors > 0) | ||
| 24 | { | ||
| 25 | showForm($_POST['username'], $_POST['code'], $errors); | ||
| 26 | } else { | ||
| 27 | if ($_POST['submit'] == "Verify") | ||
| 28 | { | ||
| 29 | if (instaDisc_activateAccount($_POST['username'], $_POST['code'])) | ||
| 30 | { | ||
| 31 | $template = new FITemplate('activated'); | ||
| 32 | $template->add('SITENAME', instaDisc_getConfig('siteName')); | ||
| 33 | $template->display(); | ||
| 34 | } else { | ||
| 35 | addError($numOfErrors, $errors, '', 'The email could not be sent'); | ||
| 36 | showForm($_POST['username'], $_POST['code'], $errors); | ||
| 37 | } | ||
| 38 | } else { | ||
| 39 | instaDisc_deactivateAccount($_POST['username'], $_POST['code']); | ||
| 40 | } | ||
| 41 | } | ||
| 42 | } | ||
| 43 | |||
| 44 | function showForm($username, $code, $errors) | ||
| 45 | { | ||
| 46 | $template = new FITemplate('activate'); | ||
| 47 | $template->add('SITENAME', instaDisc_getConfig('siteName')); | ||
| 48 | |||
| 49 | if (isset($errors[1])) | ||
| 50 | { | ||
| 51 | $template->adds_block('ERROR', array('ex'=>'1')); | ||
| 52 | |||
| 53 | foreach ($errors as $name => $value) | ||
| 54 | { | ||
| 55 | $template->adds_block('ERRORS', array( 'NAME' => $name, | ||
| 56 | 'MSG' => $value['msg'])); | ||
| 57 | } | ||
| 58 | } | ||
| 59 | |||
| 60 | $template->add('USERNAME_ERR', ifErrors($errors, 'username')); | ||
| 61 | $template->add('CODE_ERR', ifErrors($errors, 'code')); | ||
| 62 | |||
| 63 | doErrors($template, $errors, 'username'); | ||
| 64 | doErrors($template, $errors, 'code'); | ||
| 65 | |||
| 66 | $template->add('USERNAME', $username); | ||
| 67 | $template->add('CODE', $code); | ||
| 68 | |||
| 69 | $template->display(); | ||
| 70 | } | ||
| 71 | |||
| 72 | function ifErrors($errors, $id) | ||
| 73 | { | ||
| 74 | foreach ($errors as $name => $value) | ||
| 75 | { | ||
| 76 | if ($value['field'] == $id) | ||
| 77 | { | ||
| 78 | return ' error'; | ||
| 79 | } | ||
| 80 | } | ||
| 81 | |||
| 82 | return ''; | ||
| 83 | } | ||
| 84 | |||
| 85 | function doErrors($template, $errors, $id) | ||
| 86 | { | ||
| 87 | foreach ($errors as $name => $value) | ||
| 88 | { | ||
| 89 | if ($value['field'] == $id) | ||
| 90 | { | ||
| 91 | $template->adds_block(strtoupper($id) . '_ERRS', array( 'NAME' => $name, | ||
| 92 | 'VALUE' => $value['msg'])); | ||
| 93 | } | ||
| 94 | } | ||
| 95 | } | ||
| 96 | |||
| 97 | function addError(&$numOfErrors, &$errors, $field, $msg) | ||
| 98 | { | ||
| 99 | $numOfErrors++; | ||
| 100 | $errors[$numOfErrors] = array('field' => $field, 'msg' => $msg); | ||
| 101 | } | ||
| 102 | |||
| 103 | ?> | ||
