コード例 #1
0
ファイル: home.php プロジェクト: Git-Host/gdxkc-code
    foreach ($node['R'] as $f) {
        if (!strcasecmp($f['N'], $name)) {
            header('Content-Type: application/octet-stream');
            header('Content-Length: ' . $f['S']);
            header('Content-Disposition: attachment; filename=' . $f['N']);
            for ($i = 0; $i * 3145728 < $f['S']; $i++) {
                echo kv_get($kv, $f['I'] . ':' . $i);
            }
            //echo kv_get($kv, $path . ':' . $i);
            exit;
        }
    }
    /* without much usage */
    foreach ($node['D'] as $f) {
        if (!strcasecmp($f['N'], $name)) {
            exit_redirect('home.php?path=' . $path . '/');
        }
    }
    exit_print('No such item. ' . $name);
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>KVDB-MemStorage - Use MemStorage From SaeKVDB To Save Files</title>
<link rel="stylesheet" type="text/css" href="css/view.css" />
<link type="image/x-icon" href="images/favicon.ico" rel="shortcut icon">
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript" src="js/uploader.js"></script>
コード例 #2
0
ファイル: base.php プロジェクト: Git-Host/gdxkc-code
function exit_print($error)
{
    $_SESSION['error'] = $error;
    exit_redirect('result.php');
}
コード例 #3
0
ファイル: auto_restrict.php プロジェクト: ymairesse/BoZoN
function log_user($login_donne, $pass_donne)
{
    // create session vars
    global $auto_restrict;
    if ($auto_restrict['login'] === $login_donne && $auto_restrict['pass'] === hash('sha512', $auto_restrict["salt"] . $pass_donne)) {
        $_SESSION['id_user'] = chiffre(id_user(), $auto_restrict['encryption_key']);
        $_SESSION['login'] = $auto_restrict['login'];
        $_SESSION['expire'] = time() + 60 * $auto_restrict['session_expiration_delay'];
        return true;
    } else {
        if ($login_donne != 'dis' && $pass_donne != 'connect') {
            add_banned_ip();
        }
    }
    exit_redirect();
    return false;
}
コード例 #4
0
ファイル: manage.php プロジェクト: Git-Host/gdxkc-code
             kv_set($kv, $dir, serialize($node));
             exit_redirect('home.php?path=' . $dir);
         }
     }
     /* ERROR */
     for (reset($node['D']); $it = each($node['D']);) {
         if (!strcasecmp($it[1]['N'], $name)) {
             $tmp = unserialize(kv_get($kv, $dir . $name . '/'));
             kv_delete($kv, $dir . $name . '/');
             $tmp['T'] = time();
             kv_set($kv, $dir . $value . '/', serialize($tmp));
             $node['D'][] = array('N' => $value, 'T' => $tmp['T'], 'A' => $tmp['A']);
             unset($node['D'][$it[0]]);
             usort($node['D'], item_cmp);
             kv_set($kv, $dir, serialize($node));
             exit_redirect('home.php?path=' . $dir);
         }
     }
     exit_print('No such file or directory.');
     break;
 case 'share':
     $name = $_REQUEST['name'];
     $zz = array();
     foreach ($name as $n) {
         foreach ($node['R'] as $k => $v) {
             if (!strcasecmp($v['N'], $n)) {
                 $node['R'][$k]['A'] = !$node['R'][$k]['A'];
                 if ($node['R'][$k]['A']) {
                     $zz[] = $v;
                 }
                 break;
コード例 #5
0
ファイル: auto_restrict.php プロジェクト: Pluxopolis/BoZoN
function log_user($login_donne, $pass_donne)
{
    # create session vars
    $save = false;
    global $auto_restrict, $default_language;
    if (empty($default_language)) {
        $default_language = 'en';
    }
    session_destroy();
    session_start();
    foreach ($auto_restrict['users'] as $key => $user) {
        if ($user['login'] === $login_donne && $user['pass'] === hash('sha512', $user["salt"] . $pass_donne)) {
            $_SESSION['id_user'] = chiffre(id_user(), $user['encryption_key']);
            $_SESSION['login'] = $user['login'];
            $_SESSION['expire'] = time() + 60 * $auto_restrict['session_expiration_delay'];
            $admin = first($auto_restrict['users']);
            $_SESSION['status'] = $user['status'];
            $_SESSION['language'] = $user['lang'];
            if ($save) {
                save_users();
            }
            return true;
        }
    }
    if ($login_donne != 'dis' && $pass_donne != 'connect') {
        add_banned_ip();
    } else {
        exit_redirect();
    }
    return false;
}
コード例 #6
0
ファイル: index.php プロジェクト: Git-Host/gdxkc-code
<?php

#this file is the entrance for user, it first check the authority status and detect
#whether to init kvdb or just login(msg may be received from session).
include 'base.php';
session_start();
$_SESSION['error'] == '';
if ($_SESSION['auth'] == 'OK') {
    exit_redirect('home.php');
}
$kv = kv_init();
$type = kv_get($kv, ':account');
/* wheather the KBDB has been initilized */
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>KVDB-MemStorage - Use MemStorage From SaeKVDB To Save Files</title>
<style type="text/css">
body { font: 13px verdana, tahoma, sans-serif; color: #333; }
a { text-decoration: none; color:  #2323E4; }
form { width: 235px; margin: 140px auto; padding: 20px 13px;  border: 1px #ddd solid; background: #f7f7f7; margin-bottom: 40px;}
li { list-style: none; margin-bottom: 28px; clear: both; padding: 0 8px; }
li input { float: right; margin-right: 6px; margin-top: -3px; font-family: verdana, tahoma, sans-serif; }
#title { text-align: center; font-size: 16px; color: #2db033; margin-top: 10px; }
#msg { text-align: center; font-size: 12px; color:#D00; margin: 0 15px 20px 7px; border: 1px dotted #999; padding: 4px 0; }
#submit{ margin: 28px 0 8px 0; }
#submit input { width: 82px; height: 23px; border: 0px; background-color:#3cb43c; color: #fff; border-radius: 2px; margin-top: -4px; }
input[type=text], input[type=password] { width: 130px; height: 19px; border: 1px #ccc solid; background-color: #faffbd; }
.hidden { display: none; }
コード例 #7
0
ファイル: index.php プロジェクト: ArthurHoaro/SnippetVamp
function log_user($login_donne, $pass_donne)
{
    global $config;
    if ($config['login'] == $login_donne && $config['pass'] == hash('sha512', $config["salt"] . $pass_donne)) {
        inlog('<em class="ok">User ' . $login_donne . ' logged successfully</em>');
        $_SESSION['id_user'] = Crypte(id_user(), $config['encryption_key']);
        $_SESSION['login'] = $config['login'];
        $_SESSION['expire'] = time() + 60 * $config['session_expiration_delay'];
        return true;
    } else {
        if ($login_donne != '' && $pass_donne != '') {
            inlog('<em class="warning">User tried to log</em>');
        }
        exit_redirect();
        return false;
    }
}
コード例 #8
0
function tracker_register($attach_id, $mode = '')
{
    global $template, $attach_config, $ft_cfg, $lang, $return_message;
    global $reg_mode;
    $template->assign_vars(array('META' => ''));
    $attach_id = intval($attach_id);
    $reg_mode = $mode;
    if (!($torrent = get_torrent_info($attach_id))) {
        message_die(GENERAL_ERROR, 'Torrent not found');
    }
    $post_id = $torrent['post_id'];
    $topic_id = $torrent['topic_id'];
    $forum_id = $torrent['forum_id'];
    $poster_id = $torrent['poster_id'];
    if ($torrent['extension'] !== TORRENT_EXT) {
        torrent_error_exit($lang['Not_torrent']);
    }
    if ($torrent['privmsgs_id']) {
        torrent_error_exit('Not allowed in PM');
    }
    if (!$torrent['allow_reg_tracker']) {
        torrent_error_exit($lang['Reg_not_allowed_in_this_forum']);
    }
    if ($post_id != $torrent['topic_first_post_id']) {
        torrent_error_exit($lang['Allowed_only_1st_post_reg']);
    }
    if ($torrent['tracker_status']) {
        torrent_error_exit($lang['Already_reg']);
    }
    if ($this_topic_torrents = get_registered_torrents($topic_id, 'topic')) {
        torrent_error_exit($lang['Only_1_tor_per_topic']);
    }
    torrent_auth_check($forum_id, $torrent['poster_id']);
    $filename = FT_ROOT . $attach_config['upload_dir'] . '/' . $torrent['physical_filename'];
    if (!is_file($filename)) {
        torrent_error_exit('File name error');
    }
    if (!file_exists($filename)) {
        torrent_error_exit('File not exists');
    }
    if (!($tor = bdecode_file($filename))) {
        torrent_error_exit('This is not a bencoded file');
    }
    if ($ft_cfg['bt_check_announce_url']) {
        require_once FT_ROOT . 'includes/torrent_announce_urls.php';
        $ann = @$tor['announce'] ? $tor['announce'] : '';
        $announce_urls['main_url'] = $ft_cfg['bt_announce_url'];
        if (!$ann || !in_array($ann, $announce_urls)) {
            $mess = sprintf($lang['Invalid_ann_url'], htmlspecialchars($ann), $announce_urls['main_url']);
            torrent_error_exit($mess);
        }
    }
    $info = @$tor['info'] ? $tor['info'] : array();
    if (!@$info['name'] || !@$info['piece length'] || !@$info['pieces'] || strlen($info['pieces']) % 20 != 0) {
        torrent_error_exit('Invalid torrent file');
    }
    $totallen = floatval(0);
    if (@$info['length']) {
        $totallen += $info['length'];
    } else {
        if (@$info['files'] && is_array($info['files'])) {
            foreach ($info['files'] as $fn => $f) {
                $totallen += $f['length'];
            }
        } else {
            torrent_error_exit('Invalid torrent file');
        }
    }
    $size = sprintf('%.0f', $totallen);
    $piece_length = sprintf('%.0f', floatval($info['piece length']));
    $reg_time = time();
    $info_hash = pack("H*", sha1(bencode($info)));
    $info_hash_md5 = strtolower(md5($info_hash));
    $info_hash_sql = rtrim(bt_sql_esc($info_hash), ' ');
    $columns = ' info_hash,       post_id,  poster_id,  topic_id,  attach_id,   size,    piece_length,   reg_time';
    $values = "'{$info_hash_sql}', {$post_id}, {$poster_id}, {$topic_id}, {$attach_id}, '{$size}', '{$piece_length}', {$reg_time}";
    $sql = 'INSERT INTO ' . BT_TORRENTS_TABLE . " ({$columns}) VALUES ({$values})";
    if (!DB()->sql_query($sql)) {
        $sql_error = DB()->sql_error();
        if ($sql_error['code'] == 1062) {
            torrent_error_exit($lang['Bt_Reg_fail_same_hash']);
        }
        message_die(GENERAL_ERROR, 'Could not register torrent on tracker', '', __LINE__, __FILE__, $sql);
    }
    /*
    	// Insert empty up/down "statistic record" for guests
    	$torrent_id = DB()->sql_nextid();
    	$guest_uid  = GUEST_UID;
    
    	$columns = 'torrent_id,  user_id,    attach_id, t_up_total, t_down_total';
    	$values = "$torrent_id, $guest_uid, $attach_id, 0,          0";
    
    	$sql = 'INSERT INTO '. BT_TOR_DL_STAT_TABLE ." ($columns) VALUES ($values)";
    
    	if (!DB()->sql_query($sql))
    	{
    		message_die(GENERAL_ERROR, 'Could not insert empty statistic record for guests', '', __LINE__, __FILE__, $sql);
    	}
    */
    // update tracker status for this attachment
    $sql = 'UPDATE ' . ATTACHMENTS_DESC_TABLE . " SET\r\n\t\t\ttracker_status = 1\r\n\t\tWHERE attach_id = {$attach_id}\r\n\t\tLIMIT 1";
    if (!DB()->sql_query($sql)) {
        message_die(GENERAL_ERROR, 'Could not update torrent status', '', __LINE__, __FILE__, $sql);
    }
    // set DL-Type for topic
    if ($ft_cfg['bt_set_dltype_on_tor_reg']) {
        $sql = 'UPDATE ' . TOPICS_TABLE . ' SET
				topic_dl_type = ' . TOPIC_DL_TYPE_DL . "\r\n\t\t\tWHERE topic_id = {$topic_id}\r\n\t\t\tLIMIT 1";
        if (!($result = DB()->sql_query($sql))) {
            message_die(GENERAL_ERROR, 'Could not update topics table', '', __LINE__, __FILE__, $sql);
        }
    }
    if ($reg_mode == 'request' || $reg_mode == 'newtopic') {
        $mess = sprintf($lang['Bt_Registered'], append_sid("download.php?id={$attach_id}"));
        exit_redirect($mess, $post_id, $forum_id);
    }
    return;
}
コード例 #9
0
ファイル: account.php プロジェクト: Git-Host/gdxkc-code
        } else {
            exit_print("Password is wrong. <a href=\"home.php\">Back Home</a>?");
        }
        break;
    case 'login':
        check_field('username', 'password');
        if ($username != $account['username'] || md5($password) != $account['password']) {
            $_SESSION['msg'] = 'User name or password wrong!';
            exit_redirect('index.php');
        }
        $_SESSION['auth'] = 'OK';
        exit_redirect('home.php');
        break;
    case 'logout':
        $_SESSION['auth'] = '';
        exit_redirect('index.php');
        break;
    default:
        exit_print('Action unkown');
        break;
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>KVDB-MemStorage - Use MemStorage From SaeKVDB To Save Files</title>
<style type="text/css">
body { font: 13px verdana, tahoma, sans-serif; color: #333; }
a { text-decoration: none; color:  #2323E4; }
form { width: 235px; margin: 140px auto; padding: 20px 13px;  border: 1px #ddd solid; background: #f7f7f7; margin-bottom: 40px;}