$username, 'password' => $password)); setcookie('phpicalendar_login', $the_cookie, time()+(60*60*24*7*12*10), '/', $cookie_uri, 0); } else { $_SESSION['username'] = $username; $_SESSION['password'] = $password; } // Return the username and password. return array($username, $password, $invalid_login); } // Logout the user. The username and password stored in cookies or the // session will be deleted. // // Returns an empty username and password. function user_logout() { global $login_cookies, $cookie_uri; // Clear the login cookie or session authentication values. if ($login_cookies == 'yes') { setcookie('phpicalendar_login', '', time()-(60*60*24*7), '/', $cookie_uri, 0); } else { // Check if the session has already been started. if (!session_id()) { session_start(); setcookie(session_name(), session_id(), time()+(60*60*24*7*12*10), '/', $cookie_uri, 0); } // Clear the session authentication values. unset($_SESSION['username']); unset($_SESSION['password']); } // Return empty username and password. return array('', ''); } ?>