more organization of autoloaded files (#424)
[openemr.git] / interface / main / pwd_expires_alert.php
blob8b282de6edb745012821f6953ca17393c97e2d3f
1 <?php
2 /**
3 * Display a message indicating that the user's password has/will expire.
5 * Copyright 2010 ViCarePlus Team, Visolve <vicareplus_engg@visolve.com>
7 * LICENSE: This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
18 * @package OpenEMR
19 * @author ViCarePlus Team, Visolve <vicareplus_engg@visolve.com>
20 * @link http://www.open-emr.org
23 $fake_register_globals=false;
24 $sanitize_all_escapes=true;
26 include_once("../globals.php");
28 $pwd_expires = "";
29 $q = $_SESSION["authUserID"];
30 $result = sqlStatement("select username, pwd_expiration_date from users where id = ?", array($q));
31 if($row = sqlFetchArray($result)) {
32 $pwd_expires = $row['pwd_expiration_date'];
33 $username = $row['username'];
35 $current_date = date("Y-m-d");
36 $grace_time = date("Y-m-d", strtotime($pwd_expires . "+" . $GLOBALS['password_grace_time'] . "days"));
37 $pwd_alert = date("Y-m-d", strtotime($pwd_expires . "-7 days"));
38 $msg_alert = "";
40 // Determine the expiration message to display
41 if (($pwd_expires == "0000-00-00") or ($pwd_expires == "")) {
42 $msg_alert = xl("Your Password Expired. Please change your password.");
43 $case="alertmsg1";
45 else if ((strtotime($current_date) > strtotime($pwd_expires)) && ($grace_time != "") &&
46 ($pwd_expires != "") && (strtotime($current_date) < strtotime($grace_time))) {
48 //display warning if user is in grace period to change password
49 $msg_alert = xl("You are in Grace Login period. Change your password before")." ".$grace_time;
50 $case="alertmsg1";
52 else if (strtotime($pwd_expires) == strtotime($current_date)) {
53 // Display warning if password expires on current day
54 $msg_alert = xl("Your Password Expires today. Please change your password.");
55 $case="alertmsg2";
57 else if ((strtotime($current_date) >= strtotime($pwd_alert)) && strtotime($pwd_alert) != "") {
58 // Display a notice that password expires soon
59 $msg_alert = xl("Your Password Expires on")." ".$pwd_expires.". ".xl("Please change your password.");
60 $case="alertmsg3";
65 <html>
66 <head>
67 <meta http-equiv="Content-Language" content="en-us">
68 <?php html_header_show();?>
69 <link rel='stylesheet' href="<?php echo $css_header;?>" type="text/css">
70 </head>
71 <body class="body_bottom">
73 <br/><br/><br/><span class="pwdalert <?php echo attr($case); ?>">
74 <table align="center" >
76 <tr valign="top">
77 <td>&nbsp;</td>
78 <td rowspan="3"><?php echo xlt("Welcome"); echo " ".text($username);?>,<br>
79 <br>
80 <?php echo text($msg_alert);?>
81 <br>
82 </td>
83 <td>&nbsp;</td>
84 </tr>
86 <tr>
87 <td>&nbsp;</td>
88 <td>&nbsp;</td>
89 </tr>
90 <tr>
91 <td>&nbsp;</td>
92 <td>&nbsp;</td>
93 </tr>
94 </table></span>
97 </body>
98 </html>