More recurring appointment fixes
[openemr.git] / interface / main / pwd_expires_alert.php
blobbe45c09ff782fa97ab03c412795751b96efcc348
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");
27 include_once("$srcdir/sql.inc");
28 require_once("$srcdir/translation.inc.php");
30 $pwd_expires = "";
31 $q = $_SESSION["authUserID"];
32 $result = sqlStatement("select username, pwd_expiration_date from users where id = ?", array($q));
33 if($row = sqlFetchArray($result)) {
34 $pwd_expires = $row['pwd_expiration_date'];
35 $username = $row['username'];
37 $current_date = date("Y-m-d");
38 $grace_time = date("Y-m-d", strtotime($pwd_expires . "+" . $GLOBALS['password_grace_time'] . "days"));
39 $pwd_alert = date("Y-m-d", strtotime($pwd_expires . "-7 days"));
40 $msg_alert = "";
42 // Determine the expiration message to display
43 if (($pwd_expires == "0000-00-00") or ($pwd_expires == "")) {
44 $msg_alert = xl("Your Password Expired. Please change your password.");
45 $case="alertmsg1";
47 else if ((strtotime($current_date) > strtotime($pwd_expires)) && ($grace_time != "") &&
48 ($pwd_expires != "") && (strtotime($current_date) < strtotime($grace_time))) {
50 //display warning if user is in grace period to change password
51 $msg_alert = xl("You are in Grace Login period. Change your password before")." ".$grace_time;
52 $case="alertmsg1";
54 else if (strtotime($pwd_expires) == strtotime($current_date)) {
55 // Display warning if password expires on current day
56 $msg_alert = xl("Your Password Expires today. Please change your password.");
57 $case="alertmsg2";
59 else if ((strtotime($current_date) >= strtotime($pwd_alert)) && strtotime($pwd_alert) != "") {
60 // Display a notice that password expires soon
61 $msg_alert = xl("Your Password Expires on")." ".$pwd_expires.". ".xl("Please change your password.");
62 $case="alertmsg3";
67 <html>
68 <head>
69 <meta http-equiv="Content-Language" content="en-us">
70 <?php html_header_show();?>
71 <link rel='stylesheet' href="<?php echo $css_header;?>" type="text/css">
72 </head>
73 <body class="body_bottom">
75 <br/><br/><br/><span class="pwdalert <?php echo attr($case); ?>">
76 <table align="center" >
78 <tr valign="top">
79 <td>&nbsp;</td>
80 <td rowspan="3"><?php echo xlt("Welcome"); echo " ".text($username);?>,<br>
81 <br>
82 <?php echo text($msg_alert);?>
83 <br>
84 </td>
85 <td>&nbsp;</td>
86 </tr>
88 <tr>
89 <td>&nbsp;</td>
90 <td>&nbsp;</td>
91 </tr>
92 <tr>
93 <td>&nbsp;</td>
94 <td>&nbsp;</td>
95 </tr>
96 </table></span>
99 </body>
100 </html>