3 include_once("../globals.php");
4 include_once("$srcdir/md5.js");
5 include_once("$srcdir/sql.inc");
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();
28 <body
<?php
echo $login_body_line;?
> onload
="javascript:document.login_form.authUser.focus();" >
30 <span
class="text"></span
>
34 <form method
="POST" action
="../main/main_screen.php?auth=login" target
="_top"
35 name
="login_form" onsubmit
="return imsubmitted();">
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"};
55 //default to english if any problems
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);
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";
92 echo "<input type='hidden' name='languageChoice' value='".$defaultLanguage."' />\n";
96 <table width
=100% height
="90%">
98 <td valign
=middle width
=33%
>
99 <?php
echo $logocode;?
>
101 <td align
='center' valign
='middle' width
=34%
>
103 <?php
if (count($result) != 1) { ?
>
105 <td
><span
class="text"><?php
xl('Group:','e'); ?
></span
></td
>
107 <select name
=authProvider
>
109 foreach ($result as $iter) {
110 echo "<option value='".$iter{"name"}."'>".$iter{"name"}."</option>\n";
117 <?php
if ($_SESSION['loginfailure'] == 1): ?
>
118 <tr
><td colspan
='2' class='text' style
='color:red'>
119 Invalid username
or password
124 <td
><span
class="text"><?php
xl('Username:','e'); ?
></span
></td
>
126 <input type
="text" size
="10" name
="authUser">
128 <td
><span
class="text"><?php
xl('Password:','e'); ?
></span
></td
>
130 <input type
="password" size
="10" name
="clearPass">
134 if ($GLOBALS['language_menu_login']) {
135 if (count($result3) != 1) { ?
>
137 <td
><span
class="text"><?php
xl('Language','e'); ?
>:</span
></td
>
139 <select name
=languageChoice size
="1">
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";
147 if (in_array($iter[lang_description
], $GLOBALS['language_menu_show'])) {
148 echo "<option value='".$iter[lang_id
]."'>" . $iter[trans_lang_description
] . "</option>\n";
157 <tr
><td
> 
;</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');?
>>
162 <input type
="submit" onClick
="javascript:this.form.authPass.value=MD5(this.form.clearPass.value);this.form.clearPass.value='';" value
=<?php
xl('Login','e');?
>>
165 <tr
><td colspan
='2' class='text' style
='color:red'>
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 *********************************************************************/
187 <!-- Uncomment this
for the OpenEMR demo installation
188 <p
><center
>login
= admin
200 <a href
="copyright_notice.html" target
="main"><?php
xl('Copyright Notice','e'); ?
></a
><br
/>