Beispiel #1
0
function strip_key($array, $deep = 0)
{
    foreach ($array as $k => $v) {
        if ($deep && !preg_match("/^[a-z0-9_\\-]{1,}\$/i", $k)) {
            dhttp(403, 0);
            dalert('HTTP 403 Forbidden', DT_PATH);
        }
        if (is_array($v)) {
            strip_key($v, 1);
        }
    }
}
Beispiel #2
0
 function connect($dbhost, $dbuser, $dbpass, $dbname, $dbttl, $dbcharset, $pconnect = 0)
 {
     $this->ttl = $dbttl;
     @(list($dbhost, $dbport) = explode(':', $dbhost));
     $dbport or $dbport = 3306;
     $this->connid = mysqli_init();
     if (mysqli_real_connect($this->connid, $dbhost, $dbuser, $dbpass, false, $dbport)) {
         //
     } else {
         $this->linked = 0;
         $retry = 5;
         while ($retry-- > 0) {
             if (mysqli_real_connect($this->connid, $dbhost, $dbuser, $dbpass, false, $dbport)) {
                 $this->linked = 1;
                 break;
             }
         }
         if ($this->linked == 0) {
             global $DT_BOT;
             if ($DT_BOT) {
                 dhttp(503);
             }
             if ($this->halt) {
                 exit(include template('mysql', 'message'));
             } else {
                 $this->halt('Can not connect to MySQL server');
             }
         }
     }
     $version = $this->version();
     if ($version > '4.1' && $dbcharset) {
         mysqli_query($this->connid, IN_ADMIN ? "SET NAMES '" . $dbcharset . "'" : "SET character_set_connection=" . $dbcharset . ", character_set_results=" . $dbcharset . ", character_set_client=binary");
     }
     if ($version > '5.0') {
         mysqli_query($this->connid, "SET sql_mode=''");
     }
     if ($dbname && !mysqli_select_db($this->connid, $dbname)) {
         $this->halt('Cannot use database ' . $dbname);
     }
     return $this->connid;
 }
Beispiel #3
0
 function connect($dbhost, $dbuser, $dbpass, $dbname, $dbttl, $dbcharset, $pconnect = 0)
 {
     $this->ttl = $dbttl;
     $func = $pconnect == 1 ? 'mysql_pconnect' : 'mysql_connect';
     if (!($this->connid = $func($dbhost, $dbuser, $dbpass))) {
         $this->linked = 0;
         $retry = 5;
         while ($retry-- > 0) {
             if ($this->connid = $func($dbhost, $dbuser, $dbpass)) {
                 $this->linked = 1;
                 break;
             }
         }
         if ($this->linked == 0) {
             global $DT_BOT;
             if ($DT_BOT) {
                 dhttp(503);
             }
             if ($this->halt) {
                 exit(include template('mysql', 'message'));
             } else {
                 $this->halt('Can not connect to MySQL server');
             }
         }
     }
     $version = $this->version();
     /* NOET: IN_ADMIN COMMENT MESSY */
     if ($version > '4.1' && $dbcharset) {
         mysql_query(IN_ADMIN ? "SET NAMES '" . $dbcharset . "'" : "SET character_set_connection=" . $dbcharset . ", character_set_results=" . $dbcharset . ", character_set_client=binary", $this->connid);
     }
     if ($version > '5.0') {
         mysql_query("SET sql_mode=''", $this->connid);
     }
     if ($dbname && !mysql_select_db($dbname, $this->connid)) {
         $this->halt('Cannot use database ' . $dbname);
     }
     return $this->connid;
 }
Beispiel #4
0
<?php

defined('IN_DESTOON') or exit('Access Denied');
if ($DT_BOT || $_POST) {
    dhttp(403);
}
require DT_ROOT . '/module/' . $module . '/common.inc.php';
if (!check_group($_groupid, $MOD['group_search'])) {
    include load('403.inc');
}
require DT_ROOT . '/include/post.func.php';
include load('search.lang');
$CP = $MOD['cat_property'] && $catid && $CAT['property'];
$thumb = isset($thumb) ? intval($thumb) : 0;
$vip = isset($vip) ? intval($vip) : 0;
$typeid = isset($typeid) && isset($TYPE[$typeid]) ? intval($typeid) : 99;
if (!$areaid && $cityid && strpos($DT_URL, 'areaid') === false) {
    $areaid = $cityid;
    $ARE = $AREA[$cityid];
}
$fromdate = isset($fromdate) && is_date($fromdate) ? $fromdate : '';
$fromtime = $fromdate ? strtotime($fromdate . ' 0:0:0') : 0;
$todate = isset($todate) && is_date($todate) ? $todate : '';
$totime = $todate ? strtotime($todate . ' 23:59:59') : 0;
$sfields = array($L['by_auto'], $L['by_title'], $L['by_content'], $L['by_introduce']);
$dfields = array('keyword', 'title', 'content', 'introduce');
$sorder = array($L['order'], $L['order_auto']);
$dorder = array($MOD['order'], '');
if (!$MOD['fulltext']) {
    unset($sfields[2], $dfields[2]);
}
Beispiel #5
0
function d301($url)
{
    dhttp(301, 0);
    dheader($url);
}
Beispiel #6
0
    $module = 'company';
    $MOD = cache_read('module-' . $moduleid . '.php');
    include load('company.lang');
    require DT_ROOT . '/module/' . $module . '/common.inc.php';
    include DT_ROOT . '/module/' . $module . '/init.inc.php';
} else {
    if ($DT['safe_domain']) {
        $safe_domain = explode('|', $DT['safe_domain']);
        $pass_domain = false;
        foreach ($safe_domain as $v) {
            if (strpos($DT_URL, $v) !== false) {
                $pass_domain = true;
                break;
            }
        }
        $pass_domain or dhttp(404);
    }
    if ($DT['index_html']) {
        $html_file = $CFG['com_dir'] ? DT_ROOT . '/' . $DT['index'] . '.' . $DT['file_ext'] : DT_CACHE . '/index.inc.html';
        if (!is_file($html_file)) {
            tohtml('index');
        }
        if (is_file($html_file)) {
            exit(include $html_file);
        }
    }
    $AREA or $AREA = cache_read('area.php');
    if ($EXT['mobile_enable']) {
        $head_mobile = $EXT['mobile_url'];
    }
    $seo_title = $DT['seo_title'];
Beispiel #7
0
defined('IN_DESTOON') or exit('Access Denied');
isset($file) or $file = 'homepage';
if (isset($update) || isset($preview)) {
    $db->cids = 1;
    userclean($username);
}
$COM = userinfo($username);
if (!$COM || $COM['groupid'] < 5 && $COM['groupid'] > 1) {
    userclean($username);
    $head_title = $L['not_company'];
    dhttp(404, $DT_BOT);
    include template('com-notfound', 'message');
    exit;
}
if (!$COM['edittime'] && !$MOD['openall']) {
    dhttp(404, $DT_BOT);
    $head_title = $COM['company'];
    include template('com-opening', 'message');
    exit;
}
$domain = $COM['domain'];
if ($domain) {
    if (!isset($preview) && !isset($update) && !isset($key)) {
        if ($CFG['com_domain']) {
            if (strpos($DT_URL, $domain) === false) {
                $subdomain = userurl($username);
                if (strpos($DT_URL, $subdomain) === false) {
                    dheader('http://' . $domain . '/');
                } else {
                    if ($DT_URL == $subdomain . 'index.php' || $DT_URL == $subdomain) {
                        dheader('http://' . $domain . '/');
 function connect($dbhost, $dbuser, $dbpass, $dbname, $dbttl, $dbcharset, $pconnect = 0)
 {
     $this->ttl = $dbttl;
     $func = $pconnect == 1 ? 'mysql_pconnect' : 'mysql_connect';
     if (!($this->connid = $func($dbhost, $dbuser, $dbpass))) {
         $this->linked = 0;
         $retry = 5;
         while ($retry-- > 0) {
             if ($this->connid = $func($dbhost, $dbuser, $dbpass)) {
                 $this->linked = 1;
                 break;
             }
         }
         if ($this->linked == 0) {
             global $DT_BOT;
             if ($DT_BOT) {
                 dhttp(503);
             }
             if ($this->halt) {
                 exit(include template('mysql', 'message'));
             } else {
                 $this->halt('Can not connect to MySQL server');
             }
         }
     }
     $version = $this->version();
     if ($version > '4.1' && $dbcharset) {
         mysql_query(IN_ADMIN ? "SET NAMES '" . $dbcharset . "'" : "SET character_set_connection=" . $dbcharset . ", character_set_results=" . $dbcharset . ", character_set_client=binary", $this->connid);
     }
     if ($version > '5.0') {
         mysql_query("SET sql_mode=''", $this->connid);
     }
     if ($dbname && !mysql_select_db($dbname, $this->connid)) {
         $this->halt('Cannot use database ' . $dbname);
     }
     if (IN_ADMIN) {
         $this->connrw =& $this->connid;
     } else {
         include DT_ROOT . '/file/config/mysqlrw.inc.php';
         $num = count($MYSQLRW);
         if ($num == 1) {
             $key = 0;
         } else {
             $key = abs(crc32($GLOBALS['DT_IP'])) % $num;
         }
         if ($this->connrw = $func($MYSQLRW[$key]['host'], $MYSQLRW[$key]['user'], $MYSQLRW[$key]['pass'])) {
             if ($version > '4.1' && $dbcharset) {
                 mysql_query("SET NAMES '" . $dbcharset . "'", $this->connrw);
             }
             if ($version > '5.0') {
                 mysql_query("SET sql_mode=''", $this->connrw);
             }
             if ($dbname && !mysql_select_db($dbname, $this->connrw)) {
                 $this->halt('Cannot use database ' . $dbname . '(R)');
             }
         } else {
             $this->connrw =& $this->connid;
         }
     }
     return $this->connid;
 }
Beispiel #9
0
<?php

defined('IN_DESTOON') or exit('Access Denied');
dhttp(403, $DT_BOT);
$head_title = lang('message->without_permission');
exit(include template('noright', 'message'));
Beispiel #10
0
<?php

/*
	[Destoon B2B System] Copyright (c) 2008-2013 Destoon.COM
	This is NOT a freeware, use is subject to license.txt
*/
defined('IN_DESTOON') or exit('Access Denied');
if ($DT['close']) {
    if ($DT_BOT) {
        dhttp(503);
    }
    message($DT['close_reason'] . '&nbsp;');
}
if ($DT['defend_cc']) {
    if (!DT_WIN && file_exists('/proc/loadavg')) {
        if ($fp = @fopen('/proc/loadavg', 'r')) {
            list($loadaverage) = explode(' ', fread($fp, 6));
            fclose($fp);
            if ($loadaverage > $DT['defend_cc']) {
                if (defined('DT_TASK')) {
                    exit;
                }
                header("HTTP/1.0 503 Service Unavailable");
                exit(include DT_ROOT . '/api/503.php');
            }
        }
    }
}
if ($DT['defend_reload']) {
    $lastvisit = intval(decrypt(get_cookie('lastvisit')));
    set_cookie('lastvisit', encrypt("{$DT_TIME}"));