Last active
July 26, 2021 18:08
-
-
Save wolinka/e6ef2d7ab59077436c56b24b124de7d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Bu komut dosyasi, Cpanel yedeginizi otomatik olarak belli zaman araliklarinda ya farkli bir sunucuya ya da kendi ftp sunucunuza yedek aldirir. | |
// Guvenlik acisindan public_html ya da www dizinlerinde bu dosyayi bulundurmayiniz. | |
// Bu komut dosyasi, https://gist.github.com/nikhgupta/1071596 adresinden alinti yapilarak cozum uretilmistir. | |
// Cpanel Erisimi Icin Gerekli Bilgiler | |
$cpuser = "cpanel_kullanici_adi"; // Cpanel'e giris yapmak icin kullanilan kullanici adi | |
$cppass = "cpanel_sifre"; // Cpanel'e giris yapmak icin kullanilan sifre | |
$domain = "siteadi.com"; // Yedeklemesini yapmak istediginiz domain adi | |
$skin = "paper_lantern"; // Cpanel icin kullanilan tema adi. Guncel surumlerde "paper_lantern" temasi kullanilmaktadir. Eger eski versiyon cpanel kullaniyorsaniz "x" kullanilabilir. Cpanel tema secimi onemlidir, aksi halde script calismaz. | |
// FTP Erisimi Icin Gerekli Bilgiler | |
$ftpuser = "ftp_kullanici_adi"; // Ftp ile giris yapmak icin kullanilan kullanici adi | |
$ftppass = "ftp_sifre"; // Ftp ile giris yapmak icin kullanilan sifre | |
$ftphost = "ftp.siteadi.com"; // Site FTP adresi ya da IP adresi | |
$ftpmode = "homedir"; // Yedegin gonderilecegi yer (kendi hostinginizde yedekleme yapmak icin "homedir", uzak ftp sunucusuna gondermek icin "passiveftp" kullanilabilir) | |
$ftpport = "21"; // Port (Varsayilan = 21) | |
$rdir = "/"; // Yedekleme yapilacak dizin (Varsayilan = / ) | |
// Bildirim Ayarlari | |
$notifyemail = "you@example.com"; // Sonuclarin gonderilecegi email adresi | |
// Secure or non-secure mode | |
$secure = 0; // Set to 1 for SSL (requires SSL support), otherwise will use standard HTTP | |
// Set to 1 to have web page result appear in your cron log | |
$debug = 0; | |
// *********** NO CONFIGURATION ITEMS BELOW THIS LINE ********* | |
if ($secure) { | |
$url = "ssl://".$domain; | |
$port = 2083; | |
} else { | |
$url = $domain; | |
$port = 2082; | |
} | |
$socket = fsockopen($url,$port); | |
if (!$socket) { echo "Failed to open socket connection… Bailing out!\n"; exit; } | |
// Encode authentication string | |
$authstr = $cpuser.":".$cppass; | |
$pass = base64_encode($authstr); | |
$params = "dest=$ftpmode&email=$notifyemail&server=$ftphost&user=$ftpuser&pass=$ftppass&port=$ftpport&rdir=$rdir&submit=Generate Backup"; | |
// Make POST to cPanel | |
fputs($socket,"POST /frontend/".$skin."/backup/fullbackup.html?".$params." HTTP/1.0\r\n"); | |
fputs($socket,"Host: $domain\r\n"); | |
fputs($socket,"Authorization: Basic $pass\r\n"); | |
fputs($socket,"Connection: Close\r\n"); | |
fputs($socket,"\r\n"); | |
// Grab response even if we don't do anything with it. | |
while (!feof($socket)) { | |
$response = fgets($socket,4096); | |
if ($debug) echo $response; | |
} | |
fclose($socket); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank you dude