Пример #1
0
 function __call($funcName, $funcParams)
 {
     //var_export($funcParams);	//	从未定义方法 传过来的数据 ,自动定义成为了 array() 形式
     if (array_key_exists($funcName, $this->funcList)) {
         //echo "执行了".$funcName."方法";
         //echo "sql语句".$this->funcList[$funcName]["sql"];
         $db = load_db();
         $sql = $this->funcList[$funcName]["sql"];
         if (explode(";", $sql) > 1) {
             $sql = explode(";", $sql);
             $sqllist = array();
             foreach ($sql as $s) {
                 $s = $this->getSqlByParams($s, $funcParams);
                 // 过滤函数,
                 // \n 换行,\t,tab键,横向跳到下一制表符位置,php_eol,换行符,window,linux,mac下是不一样的,但这个课同用,
                 $s = str_replace(array("\n", PHP_EOL, "\t"), "", $s);
                 // 替换 windows 下特定的一些 符号,比如,空格 \t,之类的
                 $sqllist[] = $s;
             }
             return $db->execForTrac($sqllist, $this->funcList[$funcName]["resultType"]);
         } else {
             //如果这儿要执行 多条sql语句,那么将 sql长列划分开来,变为 数组,调用 $db->execForTrac($sqllist,$resulttype);
             $sql = $this->getSqlByParams($sql, $funcParams);
             //这儿还是个过滤函数
             switch ($this->funcList[$funcName]["resultType"]) {
                 case "array":
                     return $db->execForArray($sql);
                 case "int":
                     return intval($db->execForOne($sql));
                 case "string":
                     return strval($db->execForOne($sql));
             }
         }
     }
 }
Пример #2
0
 function __call($funcName, $param)
 {
     if (array_key_exists($funcName, $this->funcList)) {
         $db = load_db();
         $sql = $this->funcList[$funcName]['sql'];
         $param ? $sql = $this->pregParams($sql, $param) : '';
         switch ($this->funcList[$funcName]['resultType']) {
             case 'array':
                 return $db->execForArray($sql);
             case 'int':
                 return intval($db->execForOne($sql));
             case 'string':
                 return strval($db->execForOne($sql));
             default:
                 # code...
                 break;
         }
     }
 }
Пример #3
0
<?php

require_once "config.php";
require_once "db/includes.php";
load_db();
require_once "functions.php";
load_session();
global $account;
Пример #4
0
<?php

/**
 * @description
 * @author huangwei
 */
require 'db.php';
$db_file = isset($argv[1]) ? $argv[1] : "";
$usr = isset($argv[2]) ? $argv[2] : "";
$psw = isset($argv[3]) ? $argv[3] : "";
$user_obj = load_db();
if ($user_obj === NULL) {
    echo "[ERR] {$file} parse failed!\n";
} else {
    if (isset($user_obj[$usr]) && $user_obj[$usr] == $psw) {
        echo "{$usr} and {$psw} match!\n";
    } else {
        echo "[ERR] {$usr} and {$psw} mismatch!\n";
    }
}
Пример #5
0
<?php

// Enable logging
define('LOG', true);
define('LOG_FILE', 'aibolit-wl-generator.log');
date_default_timezone_set('Europe/Moscow');
define('DB_FILE', 'AIBOLIT-WHITELIST.db');
define('MAX_SIZE_TO_SCAN', 600 * 1000);
$extensions_list = array('php', 'php5', 'php7', 'phtml', 'htm', 'html', 'htaccess', 'cgi', 'js', 'css', 'pl', 'py', 'sh', 'shtml', 'txt', 'inc', 'tpl', 'dat');
if ($argc != 2) {
    die("Usage: php {$argv['0']} <root_folder>\n\n");
}
$db = load_db(DB_FILE);
if (LOG) {
    _log_("\nStart " . date("d/m/Y H:i:s", time()));
}
scan_directory_recursively($argv[1]);
save_db($db, DB_FILE);
if (LOG) {
    _log_("Finish " . date("d/m/Y H:i:s", time()), true);
}
exit;
function scan_directory_recursively($directory, $filter = FALSE)
{
    global $extensions_list;
    echo "Scan: " . $directory . "\n";
    $handle = @opendir($directory);
    if ($handle === false) {
        return;
    }
    while (false !== ($file = readdir($handle))) {