Focus the search term on load
[openemr.git] / interface / main / pwd_expires_alert.php
blobb6faac5813313f803a7b8a33cccf0ba4d6b7c6e7
1 <?php
2 //-------------------------------------------------------------------
3 // This program is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU General Public License
5 // as published by the Free Software Foundation; either version 2
6 // of the License, or (at your option) any later version.
7 //Author:- Author:- ViCarePlus Team, Visolve
8 //Email ID:- vicareplus_engg@visolve.com
9 //-------------------------------------------------------------------
10 // Display a message indicating that the user's password has/will expire.
11 include_once("../globals.php");
12 include_once("$srcdir/sql.inc");
13 require_once("$srcdir/translation.inc.php");
15 $pwd_expires = "";
16 $q = $_SESSION["authUserID"];
17 $result = sqlStatement("select username, pwd_expiration_date from users where id = '".$q."'");
18 if($row = sqlFetchArray($result)) {
19 $pwd_expires = $row['pwd_expiration_date'];
20 $username = $row['username'];
22 $current_date = date("Y-m-d");
23 $grace_time = date("Y-m-d", strtotime($pwd_expires . "+" . $GLOBALS['password_grace_time'] . "days"));
24 $pwd_alert = date("Y-m-d", strtotime($pwd_expires . "-7 days"));
25 $msg_alert = "";
27 // Determine the expiration message to display
28 if (($pwd_expires == "0000-00-00") or ($pwd_expires == "")) {
29 $msg_alert = xl("Your Password Expired. Please change your password.");
30 $case="alertmsg1";
32 else if ((strtotime($current_date) > strtotime($pwd_expires)) && ($grace_time != "") &&
33 ($pwd_expires != "") && (strtotime($current_date) < strtotime($grace_time))) {
35 //display warning if user is in grace period to change password
36 $msg_alert = xl("You are in Grace Login period. Change your password before")." ".$grace_time;
37 $case="alertmsg1";
39 else if (strtotime($pwd_expires) == strtotime($current_date)) {
40 // Display warning if password expires on current day
41 $msg_alert = xl("Your Password Expires today. Please change your password.");
42 $case="alertmsg2";
44 else if ((strtotime($current_date) >= strtotime($pwd_alert)) && strtotime($pwd_alert) != "") {
45 // Display a notice that password expires soon
46 $msg_alert = xl("Your Password Expires on")." ".$pwd_expires.". ".xl("Please change your password.");
47 $case="alertmsg3";
52 <html>
53 <head>
54 <meta http-equiv="Content-Language" content="en-us">
55 <?php html_header_show();?>
56 <link rel='stylesheet' href="<?php echo $css_header;?>" type="text/css">
57 </head>
58 <body class="body_bottom">
60 <br/><br/><br/><span class="pwdalert <?php echo $case; ?>">
61 <table align="center" >
63 <tr valign="top">
64 <td>&nbsp;</td>
65 <td rowspan="3"><?php xl("Welcome",e); echo " ".$username;?>,<br>
66 <br>
67 <?php echo $msg_alert;?>
68 <br>
69 </td>
70 <td>&nbsp;</td>
71 </tr>
73 <tr>
74 <td>&nbsp;</td>
75 <td>&nbsp;</td>
76 </tr>
77 <tr>
78 <td>&nbsp;</td>
79 <td>&nbsp;</td>
80 </tr>
81 </table></span>
84 </body>
85 </html>