PHP Classes

File: sample.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Classes of Alexander Selifonov  >  site administrator tool set  >  sample.php  >  Download  
File: sample.php
Role: Example script
Content type: text/plain
Description: Example demonstrating script
Class: site administrator tool set
Web interface to manage site resources
Author: By
Last change: added functions
Date: 7 years ago
Size: 3,826 bytes


Class file image Download
* @package as_admintool
* @desc sample.php - using as_admintool.php demonstration
* @author Alexander Selifonov <>
* @copyright Alexander Selifonov 2007
* @link
* @version 1.000.000
* modified 03.03.2007 (
* Read "as_admintool.htm" for detailed instructions
require_once('as_admintool.php'); // main module
require_once('as_admintool_sqlqry.php'); // executing SQL queries plugin
require_once('as_admintool_backup.php'); // backup SQL data plugin
require_once('as_admintool_restore.php'); // restore SQL data from backup-files
require_once('as_admintool_filemgr.php'); // file manager plugin
require_once('as_admintool_sqlimport.php'); // txt 2 sql import

# change or localize interface...
$as_iface['parameters'] ='Query parameters';
$as_iface['predef-qry'] ='Shoose a query...';
$as_iface['explainqry'] ='Show execution plan';

// Place Your function to connect to MySQL, or just set Your host/db/user/pass:

$access_lev = 2;
// here may be a function to check if user logged on and has enough privileges
// set $access_lev to 0 or 1 to see 'SQL lowest access' mode

$as_adm_qryaccess = $access_lev;

# as_admintool_filemgr: protect some files from deleting/overwriting:
$asdt_fmgr_protect = array('sample.php','as_admintool.php','as_admintool.htm');

# place this line BEFORE any HTML output !

# echo Your HTML header here...
HTML_Header('as_admintool: using example');

$access_lev>=1 ) {
$adminobj = new CAsAdminTool(620,440);
# If as_jsfunclib.js placed into some 'scripts' folder, uncomment next line.
  # $adminobj->SetJsPath('scripts/');

$qlist = array(array('Our company','-'),
'Departments search',"SELECT * from departments where department_name like '&P1%'",'Department name'),
'Employees search',"SELECT * from employees where emp_name like '&P1%' AND first_name LIKE '&P2%'",'Person name','First name'),
'Optimize tables...','-'),
'employees and depts','OPTIMIZE tables employess,departments')

$adminobj->AddPage(ASADM_SQLQUERY,'SQL Queries', $qlist);

$access_lev>=2) { // security check is a good idea !

$tlist = ''; // all tables in current db will be shown
    //You could pass YOUR table names only: array('branches','employees','departments');

$db_name = ''; // Set another DB name, if differs from current selected DB

$adminobj->AddPage(ASADM_BACKUP,'Backup', $tlist, 'backup/',$db_name);
# If You want to see 'restore' functionality, create a subfolder 'backup', and make at least one backup.
    # When there are .xml or .gz files in "backup/" folder, just refresh sample page.

    # folder list, available for file manager
$folders = array(array('./','current folder'),
'scripts/','Scripts folder'),
'backup/','backup folder'),

$adminobj->AddPage(ASADM_FILEMGR,'File Mgr', $folders);

# add import data page
$totables = array('depts','employees','salaries');
$adminobj->AddPage(ASADM_SQLIMPORT,'Import data','txtfiles/',$totables);
else echo
"Access denied !";
HTML_Header($title){ // draw Your HTML header here...
<META http-equiv="Content-Type" Content="text/html;">
<link rel='stylesheet' href='styles.css' type='text/css'>
<H1 align='center'><?=$title?></H1>