Subversion-Projekte lars-tiefland.content-management

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
    $database_name = "content_management";
3
 
4
    $MySQL_Host = "localhost";
5
    if ( $_SERVER["SERVER_NAME"] != "server3" && !preg_match( "/local/i",
6
        $_SERVER["SERVER_NAME"] ) )
7
    {
8
        $MySQL_User = "content_managem";
9
        $MySQL_Passwd = "k-dp-u";
10
        $MySQL_Host_write = "213.203.217.142";
11
    }
12
    else
13
    {
14
        $MySQL_User = "root";
15
        $MySQL_Passwd = "";
16
        $PHP_AUTH_USER = "admin";
17
    }
18
 
19
    $self = basename( $PHP_SELF );
20
    //$path = "/usr/share/php/module/content-management/";
21
 
22
    require_once  $path . "whoami.php";
23
    if ( !$dbh = mysql_connect( "$MySQL_Host", "$MySQL_User", "$MySQL_Passwd" ) )
24
    {
25
        echo
26
            "Die Verbindung zum Datenbanksever konnte nicht hergestellt werden<br>";
27
        die( mysql_errno() . ": " . mysql_error() );
28
    }
29
    else
30
    {
31
        $localhost_dbh = $dbh;
32
        //echo "Die Verbindung zum Datenbanksever wurde hergestellt<br>";
33
    }
34
 
35
    mysql_select_db( "$database_name" );
36
    require_once  $path . "get_rechte.php";
37
 
38
	function date2HumanDate($date) {
39
		$d = substr($date,8,2);
40
		$m = substr($date,5,2);
41
		$y = substr($date,0,4);
42
		return $d.".".$m.".".$y;
43
	}
44
 
45
    function datetime2human( $date )
46
    {
47
        $date = preg_split( "/ /", $date );
48
        return array( "Datum" => join( ".", array_reverse( preg_split( "/-/",
49
            $date[0] ) ) ), "Zeit" => $date[1] );
50
    }
51
 
52
    function date2human( $date )
53
    {
54
        return join( ".", array_reverse( preg_split( "/-/", $date ) ) );
55
    }
56
 
57
    function human2date( $date )
58
    {
59
        return join( "-", array_reverse( preg_split( "/\./", $date ) ) );
60
    }
61
 
62
    function pre( $elem, $r = false )
63
    {
64
        $output = "<pre>" . htmlentities( print_r( $elem, true ) ) .
65
            "</pre>";
66
 
67
        if ( $r == true )
68
        {
69
            return $output;
70
        }
71
        else
72
        {
73
            echo $output;
74
        }
75
    }
76
 
77
    require_once  "loginTest.php";
78
 
79
    function getUserInfo()
80
    {
81
        $sql = "
82
            SELECT
83
                *
84
            FROM
85
                Access
86
            WHERE
87
                user='" . $_SERVER["PHP_AUTH_USER"] . "'
88
        ";
89
        $res = mysql_query( $sql );
90
        if ( $res )
91
        {
92
            $row = mysql_fetch_assoc( $res );
93
            $ret = $row;
94
        }
95
        if ( empty( $ret["name"] ) )
96
        {
97
            $ret["name"] = $_SERVER["PHP_AUTH_USER"];
98
        }
99
        return $ret;
100
    }
101
 
102
    $erg = getUserInfo();
103
    $_SESSION["USERNAME"] = $erg["name"];
104
    $_SESSION["U_ID"] = $erg["ID"];
105
    $_SESSION["U_EMAIL"] = $erg["email"];
106
    $_SESSION["U_TELEFON"] = $erg["telefon"];
107
    $_SESSION["U_FAX"] = $erg["fax"];
108
?>