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 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
|
<?php
/*
FibuSQL 0.4.1 - (c) 2003 Martin Pitt <martin@piware.de>
This software is protected by the GNU General Public License (see
file COPYING).
*/
static $supporteddbs = array (
'dbase' => 'dBASE',
'fbsql' => 'FrontBase',
'ibase' => 'Interbase',
'ifx' => 'Informix',
'msql' => 'MiniSQL',
'mssql' => 'Microsoft SQL Server',
'mysql' => 'mySQL',
'oci8' => 'Oracle 7/8/8i',
'odbc' => 'ODBC',
'pgsql' => 'PostgreSQL',
'sybase'=> 'Sybase'
);
function checklanguage( $l )
{
if( preg_match( '/[a-z]{2,5}/i', $l ) && is_readable( "lang/$l.php" ) )
return $l;
else
return '';
}
session_start();
$HTTP_SESSION_VARS['lang'] = null;
# read configuration file
$mypath = pathinfo( $HTTP_SERVER_VARS['SCRIPT_FILENAME'] );
$cfgfile = $mypath['dirname'] . '/fibusql.conf';
if( is_readable( $cfgfile ) ) {
$cfg = parse_ini_file( $cfgfile, TRUE );
# interface section
$HTTP_SESSION_VARS['lang'] = checklanguage( $cfg['interface']['language'] );
if( $cfg['interface']['decimalsep'] == '.' || $cfg['interface']['decimalsep'] == ',' )
$HTTP_SESSION_VARS['decimalsep'] = $cfg['interface']['decimalsep'];
if( $cfg['interface']['thousandsep'] == '.' || $cfg['interface']['thousandsep'] == ',' ||
$cfg['interface']['thousandsep'] == "'" )
$HTTP_SESSION_VARS['thousandsep'] = $cfg['interface']['thousandsep'];
# login section; use only if complete
if( $cfg['login']['dbtype'] && $cfg['login']['dbname'] &&
$cfg['login']['user'] && $cfg['login']['host'] &&
( $cfg['login']['password'] || !$cfg['login']['usepwd'] ) ) {
$pwd = $cfg['login']['usepwd'] ? ':' . rawurlencode( $cfg['login']['password'] ) : '';
$HTTP_SESSION_VARS['dbspec'] = $cfg['login']['dbtype'] .'://' . $cfg['login']['user'] .
$pwd . '@'.$cfg['login']['host'].'/'.$cfg['login']['dbname'];
# directly go to start page, no login form necessary
header( 'Location: about.php' );
exit;
}
}
# Formular based login
if( $HTTP_GET_VARS['host'] && $HTTP_GET_VARS['dbname'] &&
$HTTP_GET_VARS['type'] && $HTTP_GET_VARS['user'] &&
!$HTTP_GET_VARS['setonly'] ) {
if( $HTTP_GET_VARS['password'] )
$pwd = ':' . rawurlencode( $HTTP_GET_VARS['password'] );
else
$pwd = '';
$HTTP_SESSION_VARS['dbspec'] =
( $HTTP_GET_VARS['type'] . '://' . $HTTP_GET_VARS['user'] . $pwd
. '@' . $HTTP_GET_VARS['host'] . '/' . $HTTP_GET_VARS['dbname'] );
$HTTP_SESSION_VARS['lang'] = checklanguage( $HTTP_GET_VARS['lang'] );
if( $HTTP_GET_VARS['decimalsep'] == '.' || $HTTP_GET_VARS['decimalsep'] == ',' )
$HTTP_SESSION_VARS['decimalsep'] = $HTTP_GET_VARS['decimalsep'];
if( $HTTP_GET_VARS['thousandsep'] == 'apos' )
$HTTP_SESSION_VARS['thousandsep'] = "'";
else if( $HTTP_GET_VARS['thousandsep'] == '.' || $HTTP_GET_VARS['thousandsep'] == ',' )
$HTTP_SESSION_VARS['thousandsep'] = $HTTP_GET_VARS['thousandsep'];
header( 'Location: about.php' );
exit;
}
include_once 'langinc.inc';
include get_lang_inc( '-login' );
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<title>FibuSQL</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="author" content="Martin Pitt (piware@piware.de)" />
<link rel="stylesheet" href="fibu.css" />
</head>
<body>
<h2><?php echo $LANG_logintitle ?></h2>
<form action="<?php echo $HTTP_SERVER_VARS['PHP_SELF'] ?>" method="get">
<table>
<tr><th><?php echo $LANG_host ?>:</th><td>
<?php if( $HTTP_GET_VARS['host'] ) { ?>
<input type="hidden" name="host" value="<?php echo $HTTP_GET_VARS['host'] ?>" />
<span class="fixed"><?php echo $HTTP_GET_VARS['host'] ?></span>
<?php } else { ?>
<input type="text" size="30" name="host" />
<?php } ?> </td></tr>
<tr><th><?php echo $LANG_dbname ?>:</th><td>
<?php if( $HTTP_GET_VARS['dbname'] ) { ?>
<input type="hidden" name="dbname" value="<?php echo $HTTP_GET_VARS['dbname'] ?>" />
<span class="fixed"><?php echo $HTTP_GET_VARS['dbname'] ?></span>
<?php } else { ?>
<input type="text" size="30" name="dbname" />
<?php } ?> </td></tr>
<tr><th><?php echo $LANG_dbtype ?>:</th><td>
<?php if( array_key_exists( $HTTP_GET_VARS['type'], $supporteddbs ) ) { ?>
<input type="hidden" name="type" value="<?php echo $HTTP_GET_VARS['type'] ?>" />
<span class="fixed"><?php echo $HTTP_GET_VARS['type'] ?></span>
<?php
} else {
echo "<select name=\"type\">\n";
foreach( $supporteddbs as $k => $v ) {
echo "<option value=\"$k\"";
if( $HTTP_GET_VARS['type'] == $k) echo ' selected="selected"';
echo ">$v</option>\n";
}
echo "</select>\n";
}
?>
</td></tr>
<tr><th><?php echo $LANG_user ?>:</th><td>
<?php if( $HTTP_GET_VARS['user'] ) { ?>
<input type="hidden" name="user" value="<?php echo $HTTP_GET_VARS['user'] ?>" />
<span class="fixed"><?php echo $HTTP_GET_VARS['user'] ?></span>
<?php } else { ?>
<input type="text" size="30" name="user" />
<?php } ?> </td></tr>
<tr><th><?php echo $LANG_passwd ?>:</th><td>
<?php if( $HTTP_GET_VARS['password'] ) { ?>
<input type="hidden" name="password" value="<?php echo $HTTP_GET_VARS['password'] ?>" />
<?php echo $LANG_pwdset ?>
<?php } else { ?>
<input type="password" size="30" name="password" />
<?php } ?>
</td></tr>
<tr><td> </td></tr>
<tr><th><?php echo $LANG_language ?>:</th><td>
<select name="lang">
<option value="0"
<?php if( !$HTTP_GET_VARS['lang'] ) echo 'selected="selected"'; ?>
><?php echo $LANG_langbrowser ?></option>
<option value="de"
<?php if( $HTTP_GET_VARS['lang'] == 'de') echo 'selected="selected"'; ?>
>Deutsch</option>
<option value="en"
<?php if( $HTTP_GET_VARS['lang'] == 'en') echo 'selected="selected"'; ?>
>English</option>
</select>
</td></tr>
<tr><th><?php echo $LANG_decimalpoint ?>:</th><td>
<input type="radio" name="decimalsep" value=","
<?php if( $HTTP_GET_VARS['decimalsep'] == ',' ) echo 'checked="checked"' ?> />1,23
<input type="radio" name="decimalsep" value="."
<?php if( $HTTP_GET_VARS['decimalsep'] == '.' ) echo 'checked="checked"' ?> />1.23
</td></tr>
<tr><th><?php echo $LANG_thousandsep ?>:</th><td>
<input type="radio" name="thousandsep" value="apos"
<?php if( $HTTP_GET_VARS['thousandsep'] == "apos" ) echo 'checked="checked"' ?> />1'000
<input type="radio" name="thousandsep" value="."
<?php if( $HTTP_GET_VARS['thousandsep'] == '.' ) echo 'checked="checked"' ?> />1.000
<input type="radio" name="thousandsep" value=","
<?php if( $HTTP_GET_VARS['thousandsep'] == ',' ) echo 'checked="checked"' ?> />1,000
<input type="radio" name="thousandsep" value="no"
<?php if( $HTTP_GET_VARS['thousandsep'] == 'no' ) echo 'checked="checked"' ?> />1000
</td></tr>
<tr><td> </td></tr>
<tr><td><input type="submit" name="login" value=" <?php echo $LANG_login ?> " /></td>
<td>(<?php echo $LANG_proceedtostart ?>)</td></tr>
<tr><td><input type="submit" name="setonly" value="<?php echo $LANG_takeover ?>"/></td>
<td>(<?php echo $LANG_takeovernote ?>)</td></tr>
</table>
</form>
<p><?php echo $LANG_docrefer ?></p>
</body>
</html>
|