Archive | Imprint | Privacy
9th July 2009
Nerd 2.0

Confixx backup function using cronjob

Actually, everything easy. The web host lets his webspace via Confixx managed, offers cronjobs and each user can create his backups via Confixx.

Why now it is indeed possible to play backups directly to a set of user ftp, but no automatic configuration (a la every week a full backup) is possible, I do not understand quite.

After a bit of Google, the thing has done but also because a simple PHP script that takes automatic backups via Confixx.

<?php
header('Content-Type: text/plain');
$user = 'web123';
$password = urlencode('DEIN_PASSWORT');
$host = 's123.netcup.net';
$fp = fsockopen($host, 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)
\n";
} else {
$loginData = "username={$user}&password={$password}";
$out  = "POST /login.php HTTP/1.0\r\n";
$out .= "Host: {$host}\r\n";
$out .= "Connection: close\r\n";
$out .= "Content-Type: application/x-www-form-urlencoded\r\n";
$out .= 'Content-Length: ' . strlen($loginData) . "\r\n";
$out .= "\r\n";
$out .= "{$loginData}\r\n";
fwrite($fp, $out);
$response = '';
while (!feof($fp)) {
$response .= fgets($fp, 128);
}
fclose($fp);
preg_match_all('#Set-Cookie: (.*);#', $response, $matches);
if (in_array('mysql', $argv))
$out  = "GET /user/{$user}/tools_backup2.php?destination=upload&bname_search=&selectAll=1&backup%5B%5D=mysql&action=backup HTTP/1.0\r\n";
else
$out  = "GET /user/{$user}/tools_backup2.php?destination=upload&bname_search=&selectAll=1&backup%5B%5D=html&backup%5B%5D=files&backup%5B%5D=mysql&action=backup HTTP/1.0\r\n";
$out .= "Host: {$host}\r\n";
$out .= "Connection: close\r\n";
$out .= 'Cookie: ' . implode('; ', $matches[1]) . "\r\n";
$out .= "\r\n";
$fp = fsockopen($host, 80, $errno, $errstr, 30);
fwrite($fp, $out);
$response = '';
while (!feof($fp)) {
$response .= fgets($fp, 128);
}
fclose($fp);
echo $response;
}
?>

In meinem Fall konnte das Script nicht auf dem Server ausgeführt werden, welcher gesichert werden soll, da die Confixxwebsite nicht Lokal aufrufbar war.

Viel Spaß beim Sichern!

Ähnliche Beiträge:
Downloads
Es wird spannend!
PHPbb und 2mBit
Webmail und Spam
Neue Domain

Kommentieren


Ähnliche Beiträge:
Downloads
Es wird spannend!
PHPbb und 2mBit
Webmail und Spam
Neue Domain

Kommentieren