Login   Register  
PHP Classes
elePHPant
Icontem

File: index.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Larry Wakeman  >  DB Schema Management  >  index.php  >  Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Example
Class: DB Schema Management
Dump and update MySQL database schemata
Author: By
Last change:
Date: 2012-02-10 14:47
Size: 3,331 bytes
 

Contents

Class file image Download
<?php
    
include('dbMaintenence.php');     // load the class
    
if (isset($_POST['hostname'])) {
        
$maint = new dbMaintenence($_POST['hostname'], 
                                                                  
$_POST['username'], 
                                                                  
$_POST['password'], 
                                                                  
$_POST['database'],
                                                                  
$_POST['dbprefix']);   // initialize the class
    
}
?>
<html>
<head>
<title>Schema Check</title>
</head>
<body>
<h2 style="text-align: center; margin-top: 30px;">Schema Check Demonstration Script</h2>
<?php
    
if (isset($_POST['extract'])) {
        
$maint->extract(dirname(__FILE__).'/'.$_POST['filename']);       // create an extract file
        
echo '<h4 style="text-align: center; margin-top: 30px;">Extract Operatiion Complete</h4>';
    }
    if (isset(
$_POST['update'])) {
        echo 
'<h4 style="text-align: center; margin-top: 30px;">'.$maint->update(dirname(__FILE__).'/'.$_POST['filename']).'</h4>';      // update the database from the extract file
    
}
?>
<form  name=".Form" action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
<table style="margin-top: 10px; margin-left: auto; margin-right: auto;">
    <tr>
        <td>Host Name:</td>
        <td><input type="text" name="hostname" <?php if (isset($_POST['hostname'])) echo 'value="'.$_POST['hostname'].'"' ?> style="background-color: #BBFFFF;"></td>
        <td>Enter the hostname for the database server</td>
    </tr>
    <tr>
        <td>User Name:</td>
        <td><input type="text" name="username" <?php if (isset($_POST['username'])) echo 'value="'.$_POST['username'].'"' ?> style="background-color: #BBFFFF;"></td>
        <td>Enter the username for the database server</td>
    </tr>
    <tr>
        <td>Password:</td>
        <td><input type="text" name="password" <?php if (isset($_POST['password'])) echo 'value="'.$_POST['password'].'"' ?> style="background-color: #BBFFFF;"></td>
        <td>Enter the password for the database server</td>
    </tr>
    <tr>
        <td>Database Name:</td>
        <td><input type="text" name="database" <?php if (isset($_POST['database'])) echo 'value="'.$_POST['database'].'"' ?> style="background-color: #BBFFFF;"></td>
        <td>Enter the database name to extract of update</td>
    </tr>
    <tr>
        <td>Table Prefix:</td>
        <td><input type="text" name="dbprefix" <?php if (isset($_POST['dbprefix'])) echo 'value="'.$_POST['dbprefix'].'"' ?> style="background-color: #BBFFFF;"></td>
        <td>Enter the table prefix if applicable for the extract or update</td>
    </tr>
    <tr>
        <td>File Name:</td>
        <td><input type="text" name="filename" <?php if (isset($_POST['filename'])) echo 'value="'.$_POST['filename'].'"' ?> style="background-color: #BBFFFF;"></td>
        <td>Enter the extract file name.  The file must be in the same directory as this script.</td>
    </tr>
    <tr>
        <td colspan=3 style="text-align: center;">
            <input type="submit" name ="extract" value="Extract">
            <input type="submit" name ="update" value="update">
        </td>
    </tr>
</table>
</form>
</body>
</html>