Compact css tweak
[openemr.git] / interface / main / pwd_expires_alert.php
blob5e6f07542616f58ada3ae50df08b2d83c507a1a3
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
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'];
36 $current_date = date("Y-m-d");
37 $grace_time = date("Y-m-d", strtotime($pwd_expires . "+" . $GLOBALS['password_grace_time'] . "days"));
38 $pwd_alert = date("Y-m-d", strtotime($pwd_expires . "-7 days"));
39 $msg_alert = "";
41 // Determine the expiration message to display
42 if (($pwd_expires == "0000-00-00") or ($pwd_expires == "")) {
43 $msg_alert = xl("Your Password Expired. Please change your password.");
44 $case="alertmsg1";
45 } else if ((strtotime($current_date) > strtotime($pwd_expires)) && ($grace_time != "") &&
46 ($pwd_expires != "") && (strtotime($current_date) < strtotime($grace_time))) {
47 //display warning if user is in grace period to change password
48 $msg_alert = xl("You are in Grace Login period. Change your password before")." ".$grace_time;
49 $case="alertmsg1";
50 } else if (strtotime($pwd_expires) == strtotime($current_date)) {
51 // Display warning if password expires on current day
52 $msg_alert = xl("Your Password Expires today. Please change your password.");
53 $case="alertmsg2";
54 } else if ((strtotime($current_date) >= strtotime($pwd_alert)) && strtotime($pwd_alert) != "") {
55 // Display a notice that password expires soon
56 $msg_alert = xl("Your Password Expires on")." ".$pwd_expires.". ".xl("Please change your password.");
57 $case="alertmsg3";
62 <html>
63 <head>
64 <meta http-equiv="Content-Language" content="en-us">
65 <?php html_header_show();?>
66 <link rel='stylesheet' href="<?php echo $css_header;?>" type="text/css">
67 </head>
68 <body class="body_bottom">
70 <br/><br/><br/><span class="pwdalert <?php echo attr($case); ?>">
71 <table align="center" >
73 <tr valign="top">
74 <td>&nbsp;</td>
75 <td rowspan="3"><?php echo xlt("Welcome");
76 echo " ".text($username);?>,<br>
77 <br>
78 <?php echo text($msg_alert);?>
79 <br>
80 </td>
81 <td>&nbsp;</td>
82 </tr>
84 <tr>
85 <td>&nbsp;</td>
86 <td>&nbsp;</td>
87 </tr>
88 <tr>
89 <td>&nbsp;</td>
90 <td>&nbsp;</td>
91 </tr>
92 </table></span>
95 </body>
96 </html>