aboutsummaryrefslogtreecommitdiffstats
path: root/functions
diff options
context:
space:
mode:
authorWesley Miaw <josuah@users.sourceforge.net>2003-11-25 22:13:56 +0000
committerWesley Miaw <josuah@users.sourceforge.net>2003-11-25 22:13:56 +0000
commit4720787ca018e3d701479698f02b5a1df491c466 (patch)
tree1df8380e2edbf92942457a90997b80c14fa31e0f /functions
parent3296fc0d10a3f794541a9ff162490b6164e6a59d (diff)
downloadphpicalendar-4720787ca018e3d701479698f02b5a1df491c466.tar.gz
phpicalendar-4720787ca018e3d701479698f02b5a1df491c466.tar.bz2
phpicalendar-4720787ca018e3d701479698f02b5a1df491c466.zip
Fleshed out invalid login error response. Only checks for invalid
logins for non-HTTP authentication (even if there is no calendar map for an HTTP authenticated user). Switched some include() directives to include_once() to prevent possible future redeclaration errors.
Diffstat (limited to 'functions')
-rw-r--r--functions/ical_parser.php10
-rw-r--r--functions/init.inc.php24
2 files changed, 24 insertions, 10 deletions
diff --git a/functions/ical_parser.php b/functions/ical_parser.php
index e2d9a97..fe77dd9 100644
--- a/functions/ical_parser.php
+++ b/functions/ical_parser.php
@@ -1,11 +1,11 @@
<?php
if (!defined('BASE')) define('BASE', './');
-include(BASE.'functions/init.inc.php');
-include(BASE.'functions/date_functions.php');
-include(BASE.'functions/draw_functions.php');
-include(BASE.'functions/overlapping_events.php');
-include(BASE.'functions/timezones.php');
+include_once(BASE.'functions/init.inc.php');
+include_once(BASE.'functions/date_functions.php');
+include_once(BASE.'functions/draw_functions.php');
+include_once(BASE.'functions/overlapping_events.php');
+include_once(BASE.'functions/timezones.php');
$fillTime = $day_start;
$day_array = array ();
diff --git a/functions/init.inc.php b/functions/init.inc.php
index d78d734..992068d 100644
--- a/functions/init.inc.php
+++ b/functions/init.inc.php
@@ -6,7 +6,7 @@
//chmod(BASE.'calendars/School.ics',0666);
// uncomment when developing, comment for shipping version
-error_reporting (E_ERROR | E_WARNING);
+error_reporting (E_ERROR | E_WARNING | E_PARSE);
// Older versions of PHP do not define $_SERVER. Define it here instead.
if (!isset($_SERVER) && isset($HTTP_SERVER_VARS)) {
@@ -18,9 +18,9 @@ $ALL_CALENDARS_COMBINED = 'all_calendars_combined971';
// Pull in the configuration and some functions.
if (!defined('BASE')) define('BASE', './');
-include(BASE.'config.inc.php');
-include(BASE.'functions/error.php');
-include(BASE.'functions/calendar_functions.php');
+include_once(BASE.'config.inc.php');
+include_once(BASE.'functions/error.php');
+include_once(BASE.'functions/calendar_functions.php');
if (isset($HTTP_COOKIE_VARS['phpicalendar'])) {
$phpicalendar = unserialize(stripslashes($HTTP_COOKIE_VARS['phpicalendar']));
if (isset($phpicalendar['cookie_language'])) $language = $phpicalendar['cookie_language'];
@@ -54,8 +54,22 @@ if (!isset($_SERVER['PHP_AUTH_USER'])) {
if (isset($HTTP_GET_VARS['password'])) $password = $HTTP_GET_VARS['password'];
else if (isset($HTTP_POST_VARS['password'])) $password = $HTTP_POST_VARS['password'];
- // Set the login cookie if logging in. Clear it if logging out.
+ // Grab the action (login or logout).
$action = (isset($_REQUEST['action'])) ? $_REQUEST['action'] : '';
+
+ // Check to make sure the username and password is valid.
+ if (!key_exists("$username:$password", $locked_map)) {
+ // Don't login, instead logout.
+ $action = 'logout';
+
+ // Remember the invalid login, because we may want to
+ // display a message elsewhere.
+ $invalid_login = true;
+ } else {
+ $invalid_login = false;
+ }
+
+ // Set the login cookie if logging in. Clear it if logging out.
if ($action == 'login') {
$the_cookie = serialize(array('username' => $username, 'password' => $password));
setcookie('phpicalendar_login', $the_cookie, time()+(60*60*24*7*12*10), '/', $cookie_uri, 0);

© 2014-2024 Faster IT GmbH | imprint | privacy policy