Patient Summary Screen Modifications:
[openemr.git] / interface / login / login.php
blobf672a6a7d98c8218f54fe916cc016d3218fa6363
1 <?php
2 $ignoreAuth=true;
3 include_once("../globals.php");
4 include_once("$srcdir/md5.js");
5 include_once("$srcdir/sql.inc");
6 ?>
7 <html>
8 <head>
9 <?php html_header_show(); ?>
10 <link rel=stylesheet href="<?php echo $css_header;?>" type="text/css">
12 <script language='JavaScript'>
14 function imsubmitted() {
15 <?php if (!empty($GLOBALS['restore_sessions'])) { ?>
16 // Delete the session cookie by setting its expiration date in the past.
17 // This forces the server to create a new session ID.
18 var olddate = new Date();
19 olddate.setFullYear(olddate.getFullYear() - 1);
20 document.cookie = '<?php echo session_name() . '=' . session_id() ?>; path=/; expires=' + olddate.toGMTString();
21 <?php } ?>
22 return true;
25 </script>
27 </head>
28 <body <?php echo $login_body_line;?> onload="javascript:document.login_form.authUser.focus();" >
30 <span class="text"></span>
32 <center>
34 <form method="POST" action="../main/main_screen.php?auth=login" target="_top"
35 name="login_form" onsubmit="return imsubmitted();">
37 <?php
38 // collect groups
39 $res = sqlStatement("select distinct name from groups");
40 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
41 $result[$iter] = $row;
42 if (count($result) == 1) {
43 $resvalue = $result[0]{"name"};
44 echo "<input type='hidden' name='authProvider' value='$resvalue' />\n";
46 // collect default language id
47 $res2 = sqlStatement("select * from lang_languages where lang_description = '".$GLOBALS['language_default']."'");
48 for ($iter = 0;$row = sqlFetchArray($res2);$iter++)
49 $result2[$iter] = $row;
50 if (count($result2) == 1) {
51 $defaultLangID = $result2[0]{"lang_id"};
52 $defaultLangName = $result2[0]{"lang_description"};
54 else {
55 //default to english if any problems
56 $defaultLangID = 1;
57 $defaultLangName = "English";
59 // set session variable to default so login information appears in default language
60 $_SESSION['language_choice'] = $defaultLangID;
61 // collect languages if showing language menu
62 if ($GLOBALS['language_menu_login']) {
64 // sorting order of language titles depends on language translation options.
65 $mainLangID = empty($_SESSION['language_choice']) ? '1' : $_SESSION['language_choice'];
66 if ($mainLangID == '1' && !empty($GLOBALS['skip_english_translation']))
68 $sql = "SELECT * FROM lang_languages ORDER BY lang_description, lang_id";
69 $res3=SqlStatement($sql);
71 else {
72 // Use and sort by the translated language name.
73 $sql = "SELECT ll.lang_id, " .
74 "IF(LENGTH(ld.definition),ld.definition,ll.lang_description) AS trans_lang_description, " .
75 "ll.lang_description " .
76 "FROM lang_languages AS ll " .
77 "LEFT JOIN lang_constants AS lc ON lc.constant_name = ll.lang_description " .
78 "LEFT JOIN lang_definitions AS ld ON ld.cons_id = lc.cons_id AND " .
79 "ld.lang_id = '$mainLangID' " .
80 "ORDER BY IF(LENGTH(ld.definition),ld.definition,ll.lang_description), ll.lang_id";
81 $res3=SqlStatement($sql);
84 for ($iter = 0;$row = sqlFetchArray($res3);$iter++)
85 $result3[$iter] = $row;
86 if (count($result3) == 1) {
87 //default to english if only return one language
88 echo "<input type='hidden' name='languageChoice' value='1' />\n";
91 else {
92 echo "<input type='hidden' name='languageChoice' value='".$defaultLanguage."' />\n";
96 <table width=100% height="90%">
97 <tr>
98 <td valign=middle width=33%>
99 <?php echo $logocode;?>
100 </td>
101 <td align='center' valign='middle' width=34%>
102 <table>
103 <?php if (count($result) != 1) { ?>
104 <tr>
105 <td><span class="text"><?php xl('Group:','e'); ?></span></td>
106 <td>
107 <select name=authProvider>
108 <?php
109 foreach ($result as $iter) {
110 echo "<option value='".$iter{"name"}."'>".$iter{"name"}."</option>\n";
113 </select>
114 </td></tr>
115 <?php } ?>
117 <?php if ($_SESSION['loginfailure'] == 1): ?>
118 <tr><td colspan='2' class='text' style='color:red'>
119 Invalid username or password
120 </td></tr>
121 <?php endif; ?>
123 <tr>
124 <td><span class="text"><?php xl('Username:','e'); ?></span></td>
125 <td>
126 <input type="text" size="10" name="authUser">
127 </td></tr><tr>
128 <td><span class="text"><?php xl('Password:','e'); ?></span></td>
129 <td>
130 <input type="password" size="10" name="clearPass">
131 </td></tr>
133 <?php
134 if ($GLOBALS['language_menu_login']) {
135 if (count($result3) != 1) { ?>
136 <tr>
137 <td><span class="text"><?php xl('Language','e'); ?>:</span></td>
138 <td>
139 <select name=languageChoice size="1">
140 <?php
141 echo "<option selected='selected' value='".$defaultLangID."'>" . xl('Default','','',' -') . xl($defaultLangName,'',' ') . "</option>\n";
142 foreach ($result3 as $iter) {
143 if ($GLOBALS['language_menu_showall']) {
144 echo "<option value='".$iter[lang_id]."'>".$iter[trans_lang_description]."</option>\n";
146 else {
147 if (in_array($iter[lang_description], $GLOBALS['language_menu_show'])) {
148 echo "<option value='".$iter[lang_id]."'>" . $iter[trans_lang_description] . "</option>\n";
153 </select>
154 </td></tr>
155 <?php }} ?>
157 <tr><td>&nbsp;</td><td>
158 <input type="hidden" name="authPass">
159 <?php if ($GLOBALS['use_adldap_auth'] == true): ?>
160 <input type="submit" onClick="javascript:this.form.authPass.value=MD5(this.form.clearPass.value);" value=<?php xl('Login','e');?>>
161 <?php else: ?>
162 <input type="submit" onClick="javascript:this.form.authPass.value=MD5(this.form.clearPass.value);this.form.clearPass.value='';" value=<?php xl('Login','e');?>>
163 <?php endif; ?>
164 </td></tr>
165 <tr><td colspan='2' class='text' style='color:red'>
166 <?php
167 $ip=$_SERVER['REMOTE_ADDR'];
169 // The following commented out because it is too slow when the log
170 // table is large. -- Rod 2009-11-11
171 /*********************************************************************
172 $query = "select user, date, comments from log where event like 'login' and comments like '%".$ip."' order by date desc limit 1";
173 $statement = sqlStatement($query);
174 if ($result = sqlFetchArray($statement)) {
175 if (strpos($result['comments'],"ailure")) {
176 echo $result['user']." attempted unauthorized login on this machine: ".$result['date'];
179 *********************************************************************/
182 </td></tr>
183 </table>
184 </td>
185 <td width=33%>
187 <!-- Uncomment this for the OpenEMR demo installation
188 <p><center>login = admin
189 <br>password = pass
192 </center></p>
194 </td>
195 </table>
197 </form>
199 <address>
200 <a href="copyright_notice.html" target="main"><?php xl('Copyright Notice','e'); ?></a><br />
201 </address>
203 </center>
204 </body>
205 </html>