-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebtop.php
More file actions
157 lines (151 loc) · 3.96 KB
/
webtop.php
File metadata and controls
157 lines (151 loc) · 3.96 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<?php
session_start();
function restoreAppState($username, $app){
$db = mysqli_connect( 'localhost', 'root', '', 'webtop' );
if (mysqli_connect_errno() != 0){
echo 'Connection to database failed';
}
$sqlUserApp = "Select * FROM apps WHERE UserIn = '$username' && Applikationsname = '$app'";
$result = $db->query($sqlUserApp);
// ============================
// Fill array with zeros to avoid empty values; then overwrite.
// ============================
$_SESSION[$app]=['open'=>0,'left'=>0, 'top'=>0];
if($result && $result->num_rows){
$row = $result->fetch_object();
$_SESSION[$app]=['open'=>$row->Status,'left'=>$row->PositionX, 'top'=>$row->PositionY];
}
}
// ============================
// FirePHP core pages for easier debugging.
// ============================
require_once('FirePHPCore/FirePHP.class.php');
ob_start();
require_once('FirePHPCore/fb.php');
?>
<?php
if (isset($_COOKIE['username'])) {
$_SESSION['username']=$_COOKIE['username'];
}
// ============================
// Default values set for session variables that save
// state of the applications; all windows set to closed etc.
// ============================
if (isset($_SESSION['username'])){
if(!isset($_SESSION['infoDialog']))
restoreAppState($_SESSION['username'], 'infoDialog');
if(!isset($_SESSION['photoDialog']))
restoreAppState($_SESSION['username'], 'photoDialog');
if(!isset($_SESSION['boxbot'])){
restoreAppState($_SESSION['username'], 'boxbot');
}
if(!isset($_SESSION['vase1'])){
restoreAppState($_SESSION['username'], 'vase1');
}
if(!isset($_SESSION['vase2'])){
restoreAppState($_SESSION['username'], 'vase2');
}
if(!isset($_SESSION['vase3'])){
restoreAppState($_SESSION['username'], 'vase3');
}
}
fb($_SESSION, "Mein SESSION-Array");
fb($_POST, "Mein POST-Array");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
<title>Linda's Webtop</title>
<link rel="stylesheet" type="text/css" href="webtopstyle.css">
<link href="../css/ui-lightness/jquery-ui-1.10.4.custom.css" rel="stylesheet">
<script src="../js/jquery-1.10.2.js"></script>
<script src="../js/jquery-ui-1.10.4.custom.js"></script>
<!-- <script src="application.js"></script> -->
</head>
<body>
<!--
Registration form included on webtop page.
TODO: switch this to something more professional
(get method means the form reappears after login
if user uses the backbotton of the browser)
-->
<div id="register">
<?php
if(isset($_GET['register']))
{
include 'registration.php';
}
?>
</div>
<div id="login">
<?php
if($_SESSION==NULL){
include 'login.php';
}
?>
</div>
<p id="top">
<?php
if(isset($_SESSION['username']) ){
echo 'Hi ' . $_SESSION['username'] . '!';
} elseif (isset($_POST['username'])){
echo $wronglogin . '<br>' . ' No-one is logged in';} else {
echo 'No-one is logged in. ';
}
?>
</p>
<div id="userdaten" title="Ihre Daten">
<?php
if (isset($_SESSION['username'])){
include 'userdaten.php';
}
?>
</div>
<div id="icons">
<?php
if (isset($_SESSION['username'])){
include 'icons.php';
}
?>
</div>
<div id="menudiv">
<?php
if (isset($_SESSION['username'])){
include 'menudiv.php';
}
?>
</div>
<?php
if (isset($_SESSION['username'])){
include 'taskleiste.php';
}
?>
<div id="infoDialog" class="dialog" title="About PHP">
<?php
if (isset($_SESSION['username'])){
include 'dialog.php';
}
?>
<div id="photoDialog" class="dialog" title="Photographs">
<?php
if (isset($_SESSION['username'])){
include 'photoDialog.php';
}
?>
<div id="rssDialog" class="dialog" title="RSS-Feeds">
<?php
if (isset($_SESSION['username'])){
include 'rssDialog.php';
}
?>
<?php
if(isset($_SESSION['username']) ){
include 'application.php';
}
fb($_SESSION, "SESSION-Array: ");
?>
</div>
</body>
</html>