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']) {
63 $res3 = sqlStatement("select * from lang_languages order by lang_description");
64 for ($iter = 0;$row = sqlFetchArray($res3);$iter++
)
65 $result3[$iter] = $row;
66 if (count($result3) == 1) {
67 //default to english if only return one language
68 echo "<input type='hidden' name='languageChoice' value='1' />\n";
72 echo "<input type='hidden' name='languageChoice' value='".$defaultLanguage."' />\n";
76 <table width
=100% height
="90%">
78 <td valign
=middle width
=33%
>
79 <?php
echo $logocode;?
>
81 <td align
='center' valign
='middle' width
=34%
>
83 <?php
if (count($result) != 1) { ?
>
85 <td
><span
class="text"><?php
xl('Group:','e'); ?
></span
></td
>
87 <select name
=authProvider
>
89 foreach ($result as $iter) {
90 echo "<option value='".$iter{"name"}."'>".$iter{"name"}."</option>\n";
97 <?php
if ($_SESSION['loginfailure'] == 1): ?
>
98 <tr
><td colspan
='2' class='text' style
='color:red'>
99 Invalid username
or password
104 <td
><span
class="text"><?php
xl('Username:','e'); ?
></span
></td
>
106 <input type
="text" size
="10" name
="authUser">
108 <td
><span
class="text"><?php
xl('Password:','e'); ?
></span
></td
>
110 <input type
="password" size
="10" name
="clearPass">
114 if ($GLOBALS['language_menu_login']) {
115 if (count($result3) != 1) { ?
>
117 <td
><span
class="text"><?php
xl('Language:','e'); ?
></span
></td
>
119 <select name
=languageChoice size
="1">
121 echo "<option selected='selected' value='".$defaultLangID."'>" . xl('Default','','',' -') . xl($defaultLangName,'',' ') . "</option>\n";
122 foreach ($result3 as $iter) {
123 if ($GLOBALS['language_menu_showall']) {
124 echo "<option value='".$iter[lang_id
]."'>".xl($iter[lang_description
])."</option>\n";
127 if (in_array($iter[lang_description
], $GLOBALS['language_menu_show'])) {
128 echo "<option value='".$iter[lang_id
]."'>" . xl($iter[lang_description
]) . "</option>\n";
137 <tr
><td
> 
;</td
><td
>
138 <input type
="hidden" name
="authPass">
139 <?php
if ($GLOBALS['use_adldap_auth'] == true): ?
>
140 <input type
="submit" onClick
="javascript:this.form.authPass.value=MD5(this.form.clearPass.value);" value
=<?php
xl('Login','e');?
>>
142 <input type
="submit" onClick
="javascript:this.form.authPass.value=MD5(this.form.clearPass.value);this.form.clearPass.value='';" value
=<?php
xl('Login','e');?
>>
145 <tr
><td colspan
='2' class='text' style
='color:red'>
147 $ip=$_SERVER['REMOTE_ADDR'];
149 // The following commented out because it is too slow when the log
150 // table is large. -- Rod 2009-11-11
151 /*********************************************************************
152 $query = "select user, date, comments from log where event like 'login' and comments like '%".$ip."' order by date desc limit 1";
153 $statement = sqlStatement($query);
154 if ($result = sqlFetchArray($statement)) {
155 if (strpos($result['comments'],"ailure")) {
156 echo $result['user']." attempted unauthorized login on this machine: ".$result['date'];
159 *********************************************************************/
167 <!-- Uncomment this
for the OpenEMR demo installation
168 <p
><center
>login
= admin
180 <a href
="copyright_notice.html" target
="main"><?php
xl('Copyright Notice','e'); ?
></a
><br
/>