about summary refs log tree commit diff stats
path: root/series/trunk/admin/adduser.php
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2008-09-18 21:59:23 +0000
committerKelly Rauchenberger <fefferburbia@gmail.com>2008-09-18 21:59:23 +0000
commitfd3f2cbdaa1e3c160727c3cf09ef03d06174c114 (patch)
tree12ea30a00c68891f2fbc01f5b2730bc6edc153aa /series/trunk/admin/adduser.php
parentd2a7b26e98569624347d717d7fdfe6c3074658a9 (diff)
downloadinstadisc-fd3f2cbdaa1e3c160727c3cf09ef03d06174c114.tar.gz
instadisc-fd3f2cbdaa1e3c160727c3cf09ef03d06174c114.tar.bz2
instadisc-fd3f2cbdaa1e3c160727c3cf09ef03d06174c114.zip
Series: Removed Series component
Refs #57
Diffstat (limited to 'series/trunk/admin/adduser.php')
-rw-r--r--series/trunk/admin/adduser.php110
1 files changed, 0 insertions, 110 deletions
diff --git a/series/trunk/admin/adduser.php b/series/trunk/admin/adduser.php deleted file mode 100644 index dcad5d5..0000000 --- a/series/trunk/admin/adduser.php +++ /dev/null
@@ -1,110 +0,0 @@
1<?php
2
3/* InstaDisc Series - A Four Island Project */
4
5/**
6 * require_once() is used to ensure
7 * the ACP files are being called by
8 * admin.php instead of their actual
9 * locations admin/.
10 * The _once() part ensures no problem
11 * arises as includes/instadisc.php has
12 * already been included from admin.php
13 */
14require_once('includes/instadisc.php');
15
16if (!isset($_SESSION['username']))
17{
18 header('Location: index.php');
19 exit;
20}
21
22if (!isset($_GET['submit']))
23{
24 showForm('','',array());
25} else {
26 $numOfErrors = 0;
27 $errors = array();
28
29 if ($_POST['username'] == '')
30 {
31 addError($numOfErrors, $errors, 'username', 'Username is a required field');
32 }
33
34 if ($_POST['password'] == '')
35 {
36 addError($numOfErrors, $errors, 'password', 'Password is a required field');
37 }
38
39 if ($numOfErrors > 0)
40 {
41 showForm($_POST['username'], $_POST['password'], $errors);
42 } else {
43 instaDisc_addUser($_POST['username'], $_POST['password']);
44
45 $template = new FITemplate('addeduser');
46 $template->add('SITENAME', instaDisc_getConfig('siteName'));
47 $template->display();
48 }
49}
50
51function showForm($username, $password, $errors)
52{
53 $template = new FITemplate('adduser');
54 $template->add('SITENAME', instaDisc_getConfig('siteName'));
55
56 if (isset($errors[1]))
57 {
58 $template->adds_block('ERROR', array('ex'=>'1'));
59
60 foreach ($errors as $name => $value)
61 {
62 $template->adds_block('ERRORS', array( 'NAME' => $name,
63 'MSG' => $value['msg']));
64 }
65 }
66
67 $template->add('USERNAME_ERR', ifErrors($errors, 'username'));
68 $template->add('PASSWORD_ERR', ifErrors($errors, 'password'));
69
70 doErrors($template, $errors, 'username');
71 doErrors($template, $errors, 'password');
72
73 $template->add('USERNAME', $username);
74 $template->add('PASSWORD', $password);
75
76 $template->display();
77}
78
79function ifErrors($errors, $id)
80{
81 foreach ($errors as $name => $value)
82 {
83 if ($value['field'] == $id)
84 {
85 return ' error';
86 }
87 }
88
89 return '';
90}
91
92function doErrors($template, $errors, $id)
93{
94 foreach ($errors as $name => $value)
95 {
96 if ($value['field'] == $id)
97 {
98 $template->adds_block(strtoupper($id) . '_ERRS', array( 'NAME' => $name,
99 'VALUE' => $value['msg']));
100 }
101 }
102}
103
104function addError(&$numOfErrors, &$errors, $field, $msg)
105{
106 $numOfErrors++;
107 $errors[$numOfErrors] = array('field' => $field, 'msg' => $msg);
108}
109
110?>