PHP Classes

File: en/test.php

Recommend this page to a friend!
  Packages of Eduardo Martos Gómez   Backup   en/test.php   Download  
File: en/test.php
Role: Example script
Content type: text/plain
Description: Test script
Class: Backup
Backup directory files and MySQL databases
Author: By
Last change:
Date: 20 years ago
Size: 944 bytes
 

 

Contents

Class file image Download
<html>
<head>
<title>Testing Backup</title>
</head>
<body>
<?
    // Includes the class Backup
    include ("cls_backup.php");
    
    // Crea the object
    $backup = new backup;
    
    // Sets the parameters
    $backup->set_etiqueta ("test");
    $backup->set_dir_origen ("src_dir/");
    $backup->set_dir_destino ("dest_dir");
    $backup->set_bd_host ("host");
    $backup->set_bd_usr ("user");
    $backup->set_bd_clave ("password");
    $backup->set_bd_nombre ("db_name");
    
    // Evaluates the parameter modo
    switch ($_GET["modo"])
    {
        // Compress the directory specified by set_dir_origen () and downloads
        // the zip file
        case "files":
            $backup->backup_files ();
        break;
        // Dumps DB into a file and downloads it
        case "db":
            $backup->backup_mysql ();
        break;
        // Shows backup options
        case "":
            echo "<p><a href=\"?modo=files\">Files</a></p>";
            echo "<p><a href=\"?modo=db\">DB</a>";
        break;
    }
?>
</body>
</html>