function savedata($form, $id)
{
    $all_files = array();
    $correct = FALSE;
    @session_start();
    $id_for_old = $id;
    if (!$form->form_front) {
        $id = '';
    }
    if (isset($_POST["counter" . $id])) {
        $counter = esc_html($_POST["counter" . $id]);
        if (isset($_POST["captcha_input"])) {
            $captcha_input = esc_html($_POST["captcha_input"]);
            $session_wd_captcha_code = isset($_SESSION[$id . '_wd_captcha_code']) ? $_SESSION[$id . '_wd_captcha_code'] : '-';
            if ($captcha_input == $session_wd_captcha_code) {
                $correct = TRUE;
            } else {
                echo "<script> alert('" . addslashes(__('Error, incorrect Security code.', 'form_maker')) . "');\n\t\t\t\t\t\t</script>";
            }
        } elseif (isset($_POST["recaptcha_response_field"])) {
            $recaptcha_response_field = $_POST["recaptcha_response_field"];
            $privatekey = $form->private_key;
            $resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $recaptcha_response_field);
            if ($resp->is_valid) {
                $correct = TRUE;
            } else {
                echo "<script> alert('" . addslashes(__('Error, incorrect Security code.', 'form_maker')) . "');\n\t\t\t\t\t\t\t</script>";
            }
        } else {
            $correct = TRUE;
        }
        if ($correct) {
            $result_temp = save_db($counter, $id_for_old);
            $all_files = $result_temp[0];
            if (is_numeric($all_files)) {
                remove($all_files, $id_for_old);
            } elseif (isset($counter)) {
                gen_mail($counter, $all_files, $id_for_old, $result_temp[1]);
            }
        }
        return $all_files;
    }
    return $all_files;
}
示例#2
0
// 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))) {
        if ($file == '.' || $file == '..') {
            continue;
示例#3
0
if (!($select = mysql_select_db($config['database'], $connect))) {
    echo "无法选择数据库,或数据库不存在";
    exit;
}
$files = preg_replace("/(#.+[\r|\n]*)/", '', file_get_contents(ROOT . 'install/core.sql'));
$sqls = split_sql_file($files);
foreach ($sqls as $sql) {
    mysql_query(trim($sql), $connect);
}
if (mysql_errno() == 0) {
    //echo '安装成功!';
    //rename( './install.php' , './installed-'.md5(rand(1,100).time()).'.php' );
} else {
    echo mysql_error();
}
save_db($config);
// 4 初始化管理账号
$sql = "INSERT INTO `u2_user` (  `u2_email` , `u2_password` , `u2_joindate` , `u2_nickname` , `u2_isactive` , `u2_level`  ) \r\nVALUES (  '" . _s($_REQUEST['admin_email']) . "', '" . _s(MD5($_REQUEST['admin_password'])) . "', NOW( ) , '" . _s($_REQUEST['admin_username']) . "', '1', '9');";
mysql_query($sql, $connect);
file_put_contents(ROOT . 'install.lock', 'locked');
echo mysql_error();
echo '安装完成,<a href="/">点击这里进入网站首页</a>';
function _s($str)
{
    return mysql_real_escape_string($str);
}
function save_db($data)
{
    if (!is_writable(ROOT . 'application/config/database.php')) {
        sys_info('文件 application/config/database.php 不可写或者不存在');
    }