5 * LICENSE: This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
17 * @author Rod Roark <rod@sunsetsystems.com>
18 * @author Brady Miller <brady@sparmy.com>
19 * @author Kevin Yeh <kevin.y@integralemr.com>
20 * @author Scott Wakefield <scott.wakefield@gmail.com>
21 * @author ViCarePlus <visolve_emr@visolve.com>
22 * @author Julia Longtin <julialongtin@diasp.org>
25 * @link http://www.open-emr.org
28 $fake_register_globals=false;
29 $sanitize_all_escapes=true;
32 include_once("../globals.php");
33 include_once("$srcdir/sql.inc");
37 <?php
html_header_show();?
>
38 <link rel
=stylesheet href
="<?php echo $css_header;?>" type
="text/css">
39 <link rel
=stylesheet href
="../themes/login.css" type
="text/css">
41 <script language
='JavaScript' src
="../../library/js/jquery-1.4.3.min.js"></script
>
42 <script language
='JavaScript'>
43 function transmit_form()
45 document
.forms
[0].submit();
47 function imsubmitted() {
48 <?php
if (!empty($GLOBALS['restore_sessions'])) { ?
>
49 // Delete the session cookie by setting its expiration date in the past.
50 // This forces the server to create a new session ID.
51 var olddate
= new Date();
52 olddate
.setFullYear(olddate
.getFullYear() - 1);
53 document
.cookie
= '<?php echo session_name() . '=' . session_id() ?>; path=/; expires=' + olddate
.toGMTString();
55 return false; //Currently the submit action is handled by the encrypt_form().
60 <body onload
="javascript:document.login_form.authUser.focus();" >
61 <span
class="text"></span
>
65 action
="../main/main_screen.php?auth=login&site=<?php echo attr($_SESSION['site_id']); ?>"
66 target
="_top" name
="login_form" onsubmit
="return imsubmitted();">
68 <input type
='hidden' name
='new_login_session_management' value
='1' />
72 $res = sqlStatement("select distinct name from groups");
73 for ($iter = 0;$row = sqlFetchArray($res);$iter++
)
74 $result[$iter] = $row;
75 if (count($result) == 1) {
76 $resvalue = $result[0]{"name"};
77 echo "<input type='hidden' name='authProvider' value='" . attr($resvalue) . "' />\n";
79 // collect default language id
80 $res2 = sqlStatement("select * from lang_languages where lang_description = ?",array($GLOBALS['language_default']));
81 for ($iter = 0;$row = sqlFetchArray($res2);$iter++
)
82 $result2[$iter] = $row;
83 if (count($result2) == 1) {
84 $defaultLangID = $result2[0]{"lang_id"};
85 $defaultLangName = $result2[0]{"lang_description"};
88 //default to english if any problems
90 $defaultLangName = "English";
92 // set session variable to default so login information appears in default language
93 $_SESSION['language_choice'] = $defaultLangID;
94 // collect languages if showing language menu
95 if ($GLOBALS['language_menu_login']) {
97 // sorting order of language titles depends on language translation options.
98 $mainLangID = empty($_SESSION['language_choice']) ?
'1' : $_SESSION['language_choice'];
99 if ($mainLangID == '1' && !empty($GLOBALS['skip_english_translation']))
101 $sql = "SELECT *,lang_description as trans_lang_description FROM lang_languages ORDER BY lang_description, lang_id";
102 $res3=SqlStatement($sql);
105 // Use and sort by the translated language name.
106 $sql = "SELECT ll.lang_id, " .
107 "IF(LENGTH(ld.definition),ld.definition,ll.lang_description) AS trans_lang_description, " .
108 "ll.lang_description " .
109 "FROM lang_languages AS ll " .
110 "LEFT JOIN lang_constants AS lc ON lc.constant_name = ll.lang_description " .
111 "LEFT JOIN lang_definitions AS ld ON ld.cons_id = lc.cons_id AND " .
113 "ORDER BY IF(LENGTH(ld.definition),ld.definition,ll.lang_description), ll.lang_id";
114 $res3=SqlStatement($sql, array($mainLangID));
117 for ($iter = 0;$row = sqlFetchArray($res3);$iter++
)
118 $result3[$iter] = $row;
119 if (count($result3) == 1) {
120 //default to english if only return one language
121 echo "<input type='hidden' name='languageChoice' value='1' />\n";
125 echo "<input type='hidden' name='languageChoice' value='".attr($defaultLangID)."' />\n";
129 <table width
="100%" height
="90%">
130 <td align
='center' valign
='middle' width
='34%'>
131 <div
class="login-box">
132 <div
class="logo-left"><?php
echo $logocode;?
></div
>
134 <div
class="table-right">
136 <?php
if (count($result) != 1) { ?
>
138 <td
><span
class="text"><?php
echo xlt('Group:'); ?
></span
></td
>
140 <select name
=authProvider
>
142 foreach ($result as $iter) {
143 echo "<option value='".attr($iter{"name"})."'>".text($iter{"name"})."</option>\n";
150 <?php
if (isset($_SESSION['loginfailure']) && ($_SESSION['loginfailure'] == 1)): ?
>
151 <tr
><td colspan
='2' class='text' style
='color:red'>
152 <?php
echo xlt('Invalid username or password'); ?
>
156 <?php
if (isset($_SESSION['relogin']) && ($_SESSION['relogin'] == 1)): ?
>
157 <tr
><td colspan
='2' class='text' style
='color:red;background-color:#dfdfdf;border:solid 1px #bfbfbf;text-align:center'>
158 <b
><?php
echo xlt('Password security has recently been upgraded.'); ?
><br
>
159 <?php
echo xlt('Please login again.'); ?
></b
>
160 <?php
unset($_SESSION['relogin']); ?
>
165 <td
><span
class="text"><?php
echo xlt('Username:'); ?
></span
></td
>
167 <input
class="entryfield" type
="text" size
="10" name
="authUser">
169 <td
><span
class="text"><?php
echo xlt('Password:'); ?
></span
></td
>
171 <input
class="entryfield" type
="password" size
="10" name
="clearPass">
175 if ($GLOBALS['language_menu_login']) {
176 if (count($result3) != 1) { ?
>
178 <td
><span
class="text"><?php
echo xlt('Language'); ?
>:</span
></td
>
180 <select
class="entryfield" name
=languageChoice size
="1">
182 echo "<option selected='selected' value='" . attr($defaultLangID) . "'>" . xlt('Default') . " - " . xlt($defaultLangName) . "</option>\n";
183 foreach ($result3 as $iter) {
184 if ($GLOBALS['language_menu_showall']) {
185 if ( !$GLOBALS['allow_debug_language'] && $iter[lang_description
] == 'dummy') continue; // skip the dummy language
186 echo "<option value='".attr($iter['lang_id'])."'>".text($iter['trans_lang_description'])."</option>\n";
189 if (in_array($iter[lang_description
], $GLOBALS['language_menu_show'])) {
190 if ( !$GLOBALS['allow_debug_language'] && $iter['lang_description'] == 'dummy') continue; // skip the dummy language
191 echo "<option value='".attr($iter['lang_id'])."'>" . text($iter['trans_lang_description']) . "</option>\n";
200 <tr
><td
> 
;</td
><td
>
201 <input
class="button large" type
="submit" onClick
="transmit_form()" value
="<?php echo xla('Login');?>">
203 <tr
><td colspan
='2' class='text' style
='color:red'>
205 $ip=$_SERVER['REMOTE_ADDR'];
212 <div style
="clear: both;"> </div
>
213 <div
class="version">
214 <?php
echo "v".text($openemr_version) ?
> |
<a href
="../../acknowledge_license_cert.html" target
="main"><?php
echo xlt('Acknowledgments, Licensing and Certification'); ?
></a
>
218 <!-- Uncomment this
for the OpenEMR demo installation
219 <p
><center
>login
= admin