-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathservice.php
More file actions
228 lines (183 loc) · 6.04 KB
/
service.php
File metadata and controls
228 lines (183 loc) · 6.04 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<?php
/*
* Imagehosting-Script by inspire-World.de
* Rework by Rustypredator <contact@rusty.info>
*
* Original Project: http://inspire-world.de/phpscripte13.php
* Reworked Project: https://github.com/Rustypredator/imagehosting
*/
error_reporting(E_ALL & ~E_NOTICE);
define('SCRIPTSECURE', 1);
define('ROOT_PFAD', './admin/');
define('SCRIPTNAME', 'service.php');
// Rel. Pfad zur DB-Daten oder Config Setup Datei
define('SETUP_PFAD', './admin/');
// #########################################################
// Datenbank Class einbinden
require_once ROOT_PFAD.'includes/class_dbhandler_mysql.php';
// $db definieren
$db = new dbhandler_mysql();
// DB Verbindung aufbauen
$db->db_connect();
// Scriptconfig Daten holen
require_once ROOT_PFAD.'setup/setup.php';
// #########################################################
require_once ROOT_PFAD.'includes/globale_funct_inc.php';
// Templateparser laden
$tparse = new template();
require_once ROOT_PFAD.'includes/userlayout.php';
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
// Aktionen fuer diese Datei
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
$go = '';
if (isset($_GET['go']) && $_GET['go'] != '') {
$go = datensaver($_GET['go'], 50, 4);
} elseif (isset($_POST['go']) && $_POST['go'] != '') {
$go = datensaver($_POST['go'], 50, 4);
}
switch ($go) {
//##############################################
// Hilfe
case 'help':
help();
break;
// Impressum
case 'imp':
imp();
break;
// Statistik
case 'st':
st();
break;
case 'dpdel':
dpdel();
break;
case 'dp':
dp();
break;
// AGB/Regeln
default:
agb();
break;
}
/**
* AGB/Regeln.
*
* @return void
*/
function agb()
{
global $scriptconf, $db, $tparse;
$sektion = 'AGB/Regeln';
echo globaler_header($sektion, '', '', '');
echo globallayoutoben($sektion);
echo $tparse->get_tdata(WEB_PFAD.'templates/agb.html');
echo globaler_footer();
}
/**
* Bild loeschen.
*
* @return void
*/
function dp()
{
global $scriptconf, $db, $tparse;
$sektion = 'Bild löschen';
echo globaler_header($sektion, '', '', '');
echo globallayoutoben($sektion);
echo '<form action="'.SCRIPTNAME.'" method="POST">'."\n";
echo '<input type="hidden" name="go" value="dpdel">'."\n";
echo $tparse->get_tdata(WEB_PFAD.'templates/bild_loeschen_form.html');
echo globaler_footer();
}
/**
* Bild loeschen ausfuehren.
*
* @return void
*/
function dpdel()
{
global $scriptconf, $db, $tparse;
$delcode = isset($_POST['dc']) && $_POST['dc'] != '' ? datensaver($_POST['dc'], 35, 6) : 'leer';
$picdata = $db->dbquery_first('SELECT up_id, up_picname, up_orginalname, up_endung, up_vz, up_bytesize, up_thumb, up_thumbbytesize, up_delkey FROM '.$db->db_prefix."uploads WHERE up_delkey = '$delcode'");
$gefunden = $picdata['up_id'] == '' ? 0 : 1;
// wenn nicht gefunden
if (!$gefunden) {
$sektion = 'Fehler';
echo globaler_header($sektion, '', '', '');
echo globallayoutoben($sektion);
$contentarray2 = [
'TEXTTOP' => '<b>Fehler, kein Bild gefunden</b>',
'TEXTCONT' => 'Es wurde kein Bild in der Datenbank gefunden!',
];
$tparse->get_tpldata(WEB_PFAD.'templates/textausgaben.html');
echo $tparse->templateparser($contentarray2);
echo globaler_footer();
exit;
} else {
if (file_exists($scriptconf['HTMLPFAD'].'/img/'.$picdata['up_vz'].'/'.$picdata['up_picname'].'.'.$picdata['up_endung'])) {
@unlink($scriptconf['HTMLPFAD'].'/img/'.$picdata['up_vz'].'/'.$picdata['up_picname'].'.'.$picdata['up_endung']);
}
if ($picdata['up_thumb'] == 1 && file_exists($scriptconf['HTMLPFAD'].'/img/'.$picdata['up_vz'].'/TH_'.$picdata['up_picname'].'.'.$picdata['up_endung'])) {
@unlink($scriptconf['HTMLPFAD'].'/img/'.$picdata['up_vz'].'/TH_'.$picdata['up_picname'].'.'.$picdata['up_endung']);
}
$gesamtbytes = $picdata['up_bytesize'] + $picdata['up_thumbbytesize'];
$db->run_delete_query('DELETE FROM', 'uploads', 'WHERE up_id = '.$picdata['up_id'].'');
$db->run_update_query('UPDATE', 'gesamtstat', "picanz = picanz - 1, picbytes = picbytes - $gesamtbytes");
redirect($scriptconf['HTMLURL'].'/', 2, 'Bild wurde gelöscht');
exit;
}
}
/**
* Impressum/Kontakt.
*
* @return void
*/
function imp()
{
global $scriptconf, $db, $tparse;
$sektion = 'Impressum/Kontakt';
echo globaler_header($sektion, '', '', '');
echo globallayoutoben($sektion);
echo $tparse->get_tdata(WEB_PFAD.'templates/impressum.html');
echo globaler_footer();
}
/**
* Hilfe/FAQ.
*
* @return void
*/
function help()
{
global $scriptconf, $db, $tparse;
$sektion = 'Hilfe/FAQ';
echo globaler_header($sektion, '', '', '');
echo globallayoutoben($sektion);
echo $tparse->get_tdata(WEB_PFAD.'templates/hilfe.html');
echo globaler_footer();
}
/**
* Statistik.
*
* @return void
*/
function st()
{
global $scriptconf, $db, $tparse;
$sektion = 'Statistik';
echo globaler_header($sektion, '', '', '');
echo globallayoutoben($sektion);
$statistik = $db->dbquery_first('SELECT picanz, picbytes, aktuelldate, heuteanzahl, alltraffic, allpics FROM '.$db->db_prefix.'gesamtstat');
$traffic = $db->dbquery_first('SELECT IF(SUM(traffic_bytes) > 0, SUM(traffic_bytes), 0) AS tgross, IF(SUM(traffic_thbytes) > 0, SUM(traffic_thbytes), 0) AS tklein FROM '.$db->db_prefix.'trafficlog');
$gesamttraffic = $traffic['tgross'] + $traffic['tklein'];
$contentarray = [
'ANZAKTUELL' => $statistik['allpics'],
'ANZGESAMT' => $statistik['picanz'],
'BYTESGESAMT' => dateigroesse($statistik['picbytes']),
'UPLOADHEUTE' => $statistik['heuteanzahl'],
'TRAFFICGESAMT' => $statistik['alltraffic'] == 0 ? dateigroesse($gesamttraffic) : dateigroesse($statistik['alltraffic']),
];
$tparse->get_tpldata(WEB_PFAD.'templates/statistik.html');
echo $tparse->templateparser($contentarray);
echo globaler_footer();
}