Subversion Repositories Transart

Rev

Rev 2 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?
if (isset($_SESSION)) {
session_destroy();
}
?>
<?php require_once('Connections/Transart.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
  session_start();
}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
  $_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['login'])) {
  $loginUsername=$_POST['login'];
  $password=md5($_POST['passwort']);
  $MM_fldUserAuthorization = "benutzer_level";
  $MM_redirectLoginSuccess = "main/index.php";
  $MM_redirectLoginFailed = "main/error.php";
  $MM_redirecttoReferrer = false;
  mysql_select_db($database_Transart, $Transart);
        
  $LoginRS__query=sprintf("SELECT benutzer_login, benutzer_passwort, benutzer_level FROM benutzer WHERE benutzer_login=%s AND benutzer_passwort=%s",
  GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); 
   
  $LoginRS = mysql_query($LoginRS__query, $Transart) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
    
    $loginStrGroup  = mysql_result($LoginRS,0,'benutzer_level');
    
    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;       

    if (isset($_SESSION['PrevUrl']) && false) {
      $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];  
    }
    header("Location: " . $MM_redirectLoginSuccess );
  }
  else {
    header("Location: ". $MM_redirectLoginFailed );
  }
}
?>
<?
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Transart Login</title>
<link href="stil.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="semantic/semantic.min.js"></script>
    <link rel="stylesheet" type="text/css" href="semantic/semantic.min.css">
</head>
<body>
<?php
                /////// Deklariere Globale SESSION VARIABLEN
                $_SESSION['datumaktuell']=date("Y-m-d");
?>
<table class="ui celled orange striped table">
  <tr>
    <td valign="top"><table class="ui table">
      <tr>
        <td><p><img src="img/logo.png" width="206" height="41" /><a class="ui green circular label">V1.307.211</a></td>
      <tr>
        <td valign="top"><form ACTION="<?php echo $loginFormAction; ?>" id="form1" name="form1" method="POST">
          <table width="300" class="tabelle1">
            <tr>
              <td class="optionen">Login</td>
              <td class="stil1"><label>
                <input name="login" type="text" class="stil2" id="login" />
                <script type="text/javascript">
                          document.form1.login.focus();
                          </script>
              </label></td>
            </tr>
            <tr>
              <td class="optionen">Passwort</td>
              <td class="stil1"><label>
                <input name="passwort" type="password" class="stil2" id="passwort" />
              </label></td>
            </tr>
            <tr>
              <td class="stil1">&nbsp;</td>
              <td class="stil1"><label>
                <input name="button" type="submit" class="stil2" id="button" value="Senden" />
              </label></td>
            </tr>
  </table>
                </form>        </td>
      </tr>
    </table>    </td>
  </tr>
</table>

</body>
</html>