PHP Classes

File: sample_example.php

Recommend this page to a friend!
  Classes of Pratik Darji   MySQL Backup FTP and Email   sample_example.php   Download  
File: sample_example.php
Role: Example script
Content type: text/plain
Description: Example of given class
Class: MySQL Backup FTP and Email
Send MySQL backup file by email or to a FTP server
Author: By
Last change:
Date: 11 years ago
Size: 1,450 bytes
 

Contents

Class file image Download
<?php

include "database_backup_class.php";

$obj = new database_backup_class();

$dbhost = "localhost"; // Define database Host
$dbuser = "root"; // Define database username
$dbpwd = "root"; // Define database password
$dbname = "database"; // Define database name

$ftp_host = ""; // Define FTP hostname to which database dump upload
$ftp_username = ""; // Define FTP username to which database dump upload
$ftp_pass = ""; // Define FTP password to which database dump upload

$obj->set_property("dbhost",$dbhost); // set database host name which we want to dump
$obj->set_property("dbuser",$dbuser); // set databse useraname
$obj->set_property("dbpwd",$dbpwd); // set database password
$obj->set_property("dbname",$dbname); // set database name which we want to dump

$filename = $obj->get_database_dump();

$destination_path = "/public_html/"; // Destination path of ftp server to which we want to upload our database dump

$obj->set_property("ftp_host",$ftp_host); // set FTP host name
$obj->set_property("ftp_username",$ftp_username); // set FTP username
$obj->set_property("ftp_pass",$ftp_pass); // set FTP password

$obj->upload_to_ftp($destination_path,$filename);

$sender_email = ""; // add sender email here

$reciever_email = ""; // add receiver email here

$obj->set_property("sender_email",$sender_email);
$obj->set_property("reciever_email",$reciever_email);

$send = $obj->mail_backup($filename);
echo
$send;
?>