2 // This program is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU General Public License
4 // as published by the Free Software Foundation; either version 2
5 // of the License, or (at your option) any later version.
8 include_once("../globals.php");
9 include_once("$srcdir/md5.js");
10 include_once("$srcdir/sql.inc");
14 <?php
html_header_show(); ?
>
15 <link rel
=stylesheet href
="<?php echo $css_header;?>" type
="text/css">
17 <script language
='JavaScript'>
19 function imsubmitted() {
20 <?php
if (!empty($GLOBALS['restore_sessions'])) { ?
>
21 // Delete the session cookie by setting its expiration date in the past.
22 // This forces the server to create a new session ID.
23 var olddate
= new Date();
24 olddate
.setFullYear(olddate
.getFullYear() - 1);
25 document
.cookie
= '<?php echo session_name() . '=' . session_id() ?>; path=/; expires=' + olddate
.toGMTString();
33 <body
<?php
echo $login_body_line;?
> onload
="javascript:document.login_form.authUser.focus();" >
35 <span
class="text"></span
>
40 action
="../main/main_screen.php?auth=login&site=<?php echo htmlspecialchars($_SESSION['site_id']); ?>"
41 target
="_top" name
="login_form" onsubmit
="return imsubmitted();">
45 $res = sqlStatement("select distinct name from groups");
46 for ($iter = 0;$row = sqlFetchArray($res);$iter++
)
47 $result[$iter] = $row;
48 if (count($result) == 1) {
49 $resvalue = $result[0]{"name"};
50 echo "<input type='hidden' name='authProvider' value='$resvalue' />\n";
52 // collect default language id
53 $res2 = sqlStatement("select * from lang_languages where lang_description = '".$GLOBALS['language_default']."'");
54 for ($iter = 0;$row = sqlFetchArray($res2);$iter++
)
55 $result2[$iter] = $row;
56 if (count($result2) == 1) {
57 $defaultLangID = $result2[0]{"lang_id"};
58 $defaultLangName = $result2[0]{"lang_description"};
61 //default to english if any problems
63 $defaultLangName = "English";
65 // set session variable to default so login information appears in default language
66 $_SESSION['language_choice'] = $defaultLangID;
67 // collect languages if showing language menu
68 if ($GLOBALS['language_menu_login']) {
70 // sorting order of language titles depends on language translation options.
71 $mainLangID = empty($_SESSION['language_choice']) ?
'1' : $_SESSION['language_choice'];
72 if ($mainLangID == '1' && !empty($GLOBALS['skip_english_translation']))
74 $sql = "SELECT * FROM lang_languages ORDER BY lang_description, lang_id";
75 $res3=SqlStatement($sql);
78 // Use and sort by the translated language name.
79 $sql = "SELECT ll.lang_id, " .
80 "IF(LENGTH(ld.definition),ld.definition,ll.lang_description) AS trans_lang_description, " .
81 "ll.lang_description " .
82 "FROM lang_languages AS ll " .
83 "LEFT JOIN lang_constants AS lc ON lc.constant_name = ll.lang_description " .
84 "LEFT JOIN lang_definitions AS ld ON ld.cons_id = lc.cons_id AND " .
85 "ld.lang_id = '$mainLangID' " .
86 "ORDER BY IF(LENGTH(ld.definition),ld.definition,ll.lang_description), ll.lang_id";
87 $res3=SqlStatement($sql);
90 for ($iter = 0;$row = sqlFetchArray($res3);$iter++
)
91 $result3[$iter] = $row;
92 if (count($result3) == 1) {
93 //default to english if only return one language
94 echo "<input type='hidden' name='languageChoice' value='1' />\n";
98 echo "<input type='hidden' name='languageChoice' value='".$defaultLanguage."' />\n";
102 <table width
=100% height
="90%">
104 <td valign
=middle width
=33%
>
105 <?php
echo $logocode;?
>
107 <td align
='center' valign
='middle' width
=34%
>
109 <?php
if (count($result) != 1) { ?
>
111 <td
><span
class="text"><?php
xl('Group:','e'); ?
></span
></td
>
113 <select name
=authProvider
>
115 foreach ($result as $iter) {
116 echo "<option value='".$iter{"name"}."'>".$iter{"name"}."</option>\n";
123 <?php
if ($_SESSION['loginfailure'] == 1): ?
>
124 <tr
><td colspan
='2' class='text' style
='color:red'>
125 Invalid username
or password
130 <td
><span
class="text"><?php
xl('Username:','e'); ?
></span
></td
>
132 <input type
="text" size
="10" name
="authUser">
134 <td
><span
class="text"><?php
xl('Password:','e'); ?
></span
></td
>
136 <input type
="password" size
="10" name
="clearPass">
140 if ($GLOBALS['language_menu_login']) {
141 if (count($result3) != 1) { ?
>
143 <td
><span
class="text"><?php
xl('Language','e'); ?
>:</span
></td
>
145 <select name
=languageChoice size
="1">
147 echo "<option selected='selected' value='".$defaultLangID."'>" . xl('Default','','',' -') . xl($defaultLangName,'',' ') . "</option>\n";
148 foreach ($result3 as $iter) {
149 if ($GLOBALS['language_menu_showall']) {
150 echo "<option value='".$iter[lang_id
]."'>".$iter[trans_lang_description
]."</option>\n";
153 if (in_array($iter[lang_description
], $GLOBALS['language_menu_show'])) {
154 echo "<option value='".$iter[lang_id
]."'>" . $iter[trans_lang_description
] . "</option>\n";
163 <tr
><td
> 
;</td
><td
>
164 <input type
="hidden" name
="authPass">
165 <?php
if ($GLOBALS['use_adldap_auth'] == true): ?
>
166 <input type
="submit" onClick
="javascript:this.form.authPass.value=MD5(this.form.clearPass.value);" value
=<?php
xl('Login','e');?
>>
168 <input type
="submit" onClick
="javascript:this.form.authPass.value=MD5(this.form.clearPass.value);this.form.clearPass.value='';" value
=<?php
xl('Login','e');?
>>
171 <tr
><td colspan
='2' class='text' style
='color:red'>
173 $ip=$_SERVER['REMOTE_ADDR'];
175 // The following commented out because it is too slow when the log
176 // table is large. -- Rod 2009-11-11
177 /*********************************************************************
178 $query = "select user, date, comments from log where event like 'login' and comments like '%".$ip."' order by date desc limit 1";
179 $statement = sqlStatement($query);
180 if ($result = sqlFetchArray($statement)) {
181 if (strpos($result['comments'],"ailure")) {
182 echo $result['user']." attempted unauthorized login on this machine: ".$result['date'];
185 *********************************************************************/
193 <!-- Uncomment this
for the OpenEMR demo installation
194 <p
><center
>login
= admin
206 <a href
="../../copyright_notice.html" target
="main"><?php
xl('Copyright Notice','e'); ?
></a
><br
/>