about summary refs log tree commit diff stats
path: root/central/trunk/login.php
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2008-09-28 21:40:47 +0000
committerKelly Rauchenberger <fefferburbia@gmail.com>2008-09-28 21:40:47 +0000
commitfb1b67b6922a20fdc3538dd6ae4659dfc1d8d7d2 (patch)
tree9ad7b7c72f451fd5bdcb2c33a6586c586309ab10 /central/trunk/login.php
parent9d6ed35e4faa192ea734bfc353a6be65b977a6e6 (diff)
downloadinstadisc-fb1b67b6922a20fdc3538dd6ae4659dfc1d8d7d2.tar.gz
instadisc-fb1b67b6922a20fdc3538dd6ae4659dfc1d8d7d2.tar.bz2
instadisc-fb1b67b6922a20fdc3538dd6ae4659dfc1d8d7d2.zip
Central: Removed UI
Refs #63
Diffstat (limited to 'central/trunk/login.php')
-rw-r--r--central/trunk/login.php87
1 files changed, 0 insertions, 87 deletions
diff --git a/central/trunk/login.php b/central/trunk/login.php deleted file mode 100644 index 19c5dc3..0000000 --- a/central/trunk/login.php +++ /dev/null
@@ -1,87 +0,0 @@
1<?php
2
3/* InstaDisc Server - A Four Island Project */
4
5include('includes/instadisc.php');
6include('includes/template.php');
7
8if (!isset($_GET['submit']))
9{
10 showForm('','',array());
11} else {
12 $numOfErrors = 0;
13 $errors = array();
14
15 if (instaDisc_verifyUser($_POST['username'], $_POST['password']))
16 {
17 $_SESSION['username'] = $_POST['username'];
18
19 $template = new FITemplate('loggedin');
20 $template->add('SITENAME', instaDisc_getConfig('siteName'));
21 $template->display();
22 } else {
23 addError($numOfErrors, $errors, '', 'Account could not be found');
24 showForm($_POST['username'], $_POST['password'], $errors);
25 }
26}
27
28function showForm($username, $password, $errors)
29{
30 $template = new FITemplate('login');
31 $template->add('SITENAME', instaDisc_getConfig('siteName'));
32
33 if (isset($errors[1]))
34 {
35 $template->adds_block('ERROR', array('ex'=>'1'));
36
37 foreach ($errors as $name => $value)
38 {
39 $template->adds_block('ERRORS', array( 'NAME' => $name,
40 'MSG' => $value['msg']));
41 }
42 }
43
44 $template->add('USERNAME_ERR', ifErrors($errors, 'username'));
45 $template->add('PASSWORD_ERR', ifErrors($errors, 'password'));
46
47 doErrors($template, $errors, 'username');
48 doErrors($template, $errors, 'password');
49
50 $template->add('USERNAME', $username);
51 $template->add('PASSWORD', $password);
52
53 $template->display();
54}
55
56function ifErrors($errors, $id)
57{
58 foreach ($errors as $name => $value)
59 {
60 if ($value['field'] == $id)
61 {
62 return ' error';
63 }
64 }
65
66 return '';
67}
68
69function doErrors($template, $errors, $id)
70{
71 foreach ($errors as $name => $value)
72 {
73 if ($value['field'] == $id)
74 {
75 $template->adds_block(strtoupper($id) . '_ERRS', array( 'NAME' => $name,
76 'VALUE' => $value['msg']));
77 }
78 }
79}
80
81function addError(&$numOfErrors, &$errors, $field, $msg)
82{
83 $numOfErrors++;
84 $errors[$numOfErrors] = array('field' => $field, 'msg' => $msg);
85}
86
87?>