Advertisement
Guest User

Untitled

a guest
May 12th, 2017
590
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.49 KB | None | 0 0
  1. <?
  2. $cp_username    = 'username';       // cPanel username
  3. $cp_password    = 'password';       // cPanel password
  4. $cp_domain  = 'domain.com';     // Domain name
  5. $cp_skin    = 'crucial';        // cPanel skin (either 'crucial' or 'x3')
  6.  
  7. $ftp_username   = 'ftp_username';   // Remote FTP username
  8. $ftp_password   = 'ftp_password';   // Remote FTP password
  9. $ftp_hostname   = 'ftp.domain.com'; // Remote FTP hostname
  10. $ftp_mode   = 'ftp';        // Remote FTP mode (do not change)
  11.  
  12. $notifyemail    = 'you@domain.com'; // Notification email
  13.  
  14. $secure     = false;        // Use SSL
  15. $debug      = false;        // Enable debug
  16.  
  17. if($secure) {
  18.     $url = 'ssl://'.$cp_domain;
  19.     $port = 2083;
  20. } else {
  21.     $url = $cp_domain;
  22.     $port = 2082;
  23. }
  24.  
  25. $socket = fsockopen($url,$port);
  26.  
  27. if(!$socket) {
  28.     print 'Failed to open socket connection&hellip;bailing out!'."\n";
  29.     exit;
  30. }
  31.  
  32. $auth_string     = $cp_username.':'.$cp_password;
  33. $password    = base64_encode($auth_string);
  34.  
  35. $params = 'dest='.$ftp_mode.'&email='.$notifyemail.'&server='.$ftp_hostname.'&user='.$ftp_username.'&pass='.$ftp_password.'&submit=Generate Backup';
  36.  
  37. fputs($socket, 'POST /frontend/'.$cp_skin.'/backup/dofullbackup.html?'.$params.' HTTP/1.0'."\r\n");
  38. fputs($socket, 'Host: '.$cp_domain."\r\n");
  39. fputs($socket, 'Authorization: Basic '.$password."\r\n");
  40. fputs($socket, 'Connection: Close'."\r\n");
  41. fputs($socket, "\r\n");
  42.  
  43. while(!feof($socket)) {
  44.     $response = fgets($socket, 4096);
  45.    
  46.     if($debug) {
  47.         echo $response;
  48.     }
  49. }
  50.  
  51. fclose($socket);
  52.  
  53. system('rm -f /home/'.$cp_username.'/backup-*');
  54. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement