Created the About page, take 2.
[openemr.git] / interface / login / login.php
blobe3ca609647bc485ff29226347dc2ce0847223c58
1 <?php
2 /**
3 * Login screen.
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>;.
16 * @package OpenEMR
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>
23 * @author cfapress
24 * @author markleeds
25 * @link http://www.open-emr.org
28 $fake_register_globals=false;
29 $sanitize_all_escapes=true;
31 $ignoreAuth=true;
32 include_once("../globals.php");
33 include_once("$srcdir/sql.inc");
35 <html>
36 <head>
37 <?php html_header_show();?>
38 <link rel=stylesheet href="<?php echo $css_header;?>" type="text/css">
39 <link rel=stylesheet href="../themes/login.css" type="text/css">
41 <script language='JavaScript' src="../../library/js/jquery-1.4.3.min.js"></script>
42 <script language='JavaScript'>
43 function transmit_form()
45 document.forms[0].submit();
47 function imsubmitted() {
48 <?php if (!empty($GLOBALS['restore_sessions'])) { ?>
49 // Delete the session cookie by setting its expiration date in the past.
50 // This forces the server to create a new session ID.
51 var olddate = new Date();
52 olddate.setFullYear(olddate.getFullYear() - 1);
53 document.cookie = '<?php echo session_name() . '=' . session_id() ?>; path=/; expires=' + olddate.toGMTString();
54 <?php } ?>
55 return false; //Currently the submit action is handled by the encrypt_form().
57 </script>
59 </head>
60 <body onload="javascript:document.login_form.authUser.focus();" >
61 <span class="text"></span>
62 <center>
64 <form method="POST"
65 action="../main/main_screen.php?auth=login&site=<?php echo attr($_SESSION['site_id']); ?>"
66 target="_top" name="login_form" onsubmit="return imsubmitted();">
68 <input type='hidden' name='new_login_session_management' value='1' />
70 <?php
71 // collect groups
72 $res = sqlStatement("select distinct name from groups");
73 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
74 $result[$iter] = $row;
75 if (count($result) == 1) {
76 $resvalue = $result[0]{"name"};
77 echo "<input type='hidden' name='authProvider' value='" . attr($resvalue) . "' />\n";
79 // collect default language id
80 $res2 = sqlStatement("select * from lang_languages where lang_description = ?",array($GLOBALS['language_default']));
81 for ($iter = 0;$row = sqlFetchArray($res2);$iter++)
82 $result2[$iter] = $row;
83 if (count($result2) == 1) {
84 $defaultLangID = $result2[0]{"lang_id"};
85 $defaultLangName = $result2[0]{"lang_description"};
87 else {
88 //default to english if any problems
89 $defaultLangID = 1;
90 $defaultLangName = "English";
92 // set session variable to default so login information appears in default language
93 $_SESSION['language_choice'] = $defaultLangID;
94 // collect languages if showing language menu
95 if ($GLOBALS['language_menu_login']) {
97 // sorting order of language titles depends on language translation options.
98 $mainLangID = empty($_SESSION['language_choice']) ? '1' : $_SESSION['language_choice'];
99 if ($mainLangID == '1' && !empty($GLOBALS['skip_english_translation']))
101 $sql = "SELECT *,lang_description as trans_lang_description FROM lang_languages ORDER BY lang_description, lang_id";
102 $res3=SqlStatement($sql);
104 else {
105 // Use and sort by the translated language name.
106 $sql = "SELECT ll.lang_id, " .
107 "IF(LENGTH(ld.definition),ld.definition,ll.lang_description) AS trans_lang_description, " .
108 "ll.lang_description " .
109 "FROM lang_languages AS ll " .
110 "LEFT JOIN lang_constants AS lc ON lc.constant_name = ll.lang_description " .
111 "LEFT JOIN lang_definitions AS ld ON ld.cons_id = lc.cons_id AND " .
112 "ld.lang_id = ? " .
113 "ORDER BY IF(LENGTH(ld.definition),ld.definition,ll.lang_description), ll.lang_id";
114 $res3=SqlStatement($sql, array($mainLangID));
117 for ($iter = 0;$row = sqlFetchArray($res3);$iter++)
118 $result3[$iter] = $row;
119 if (count($result3) == 1) {
120 //default to english if only return one language
121 echo "<input type='hidden' name='languageChoice' value='1' />\n";
124 else {
125 echo "<input type='hidden' name='languageChoice' value='".attr($defaultLangID)."' />\n";
129 <table width="100%" height="90%">
130 <td align='center' valign='middle' width='34%'>
131 <div class="login-box">
132 <div class="logo-left"><?php echo $logocode;?></div>
134 <div class="table-right">
135 <table width="100%">
136 <?php if (count($result) != 1) { ?>
137 <tr>
138 <td><span class="text"><?php echo xlt('Group:'); ?></span></td>
139 <td>
140 <select name=authProvider>
141 <?php
142 foreach ($result as $iter) {
143 echo "<option value='".attr($iter{"name"})."'>".text($iter{"name"})."</option>\n";
146 </select>
147 </td></tr>
148 <?php } ?>
150 <?php if (isset($_SESSION['loginfailure']) && ($_SESSION['loginfailure'] == 1)): ?>
151 <tr><td colspan='2' class='text' style='color:red'>
152 <?php echo xlt('Invalid username or password'); ?>
153 </td></tr>
154 <?php endif; ?>
156 <?php if (isset($_SESSION['relogin']) && ($_SESSION['relogin'] == 1)): ?>
157 <tr><td colspan='2' class='text' style='color:red;background-color:#dfdfdf;border:solid 1px #bfbfbf;text-align:center'>
158 <b><?php echo xlt('Password security has recently been upgraded.'); ?><br>
159 <?php echo xlt('Please login again.'); ?></b>
160 <?php unset($_SESSION['relogin']); ?>
161 </td></tr>
162 <?php endif; ?>
164 <tr>
165 <td><span class="text"><?php echo xlt('Username:'); ?></span></td>
166 <td>
167 <input class="entryfield" type="text" size="10" name="authUser">
168 </td></tr><tr>
169 <td><span class="text"><?php echo xlt('Password:'); ?></span></td>
170 <td>
171 <input class="entryfield" type="password" size="10" name="clearPass">
172 </td></tr>
174 <?php
175 if ($GLOBALS['language_menu_login']) {
176 if (count($result3) != 1) { ?>
177 <tr>
178 <td><span class="text"><?php echo xlt('Language'); ?>:</span></td>
179 <td>
180 <select class="entryfield" name=languageChoice size="1">
181 <?php
182 echo "<option selected='selected' value='" . attr($defaultLangID) . "'>" . xlt('Default') . " - " . xlt($defaultLangName) . "</option>\n";
183 foreach ($result3 as $iter) {
184 if ($GLOBALS['language_menu_showall']) {
185 if ( !$GLOBALS['allow_debug_language'] && $iter[lang_description] == 'dummy') continue; // skip the dummy language
186 echo "<option value='".attr($iter['lang_id'])."'>".text($iter['trans_lang_description'])."</option>\n";
188 else {
189 if (in_array($iter[lang_description], $GLOBALS['language_menu_show'])) {
190 if ( !$GLOBALS['allow_debug_language'] && $iter['lang_description'] == 'dummy') continue; // skip the dummy language
191 echo "<option value='".attr($iter['lang_id'])."'>" . text($iter['trans_lang_description']) . "</option>\n";
196 </select>
197 </td></tr>
198 <?php }} ?>
200 <tr><td>&nbsp;</td><td>
201 <input class="button large" type="submit" onClick="transmit_form()" value="<?php echo xla('Login');?>">
202 </td></tr>
203 <tr><td colspan='2' class='text' style='color:red'>
204 <?php
205 $ip=$_SERVER['REMOTE_ADDR'];
207 </div>
208 </td></tr>
209 </table>
211 </div>
212 <div style="clear: both;"> </div>
213 <div class="version">
214 <a href="../../acknowledge_license_cert.html" target="main"><?php echo xlt('Acknowledgments, Licensing and Certification'); ?></a>
215 </div>
216 </div>
217 <div class="demo">
218 <!-- Uncomment this for the OpenEMR demo installation
219 <p><center>login = admin
220 <br>password = pass
222 </div>
223 </td>
224 </tr>
225 </table>
226 </form>
227 </center>
228 </body>
229 </html>