Repository navigation
Expand file tree
/
Copy pathwelcome.php
More file actions
140 lines (115 loc) · 4.87 KB
/
Copy pathwelcome.php
File metadata and controls
140 lines (115 loc) · 4.87 KB
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
<?php
/**************************************************************************\
* PHPAdvocat *
* http://phpadvocat.sourceforge.net *
* By Burkhard Obergoeker <phpadvocat@obergoeker.de> *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
require("./include/phpadvocat.inc.php");
/* Check login info and put it into session Vars */
session_start();
$loginuser = $_POST["loginuser"];
$loginpasswd = $_POST["loginpasswd"];
if ($loginuser && $loginpasswd) {
/* test connection */
$db = new www_db;
$db->connect($loginuser, $loginpasswd);
$db->close();
/* if session still available register variables */
$_SESSION["dbuser"]=$loginuser;
$_SESSION["dbpasswd"]=$loginpasswd;
/* the old form to register was */
/* session_register('dbuser', 'dbpasswd'); */
} else {
header ("Location: login.php");
exit;
}
/* Get User Account from Session Vars */
$user = $_SESSION["dbuser"];
$passwd = $_SESSION["dbpasswd"];
/* initialize database */
$db = new www_db;
$db->connect($user, $passwd);
echo "<HTML><HEAD><TITLE>PHPAdvocat - Welcome</TITLE>";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-15\">\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"include/phpadvocat.css\">";
echo "</HEAD>";
echo "<BODY BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\">\n";
/* Begin framework: table with two colunms, */
/* menu on left with size 200, rest on right */
echo "<TABLE width=100%><TR><TD width=200 valign=top>\n";
$phpa_menue->account=$_SESSION["dbuser"];
$phpa_menue->draw_menue();
echo "</TD><TD>\n"; /* end menue, start dialog */
/* display title */
echo "<CENTER><H1>Willkommen</H1></CENTER>\n";
echo "<table width=100%><tr>\n";
echo "<td>" . date("d.m.Y", time()) . "</td>";
echo "<TD ALIGN=RIGHT></TD>";
print "</tr></table>\n";
print "<hr><center>";
print ("<h2>Heutige Termine</h2>\n");
$today = date("d.m.Y", time());
if ($DBSERVER=='POSTGRESQL'){
$querystring = sprintf("select phpa_events.eventstart, ".
"phpa_events.description, phpa_events.location, ".
"phpa_events.pfile, phpa_pfiles.processregister ".
"from phpa_events, phpa_pfiles ".
"where date(eventstart) = (date 'today') ".
"and phpa_events.pfile = phpa_pfiles.number ".
"order by eventstart");
} elseif ($DBSERVER=='MYSQL'){
$querystring = sprintf("select phpa_events.eventstart, ".
"phpa_events.description, phpa_events.location, ".
"phpa_events.pfile, phpa_pfiles.processregister ".
"from phpa_events, phpa_pfiles ".
"where DATE_FORMAT(eventstart,'%%Y-%%m-%%d') = CURDATE() ".
"and phpa_events.pfile = phpa_pfiles.number ".
"order by eventstart");
}
// echo "<hr>" . $querystring . "<hr>";
$db->query($querystring);
printf("<table class=listtable>\n");
/* Display header */
printf("<tr><th>Zeit</th>".
"<th>Beschreibung</th><th>Ort</th>".
"<th>Akte</th></tr>");
/* Display all events today */
while($db->next_record()) {
printf("<tr><td>%s</td>",
substr($db->record["eventstart"],11,5));
printf("<td>%s</td>", $db->record["description"]);
printf("<td>%s</td>", $db->record["location"]);
printf("<td><a href=\"pfileedit.php?pnumber=%s&detail=1#detail\" " .
">%s (%s)</a></td></tr>\n",
$db->record["pfile"], $db->record["processregister"],
$db->record["pfile"]);
} /* end while */
echo "</table>";
$demand = 0.0;
$querystring=sprintf("select sum(incomingamount)-sum(outgoingamount) as sum ".
"from phpa_amounts");
$db->query($querystring);
/* fill $demand only if database query is not null */
if($db->next_record() && ($db->record["sum"] != '')) {
$demand = $db->record["sum"];
} /* end query */
/* mark positive amount as green */
if($demand < 0) {
$color="red";
} else {
$color="green";
}
/* display it */
printf("<hr><table><tr><td bgcolor=%s>\n", $color);
printf("<b>Stand Gewinn/Verlust: %s €</b>",
tolocalnum(sprintf('%.2f',$demand),$LOCALE));
printf("</tr><tr><td><center><a href=filesrequest.php>Zu den Akten</a></center></td>");
printf("</td></tr></table>\n");
echo "</TD></TR></TABLE>\n"; /* end of table framework */
echo "</BODY></HTML>\n"; /* end of page */
?>