| 1 |
lars |
1 |
<?
|
|
|
2 |
// whoami
|
|
|
3 |
if ($site != $domain[1].".".$domain[2])
|
|
|
4 |
{
|
|
|
5 |
if (in_array($site,explode(";",$web_rechte[gaestebuch][basisdaten][databases])))
|
|
|
6 |
{
|
|
|
7 |
// neue FTP-Daten laden
|
|
|
8 |
$query="
|
|
|
9 |
SELECT
|
|
|
10 |
content_management.webs.FTP_server,
|
|
|
11 |
content_management.webs.FTP_user,
|
|
|
12 |
content_management.webs.FTP_passwd,
|
|
|
13 |
content_management.webs.FTP_passiv
|
|
|
14 |
FROM
|
|
|
15 |
content_management.webs
|
|
|
16 |
WHERE
|
|
|
17 |
content_management.webs.domain='$site'
|
|
|
18 |
";
|
|
|
19 |
$result = mysql_query ($query) or die (mysql_errno().": ".mysql_error()."<hr>$query<hr>");
|
|
|
20 |
$webs=mysql_fetch_assoc($result);
|
|
|
21 |
|
|
|
22 |
// ---------------------------------------------------------------
|
|
|
23 |
// web_rechte lesen um target erfragen
|
|
|
24 |
$query="
|
|
|
25 |
select
|
|
|
26 |
content_management.modules.interner_name,
|
|
|
27 |
content_management.tools.button_name,
|
|
|
28 |
content_management.properties.interner_name,
|
|
|
29 |
content_management.webs_properties.Bezeichnung
|
|
|
30 |
from
|
|
|
31 |
content_management.webs,
|
|
|
32 |
content_management.webs_properties,
|
|
|
33 |
content_management.properties,
|
|
|
34 |
content_management.tools,
|
|
|
35 |
content_management.modules
|
|
|
36 |
where
|
|
|
37 |
content_management.webs.domain = '$site'
|
|
|
38 |
and
|
|
|
39 |
content_management.webs_properties.webs = content_management.webs.ID
|
|
|
40 |
and
|
|
|
41 |
content_management.webs_properties.properties = content_management.properties.ID
|
|
|
42 |
and
|
|
|
43 |
content_management.properties.tools = content_management.tools.ID
|
|
|
44 |
and
|
|
|
45 |
content_management.tools.modules = content_management.modules.ID
|
|
|
46 |
";
|
|
|
47 |
$result = mysql_query ($query) or die (mysql_errno().": ".mysql_error()."<hr>$query<hr>");
|
|
|
48 |
while($zeile=mysql_fetch_array($result))
|
|
|
49 |
{
|
|
|
50 |
if (!$zeile[3]) {$zeile[3]="";}
|
|
|
51 |
$web_rechte[$zeile[0]][$zeile[1]][$zeile[2]]=$zeile[3];
|
|
|
52 |
}
|
|
|
53 |
unset($query);
|
|
|
54 |
unset($result);
|
|
|
55 |
unset($zeile);
|
|
|
56 |
}
|
|
|
57 |
else
|
|
|
58 |
{
|
|
|
59 |
echo "
|
|
|
60 |
Versuch auf ein anderes Gästebuch zuzugreifen:<br>
|
|
|
61 |
von: ".$domain[1].".".$domain[2]."<br>
|
|
|
62 |
auf: $site<br>
|
|
|
63 |
erlaubte Sites:".$web_rechte[gaestebuch][basisdaten][databases]."<br><br>
|
|
|
64 |
Zugriff verweigert";
|
|
|
65 |
exit;
|
|
|
66 |
}
|
|
|
67 |
}
|
|
|
68 |
|
|
|
69 |
$request="http://forum.$site/gaestebuch/$site.php";
|
|
|
70 |
$content=join("",file($request));
|
|
|
71 |
|
|
|
72 |
$filename = tempnam ("/web/apache/temp", $site);
|
|
|
73 |
|
|
|
74 |
$fd = fopen ($filename, "w");
|
|
|
75 |
fwrite ($fd,$content,strlen($content));
|
|
|
76 |
fclose ($fd);
|
|
|
77 |
|
|
|
78 |
$conn_id = ftp_connect($webs[FTP_server]);
|
|
|
79 |
if ($webs[FTP_passiv]) { ftp_pasv ($conn_id,1); }
|
|
|
80 |
|
|
|
81 |
$login_result = ftp_login($conn_id, $webs[FTP_user], $webs[FTP_passwd]);
|
|
|
82 |
// Verbindung überprüfen
|
|
|
83 |
if ((!$conn_id) || (!$login_result))
|
|
|
84 |
{
|
|
|
85 |
echo "Ftp-Verbindung nicht hergestellt!";
|
|
|
86 |
if ($PHP_AUTH_USER == "admin")
|
|
|
87 |
{
|
|
|
88 |
echo "Verbindung mit $site als Benutzer $webs[FTP_user] mit Passwort $webs[FTP_passwd] nicht möglich";
|
|
|
89 |
}
|
|
|
90 |
else
|
|
|
91 |
{
|
|
|
92 |
echo "Verbindung mit $site nicht möglich";
|
|
|
93 |
}
|
|
|
94 |
die;
|
|
|
95 |
}
|
|
|
96 |
|
|
|
97 |
$upload = ftp_put($conn_id, $web_rechte[gaestebuch][basisdaten][output], $filename, FTP_BINARY);
|
|
|
98 |
|
|
|
99 |
unlink($filename);
|
|
|
100 |
|
|
|
101 |
if (!$upload) { echo "Ftp upload war fehlerhaft!"; }
|
|
|
102 |
|
|
|
103 |
ftp_quit($conn_id);
|
|
|
104 |
?>
|