about summary refs log tree commit diff stats
path: root/series/core/trunk/admin/login.php
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2008-09-10 21:06:49 +0000
committerKelly Rauchenberger <fefferburbia@gmail.com>2008-09-10 21:06:49 +0000
commit44c3bc48b5db7b3dc6517d2b073a55af5d4b52db (patch)
treea48f63061f3cfe5427ce1bc313147cf6be0e739a /series/core/trunk/admin/login.php
parenta9a796498285358e7a2f1fde5043e4015de5db70 (diff)
downloadinstadisc-44c3bc48b5db7b3dc6517d2b073a55af5d4b52db.tar.gz
instadisc-44c3bc48b5db7b3dc6517d2b073a55af5d4b52db.tar.bz2
instadisc-44c3bc48b5db7b3dc6517d2b073a55af5d4b52db.zip
Series: Moved around directory structure
Refs #55
Diffstat (limited to 'series/core/trunk/admin/login.php')
-rw-r--r--series/core/trunk/admin/login.php95
1 files changed, 0 insertions, 95 deletions
diff --git a/series/core/trunk/admin/login.php b/series/core/trunk/admin/login.php deleted file mode 100644 index fe394a1..0000000 --- a/series/core/trunk/admin/login.php +++ /dev/null
@@ -1,95 +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($_GET['submit']))
17{
18 showForm('','',array());
19} else {
20 $numOfErrors = 0;
21 $errors = array();
22
23 if (instaDisc_verifyUser($_POST['username'], $_POST['password']))
24 {
25 $_SESSION['username'] = $_POST['username'];
26
27 $template = new FITemplate('loggedin');
28 $template->add('SITENAME', instaDisc_getConfig('siteName'));
29 $template->display();
30 } else {
31 addError($numOfErrors, $errors, '', 'Account could not be found');
32 showForm($_POST['username'], $_POST['password'], $errors);
33 }
34}
35
36function showForm($username, $password, $errors)
37{
38 $template = new FITemplate('login');
39 $template->add('SITENAME', instaDisc_getConfig('siteName'));
40
41 if (isset($errors[1]))
42 {
43 $template->adds_block('ERROR', array('ex'=>'1'));
44
45 foreach ($errors as $name => $value)
46 {
47 $template->adds_block('ERRORS', array( 'NAME' => $name,
48 'MSG' => $value['msg']));
49 }
50 }
51
52 $template->add('USERNAME_ERR', ifErrors($errors, 'username'));
53 $template->add('PASSWORD_ERR', ifErrors($errors, 'password'));
54
55 doErrors($template, $errors, 'username');
56 doErrors($template, $errors, 'password');
57
58 $template->add('USERNAME', $username);
59 $template->add('PASSWORD', $password);
60
61 $template->display();
62}
63
64function ifErrors($errors, $id)
65{
66 foreach ($errors as $name => $value)
67 {
68 if ($value['field'] == $id)
69 {
70 return ' error';
71 }
72 }
73
74 return '';
75}
76
77function doErrors($template, $errors, $id)
78{
79 foreach ($errors as $name => $value)
80 {
81 if ($value['field'] == $id)
82 {
83 $template->adds_block(strtoupper($id) . '_ERRS', array( 'NAME' => $name,
84 'VALUE' => $value['msg']));
85 }
86 }
87}
88
89function addError(&$numOfErrors, &$errors, $field, $msg)
90{
91 $numOfErrors++;
92 $errors[$numOfErrors] = array('field' => $field, 'msg' => $msg);
93}
94
95?>