forked from xzilla/phppgadmin
-
Notifications
You must be signed in to change notification settings - Fork 280
/
login.php
executable file
·101 lines (94 loc) · 3.14 KB
/
login.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
/**
* Login screen
*
* $Id: login.php,v 1.12 2003/09/09 06:23:12 chriskl Exp $
*/
// This needs to be an include once to prevent lib.inc.php infinite recursive includes.
// Check to see if the configuration file exists, if not, explain
include_once('libraries/lib.inc.php');
// Unfortunately, since sometimes lib.inc.php has been included, but we still
// need the config variables
if (file_exists('conf/config.inc.php')) {
require('conf/config.inc.php');
}
else {
echo "Configuration Error: You must rename/copy config.inc.php-dist to config.inc.php and set your appropriate settings";
exit;
}
// Prepare form variables
if (!isset($_POST['formServer'])) $_POST['formServer'] = '';
if (!isset($_POST['formLanguage'])) $_POST['formLanguage'] = $conf['default_lang'];
// Force encoding to UTF-8
$lang['appcharset'] = 'UTF-8';
// Output header
$misc->printHeader($lang['strlogin']);
$misc->printBody();
?>
<table class="navbar" border="0" cellpadding="0" cellspacing="0" width="100%" height="100%">
<tr height="115">
<td height="115" align="center" valign="middle">
<center>
<h1><?php echo $appName ?> <?php echo $appVersion ?> <?php echo $lang['strlogin'] ?></h1>
<?php if (isset($_failed) && $_failed) echo "<p class=\"message\">{$lang['strloginfailed']}</p>" ?>
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post" name="login_form">
<table class="navbar" border="0" cellpadding="5" cellspacing="3">
<tr>
<td><?php echo $lang['strusername'] ?>:</td>
<td><input type="text" name="formUsername" value="<?php echo (isset($_POST['formUsername'])) ? htmlspecialchars($_POST['formUsername']) : '' ?>" size="24" /></td>
</tr>
<tr>
<td><?php echo $lang['strpassword'] ?>:</td>
<td><input type="password" name="formPassword" size="24" /></td>
</tr>
<tr>
<td><?php echo $lang['strserver'] ?>:</td>
<td><select name="formServer">
<?php
for ($i = 0; $i < sizeof($conf['servers']); $i++) {
echo "<option value=\"{$i}\"",
($i == $_POST['formServer']) ? ' selected="selected"' : '',
">", htmlspecialchars($conf['servers'][$i]['desc']), "</option>\n";
}
?>
</select></td>
</tr>
<tr>
<td><?php echo $lang['strlanguage'] ?>:</td>
<td><select name="formLanguage">
<?php
// Language name already encoded
foreach ($appLangFiles as $k => $v) {
echo "<option value=\"{$k}\"",
($k == $_POST['formLanguage']) ? ' selected="selected"' : '',
">{$v}</option>\n";
}
?>
</select></td>
</tr>
<tr>
<td colspan="2" align="right" valign="middle">
<input type="submit" name="submitLogin" value="<?php echo $lang['strlogin'] ?>" />
</td>
</tr>
</table>
</form>
</center>
<script language="javascript">
<!--
var uname = document.login_form.formUsername;
var pword = document.login_form.formPassword;
if (uname.value == "") {
uname.focus();
} else {
pword.focus();
}
-->
</script>
</td>
</tr>
</table>
<?php
// Output footer
$misc->printFooter();
?>