You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
206 lines
7.2 KiB
206 lines
7.2 KiB
2 months ago
|
<?php
|
||
|
/**
|
||
|
* Copyright 2001 - 2003 by Gero Kohnert
|
||
|
*
|
||
|
* CVS Info: $Id: login.pinc,v 1.12 2005/01/17 05:11:26 saraj Exp $
|
||
|
* $Author: saraj $
|
||
|
*
|
||
|
* @modulegroup ADMIN
|
||
|
* @module admin_login
|
||
|
* @package BASE
|
||
|
*/
|
||
|
|
||
|
loadlayout();
|
||
|
|
||
|
class login extends layout {
|
||
|
/**
|
||
|
*
|
||
|
*/
|
||
|
function info() {
|
||
|
global $msg,$lang,$tutos,$table;
|
||
|
|
||
|
unset ($_GET['msg']);
|
||
|
if ( count($_GET) ) {
|
||
|
foreach ($_GET as $i => $f) {
|
||
|
if ( ($i != "uname") && ($i != "pw") && ($i != "db") && ($i != "login") && ($i != "TUTOS") ) {
|
||
|
# $this->addHidden($i,$f);
|
||
|
if (!is_array($f)) {
|
||
|
$this->gotourl= addUrlParameter($this->gotourl,$i."=".UrlEncode($f));
|
||
|
} else {
|
||
|
foreach ($f as $i2 => $f2) {
|
||
|
$this->gotourl = addUrlParameter($this->gotourl,$i."[]=".UrlEncode($f2));
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if ( count($_POST) ) {
|
||
|
foreach ($_POST as $i => $f) {
|
||
|
if ( ($i != "uname") && ($i != "pw") && ($i != "db") && ($i != "login") && ($i != "TUTOS") ) {
|
||
|
if (!is_array($f)) {
|
||
|
$this->addHidden($i,$f);
|
||
|
} else {
|
||
|
foreach ($f as $i2 => $f2) {
|
||
|
$this->addHidden($i."[]",$f2);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#echo "\n<!-- PHP Version CHECK OK -->";
|
||
|
#echo "\n<!-- ". phpversion() ." ". PHP_OS ." -->\n";
|
||
|
#echo "<center>\n";
|
||
|
|
||
|
#echo "<form name=\"login\" action=\"". $this->gotourl ."\" method=\"post\">\n";
|
||
|
|
||
|
|
||
|
#DoubleTableStart();
|
||
|
|
||
|
#echo "<tr>\n";
|
||
|
#echo " <th colspan=\"2\">". $lang['PleaseLogin'] .(( $tutos[authtype] == "x509" ) ? " (".$lang['Certificate'].")" : "" )."</th>\n";
|
||
|
#echo "</tr><tr>\n";
|
||
|
#echo $this->showfieldc($lang['Username'],0,"uname");
|
||
|
|
||
|
if ( $tutos[authtype] == "x509") {
|
||
|
#echo " <td><input id=\"uname\" type=\"text\" size=\"". min($table['people']['login'][size],20) ."\" maxlength=\"". $table['people']['login'][size] ."\" name=\"uname\" value=\"".$_SERVER["SSL_CLIENT_S_DN_CN"]."\" readonly=\"readonly\"></td>\n";
|
||
|
} else {
|
||
|
#echo " <td><input id=\"uname\" type=\"text\" size=\"". min($table['people']['login'][size],20) ."\" maxlength=\"". $table['people']['login'][size] ."\" name=\"uname\" value=\"\"></td>\n";
|
||
|
}
|
||
|
#echo "</tr><tr>\n";
|
||
|
#echo $this->showfieldc($lang['Password'],0,"pw");
|
||
|
if ( $tutos[authtype] == "x509") {
|
||
|
#echo " <td><input id=\"pw\" type=\"password\" size=\"". min($table['people']['pw'][size],20) ."\" maxlength=\"". $table['people']['pw'][size] ."\" name=\"pw\" value=\"x509\">";
|
||
|
} else {
|
||
|
#echo " <td><input id=\"pw\" type=\"password\" size=\"". min($table['people']['pw'][size],20) ."\" maxlength=\"". $table['people']['pw'][size] ."\" name=\"pw\">";
|
||
|
}
|
||
|
|
||
|
if ( $this->db > -1 ) {
|
||
|
#$this->addHidden("dbnr",$this->db);
|
||
|
#echo "</td>\n";
|
||
|
} else {
|
||
|
$db = "";
|
||
|
if ( count($tutos[dbname]) > 1 ) {
|
||
|
#echo "</td>\n</tr><tr>\n";
|
||
|
#echo $this->showfieldc($lang['DB'],0,"dbnr");
|
||
|
#echo " <td align=\"right\"><select id=\"dbnr\" name=\"dbnr\">\n";
|
||
|
foreach ($tutos[dbname] as $i => $f) {
|
||
|
if ( isset($tutos[dbalias][$i]) ) {
|
||
|
#echo "<option value=\"". $i ."\"". ($db == $i ? " selected":"") .">". $tutos[dbalias][$i] ."</option>\n";
|
||
|
} else {
|
||
|
#echo "<option value=\"". $i ."\"". ($db == $i ? " selected":"") .">". $tutos[dbname][$i] ."@". $tutos[dbhost][$i] ."</option>\n";
|
||
|
}
|
||
|
}
|
||
|
#echo "</select></td>\n";
|
||
|
} else {
|
||
|
$this->addHidden("dbnr","0");
|
||
|
#echo "</td>\n";
|
||
|
}
|
||
|
}
|
||
|
#echo "</tr>\n";
|
||
|
|
||
|
#echo "<tr>\n";
|
||
|
#echo " <td><input id=\"login\" name=\"login\" type=\"submit\" value=\"". $lang['Login'] ."\"></td>\n";
|
||
|
#echo " <td align=\"right\">";
|
||
|
$m = make_helplink("login");
|
||
|
#echo sprintf ("<a href=\"%s\" %s onMouseOver=\"self.status='%s' ;return true;\" onMouseOut=\"self.status='';return true;\" title=\"%s\">%s</a>",$m,"",myentities($lang['HelpInfo'],1),myentities($lang['HelpInfo']),$lang['Help']);
|
||
|
|
||
|
#echo " </td>\n";
|
||
|
#echo "</tr>\n";
|
||
|
if ( $tutos[pwlostsupport] > 0 ) {
|
||
|
#echo "<tr>\n";
|
||
|
#echo " <td colspan=\"2\"><input name=\"login\" type=\"submit\" value=\"". $lang['LostPassword'] ."\"></td>\n";
|
||
|
#echo "</tr>\n";
|
||
|
}
|
||
|
|
||
|
#DoubleTableEnd();
|
||
|
#echo $this->getHidden();
|
||
|
#hiddenFormElements();
|
||
|
#echo "</form>\n";
|
||
|
#echo "</center>\n";
|
||
|
echo $this->setFocus("login.uname");
|
||
|
|
||
|
# Display mesage of today
|
||
|
if ( is_readable(getcwd()."/".$tutos['base'] ."/html/motd.html") || is_executable(getcwd()."/".$tutos['base'] ."/html/motd.html")) {
|
||
|
echo "<p>\n";
|
||
|
echo "<center>\n";
|
||
|
DoubleTableStart();
|
||
|
echo "<tr><th>". $lang['MOTD'] ."</th></tr>\n";
|
||
|
echo "<tr><td><pre>\n";
|
||
|
if ( is_executable(getcwd()."/".$tutos['base'] ."/html/motd.html") ) {
|
||
|
@system ($tutos['base'] ."/html/motd.html");
|
||
|
} else {
|
||
|
#@readfile (getcwd()."/".$tutos['base'] ."/html/motd.html");
|
||
|
if ($fd = fopen (getcwd()."/".$tutos['base'] ."/html/motd.html", "rb")) {
|
||
|
fpassthru($fd);
|
||
|
}
|
||
|
}
|
||
|
echo "</pre></td></tr>\n";
|
||
|
DoubleTableEnd();
|
||
|
echo "</center>\n";
|
||
|
}
|
||
|
}
|
||
|
/**
|
||
|
*
|
||
|
*/
|
||
|
function navigate() {
|
||
|
}
|
||
|
/**
|
||
|
*
|
||
|
*/
|
||
|
function prepare() {
|
||
|
global $msg,$lang,$tutos;
|
||
|
|
||
|
$this->nomenu = true;
|
||
|
$this->name = $lang['Login'];
|
||
|
$this->format = "html";
|
||
|
|
||
|
if ( !isset($this->gotourl) ) {
|
||
|
$this->gotourl = $_SERVER['HTTP_REFERER'];
|
||
|
}
|
||
|
$x = strpos($this->gotourl,"?");
|
||
|
if ( $x != "" ) {
|
||
|
$this->gotourl = substr($this->gotourl,0,$x);
|
||
|
}
|
||
|
if ( isset($_POST['db']) ) {
|
||
|
$this->db = $_POST['db'];
|
||
|
} else if ( isset($_GET['db']) ) {
|
||
|
$this->db = $_GET['db'];
|
||
|
} else if ( isset($_POST['dbnr']) ) {
|
||
|
$this->db = $_POST['dbnr'];
|
||
|
} else if ( isset($_GET['dbnr']) ) {
|
||
|
$this->db = $_GET['dbnr'];
|
||
|
} else {
|
||
|
$this->db = -1;
|
||
|
}
|
||
|
|
||
|
#
|
||
|
# Primary Check
|
||
|
#
|
||
|
if ( ! minimum_version(minimumversion) ) {
|
||
|
$msg .= "<br />\nSorry TUTOS needs a PHP Version >= ". minimumversion ."<br />\n";
|
||
|
$msg .= "you are using ". phpversion() ."<br />\n";
|
||
|
$this->stop = true;
|
||
|
}
|
||
|
if ( ! ereg( "^([0-9]{4})-([0-1][0-9])-([0-9]{2}) ([0-2][0-9]):([0-5][0-9]):([0-5][0-9])$", "2001-12-13 13:21:56", $regs ) ) {
|
||
|
$msg .= "Sorry your apache regex library does not work as it should<br />\n";
|
||
|
$msg .= "Look <a href=\"phpinfo.php\">here</a> for <i>Regex Library</i>. It should tell you \"Bundled library enabled\" or \"System library enabled\"<br />\n";
|
||
|
$msg .= "To change it you should recompile your PHP Module with the \"--with-regex=php\" flag on \"configure\"<br />\n";
|
||
|
$this->stop = true;
|
||
|
}
|
||
|
if ( !isset($tutos[authtype]) ) {
|
||
|
$msg .= "no authtype set<br />add a line:\n";
|
||
|
$msg .= " $tutos[authtype] = \"db\";<br />\n";
|
||
|
$msg .= "to your config and/or read config_default.pinc\n";
|
||
|
$this->stop = true;
|
||
|
}
|
||
|
|
||
|
# It is useless to jump again to logout
|
||
|
$x = strpos($this->gotourl,"logout.php");
|
||
|
if ( $x != "" ) {
|
||
|
$this->gotourl = substr($this->gotourl,0,$x);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
?>
|