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 <title
><?php
echo text($openemr_name) . " " . xlt('Login'); ?
></title
>
39 <meta http
-equiv
="X-UA-Compatible" content
="IE=edge" />
40 <link rel
=stylesheet href
="<?php echo $css_header;?>" type
="text/css">
41 <link rel
=stylesheet href
="../themes/login.css" type
="text/css">
43 <script language
='JavaScript' src
="../../library/js/jquery-1.4.3.min.js"></script
>
44 <script language
='JavaScript'>
45 function transmit_form()
47 document
.forms
[0].submit();
49 function imsubmitted() {
50 <?php
if (!empty($GLOBALS['restore_sessions'])) { ?
>
51 // Delete the session cookie by setting its expiration date in the past.
52 // This forces the server to create a new session ID.
53 var olddate
= new Date();
54 olddate
.setFullYear(olddate
.getFullYear() - 1);
55 document
.cookie
= '<?php echo session_name() . '=' . session_id() ?>; path=/; expires=' + olddate
.toGMTString();
57 return false; //Currently the submit action is handled by the encrypt_form().
62 <body onload
="javascript:document.login_form.authUser.focus();">
64 <img style
="position:absolute;top:0;left:0;"src
=" <?php echo $GLOBALS['webroot']?>/interface/pic/logo.gif" />
66 <div
class="body_title">
67 <span
class="title_bar">
68 <div id
='tinylogocontainer' class='tinylogocontainer'>
69 <?php
if ($GLOBALS['tiny_logo_1']) {echo $tinylogocode1;} if ($GLOBALS['tiny_logo_2']) {echo $tinylogocode2;} ?
>
71 <div
class="title_name"><?php
echo text($openemr_name); ?
></div
>
75 <span
class="text"></span
>
79 action
="../main/main_screen.php?auth=login&site=<?php echo attr($_SESSION['site_id']); ?>"
80 target
="_top" name
="login_form" onsubmit
="return imsubmitted();">
82 <input type
='hidden' name
='new_login_session_management' value
='1' />
86 $res = sqlStatement("select distinct name from groups");
87 for ($iter = 0;$row = sqlFetchArray($res);$iter++
)
88 $result[$iter] = $row;
89 if (count($result) == 1) {
90 $resvalue = $result[0]{"name"};
91 echo "<input type='hidden' name='authProvider' value='" . attr($resvalue) . "' />\n";
93 // collect default language id
94 $res2 = sqlStatement("select * from lang_languages where lang_description = ?",array($GLOBALS['language_default']));
95 for ($iter = 0;$row = sqlFetchArray($res2);$iter++
)
96 $result2[$iter] = $row;
97 if (count($result2) == 1) {
98 $defaultLangID = $result2[0]{"lang_id"};
99 $defaultLangName = $result2[0]{"lang_description"};
102 //default to english if any problems
104 $defaultLangName = "English";
106 // set session variable to default so login information appears in default language
107 $_SESSION['language_choice'] = $defaultLangID;
108 // collect languages if showing language menu
109 if ($GLOBALS['language_menu_login']) {
111 // sorting order of language titles depends on language translation options.
112 $mainLangID = empty($_SESSION['language_choice']) ?
'1' : $_SESSION['language_choice'];
113 if ($mainLangID == '1' && !empty($GLOBALS['skip_english_translation']))
115 $sql = "SELECT *,lang_description as trans_lang_description FROM lang_languages ORDER BY lang_description, lang_id";
116 $res3=SqlStatement($sql);
119 // Use and sort by the translated language name.
120 $sql = "SELECT ll.lang_id, " .
121 "IF(LENGTH(ld.definition),ld.definition,ll.lang_description) AS trans_lang_description, " .
122 "ll.lang_description " .
123 "FROM lang_languages AS ll " .
124 "LEFT JOIN lang_constants AS lc ON lc.constant_name = ll.lang_description " .
125 "LEFT JOIN lang_definitions AS ld ON ld.cons_id = lc.cons_id AND " .
127 "ORDER BY IF(LENGTH(ld.definition),ld.definition,ll.lang_description), ll.lang_id";
128 $res3=SqlStatement($sql, array($mainLangID));
131 for ($iter = 0;$row = sqlFetchArray($res3);$iter++
)
132 $result3[$iter] = $row;
133 if (count($result3) == 1) {
134 //default to english if only return one language
135 echo "<input type='hidden' name='languageChoice' value='1' />\n";
139 echo "<input type='hidden' name='languageChoice' value='".attr($defaultLangID)."' />\n";
143 <table width
="100%" height
="90%">
144 <td align
='center' valign
='middle' width
='34%'>
145 <div
class="login-box">
146 <div
class="logo-left"><?php
echo $logocode;?
></div
>
148 <div
class="table-right">
150 <?php
if (count($result) != 1) { ?
>
152 <td
><span
class="text"><?php
echo xlt('Group:'); ?
></span
></td
>
154 <select name
=authProvider
>
156 foreach ($result as $iter) {
157 echo "<option value='".attr($iter{"name"})."'>".text($iter{"name"})."</option>\n";
164 <?php
if (isset($_SESSION['loginfailure']) && ($_SESSION['loginfailure'] == 1)): ?
>
165 <tr
><td colspan
='2' class='text' style
='color:red'>
166 <?php
echo xlt('Invalid username or password'); ?
>
170 <?php
if (isset($_SESSION['relogin']) && ($_SESSION['relogin'] == 1)): ?
>
171 <tr
><td colspan
='2' class='text' style
='color:red;background-color:#dfdfdf;border:solid 1px #bfbfbf;text-align:center'>
172 <b
><?php
echo xlt('Password security has recently been upgraded.'); ?
><br
>
173 <?php
echo xlt('Please login again.'); ?
></b
>
174 <?php
unset($_SESSION['relogin']); ?
>
179 <td
><span
class="text"><?php
echo xlt('Username:'); ?
></span
></td
>
181 <input
class="entryfield" type
="text" size
="10" name
="authUser">
183 <td
><span
class="text"><?php
echo xlt('Password:'); ?
></span
></td
>
185 <input
class="entryfield" type
="password" size
="10" name
="clearPass">
189 if ($GLOBALS['language_menu_login']) {
190 if (count($result3) != 1) { ?
>
192 <td
><span
class="text"><?php
echo xlt('Language'); ?
>:</span
></td
>
194 <select
class="entryfield" name
=languageChoice size
="1">
196 echo "<option selected='selected' value='" . attr($defaultLangID) . "'>" . xlt('Default') . " - " . xlt($defaultLangName) . "</option>\n";
197 foreach ($result3 as $iter) {
198 if ($GLOBALS['language_menu_showall']) {
199 if ( !$GLOBALS['allow_debug_language'] && $iter[lang_description
] == 'dummy') continue; // skip the dummy language
200 echo "<option value='".attr($iter['lang_id'])."'>".text($iter['trans_lang_description'])."</option>\n";
203 if (in_array($iter[lang_description
], $GLOBALS['language_menu_show'])) {
204 if ( !$GLOBALS['allow_debug_language'] && $iter['lang_description'] == 'dummy') continue; // skip the dummy language
205 echo "<option value='".attr($iter['lang_id'])."'>" . text($iter['trans_lang_description']) . "</option>\n";
214 <tr
><td
> 
;</td
><td
>
215 <input
class="button large" type
="submit" onClick
="transmit_form()" value
="<?php echo xla('Login');?>">
217 <tr
><td colspan
='2' class='text' style
='color:red'>
219 $ip=$_SERVER['REMOTE_ADDR'];
226 <div style
="clear: both;"> </div
>
227 <div
class="version">
228 <a href
="../../acknowledge_license_cert.html" target
="main"><?php
echo xlt('Acknowledgments, Licensing and Certification'); ?
></a
>
232 <!-- Uncomment this
for the OpenEMR demo installation
233 <p
><center
>login
= admin