PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Zubov Ilya   Solace script maze   index.php   Download  
File: index.php
Role: Application script
Content type: text/plain
Description: Web interface
Class: Solace script maze
PHP source code protection based only on PHP code
Author: By
Last change:
Date: 20 years ago
Size: 4,362 bytes
 

Contents

Class file image Download
<?
include('sftemplate.php');
include(
'phpmaze.php');

//===========================================================================
function make_select_options_from_array ($a, $selectvalue='') {
   
$s = '';
    foreach (
$a as $ovalue => $oname) {
       
$s .= "<option value=\"$ovalue\"";
        if ((
$selectvalue<>'') and ($ovalue == $selectvalue)) $s .= ' selected';
       
$s .= ">$oname</option>";
    }
    return
$s;
}


   
header('Expires: 0');
   
header('Pragma: no-cache');
   
header('Cache-Control: no-cache, must-revalidate');
   
$phpname = basename(__FILE__);
   
$tpl = new FastTemplate;
   
$tpl->no_strict();

   
$maze = new phpmaze;
   
$maze->file_src = '';
   
$maze->file_dst = '';


if (isset(
$_REQUEST['maze'])) {
   
$maze->maze_level = $_REQUEST['maze_level'];
   
$maze->morph_level = $_REQUEST['morph_level'];
    if (
$_FILES['script_file']['name']) {
       
$mazed_fn = $_FILES['script_file']['name'];
       
$maze->content_src = @file_get_contents($_FILES['script_file']['tmp_name']);
    } else {
       
$mazed_fn = 'mazed.php';
       
$script = $_REQUEST['script'];
        if (
get_magic_quotes_gpc()) $script = stripslashes($script);
       
$maze->content_src = $script;
    }

   
$o = &$maze->options;
   
$o['log'] = 0;
   
$o['compress']['enable'] = isset($_REQUEST['enable_compress'])?1:0;
   
$o['compress']['level'] = $_REQUEST['compress_level'];
    if (
$_REQUEST['password'] == $_REQUEST['password2']) {
       
$password = urldecode($_REQUEST['password']);
       
$o['password'] = $password;
    }
   
$o['expire']['enable'] = isset($_REQUEST['enable_expiration'])?1:0;
   
$o['expire']['year'] = $_REQUEST['e_year'];
   
$o['expire']['month'] = $_REQUEST['e_month'];
   
$o['expire']['day'] = $_REQUEST['e_day'];
   
$o['expire']['hour'] = $_REQUEST['e_hour'];
   
$o['expire']['minute'] = $_REQUEST['e_minute'];
    if (
$_REQUEST['client_ip'] <> '')
       
$o['allowed']['client_ip'] = implode(';', preg_split("/[\r\n]+/", urldecode(trim($_REQUEST['client_ip']))));
    if (
$_REQUEST['host_ip'] <> '')
       
$o['allowed']['host_ip'] = implode(';', preg_split("/[\r\n]+/", urldecode(trim($_REQUEST['host_ip']))));

   
$o['self_crc'] = isset($_REQUEST['self_check'])?1:0;
   
$o['turck'] = isset($_REQUEST['turck'])?1:0;

    if (
$maze->run()) {
       
header('Content-type: application/force-download');
       
header("Content-disposition: filename=$mazed_fn");
        echo
$maze->content;
    } else {
        echo
'<pre>';
        echo
"Error occured:\n";
        echo
$maze->log;
        echo
"<a href=$phpname>Back</a>";
    }
    exit;

} else


{
   
ob_start();
   
phpinfo();
   
$i = ob_get_clean();
   
preg_match("/<style.+?>.+?<\/style>/s", $i, $regs);
   
$tpl->assign('PHP_STYLE', $regs[0]);
   
$tpl->assign('PHP_LOGO_GUID', php_logo_guid());
   
$tpl->assign('DEMO_SCRIPT', "<?\n echo 'Hello, world!';\n?>");
    for (
$i=0;$i<=9;$i++) $compression[$i] = $i;
   
$tpl->assign('SELECT_COMPRESS', make_select_options_from_array($compression, 9));

   
$date2 = time();
    for (
$i=1;$i<=31;$i++) $days[$i] = sprintf("%2d", $i);
    for (
$i=0;$i<=23;$i++) $hours[$i] = sprintf("%2d %s", $i==12?$i:$i%12, $i>12?'pm':'am');
    for (
$i=0;$i<=59;$i++) $mins[$i] = sprintf("%02d", $i);
    for (
$i=1;$i<=12;$i++) $months[$i] = date('F', mktime(0, 0, 0, $i));
    for (
$i=date('Y');$i<=date('Y')+10;$i++) $years[$i] = $i;
   
$tpl->assign('SELECT_DAY', make_select_options_from_array($days, date('d', $date2)));
   
$tpl->assign('SELECT_HOUR', make_select_options_from_array($hours, date('H', $date2)));
   
$tpl->assign('SELECT_MINUTE', make_select_options_from_array($mins, date('i', $date2)));
   
$tpl->assign('SELECT_MONTH', make_select_options_from_array($months, date('m', $date2)));
   
$tpl->assign('SELECT_YEAR', make_select_options_from_array($years, date('Y', $date2)));
    if (!
is_callable('mmcache_load') and !@dl('TurckLoader.'.PHP_SHLIB_SUFFIX)) {
       
// no turck. Hmm, well, nothing to do...
   
} else {
       
$tpl->enable_block('with_turck');
       
$tpl->disable_block('no_turck');
    }
}
 
   
$tpl->assign('PHPNAME', $phpname);
   
$tpl->assign('MAZE_TITLE', 'Solace Script Maze');
   
$tpl->assign('MAZE_VERSION', $maze->version);
   
$tpl->assign('PHP_VERSION', phpversion());
   
$tpl->parse('data', 'index');
    echo
$tpl->FastPrint();

?>