コード例 #1
0
ファイル: index.php プロジェクト: hillfias/LDAPWebApp
function search($ds, $filter, $attributes)
{
    // Nous allons commencer par afficher des informations de bases concernant le domaine auquel on est connecté et son administrateur
    $dn = "dc=rBOX,dc=lan";
    //Domaine
    $filtre = "({$filter})";
    //Filtre de recherche
    $sr = ldap_search($ds, $dn, '(' . $filter . ')', $attributes);
    //On effectue la recherche
    if (!$sr) {
        echo '<p class="center red">Le serveur LDAP n\'a pas pu effectuer la recherche . Nous vous prions de nous excuser pour le désagrément.</p>';
        kill($ds);
        exit;
    }
    $info = ldap_get_entries($ds, $sr);
    //On récupère les résultats
    if (!$info) {
        echo '<p class="center red">Le serveur LDAP n\'a pas pu récupérer les résultats de la recherche . Nous vous prions de nous excuser pour le désagrément.</p>';
        kill($ds);
        exit;
    }
    return $info;
}
コード例 #2
0
ファイル: kernel.php プロジェクト: Ben749/racetrack
function Memuse($limit = 65, $sup = '')
{
    if (e(',dead1', 1)) {
        return;
    }
    static $i;
    if (!$sup) {
        $i++;
    }
    $sup = $i;
    #if(j9){echo"+";return;}#dev
    #Timelong();no recursion#if(j9)kill("+$mem>$limit $_ENV[args]");#dev
    $mem = Round(Memory_get_usage(1) / 1000000, 2);
    if ($mem == $_ENV['lastmemusage']) {
        return;
    }
    $_ENV['lastmemusage'] = $mem;
    $db = "Erreur : usage mémoire : {$mem} mo cause {$sup}";
    if ($sup) {
        $_ENV['Mem'][$sup] = $mem;
    }
    if ($mem > $limit) {
        e(',dead1');
        dbm("MemLeak:{$mem}@{$sup}@" . SU . pre($_ENV));
        $x = dbkt();
        $line = p3(print_r(end($x), 1));
        db($line);
        return $mem;
        kill($line);
    }
    return $mem;
}
コード例 #3
0
ファイル: editor.php プロジェクト: Ben749/racetrack
<html><head><title>racetrack editor - <?php 
echo $title;
?>
</title>
<link rel="shortcut icon" type="image/png" href="/favicon.ico">
<link href="/style.css" rel="stylesheet"><link href="/?css" rel="stylesheet">
<script src="//cdn.ckeditor.com/4.5.7/standard<?php 
#basic|full
?>
/ckeditor.js"></script>
<title>Racetrack :: editor</title></head><body>
<div class=w50><div class=w50>
<?php 
echo implode(' - ', $f->dc());
if ($choices) {
    kill('' . $choices . '</div></div>');
}
?>


<form method=post action='?fi=<?php 
echo $fi;
?>
'>
<input name=id type=hidden value='<?php 
echo $id;
?>
'>
Title : <input name=title value='<?php 
echo $title;
?>
コード例 #4
0
<?php

session_start();
$skip_login = true;
require_once 'functions.php';
$expiration = (int) $_GET['expiration'];
$get_hash = $_GET['hash'];
$hash = encrypt($expiration);
if ($hash != $get_hash && !$_GET['state']) {
    kill();
}
$expiration_date = date("Y-m-d", $expiration);
$yesterday = date("Y-m-d", strtotime(date("Y-m-d" . " -1day")));
if ($expiration_date < date("Y-m-d") && !$_GET['state']) {
    kill("Expiration date can not be before yesterday or after tomorrow");
}
if (LOCAL) {
    $redirect = 'http://ib.is/openstreets/register.php';
} else {
    $redirect = 'http://friends.openstreets.co.za/register.php';
}
if ($_GET['state']) {
    if ($_GET['state'] != $_SESSION['state']) {
        $error = "Invalid session";
    }
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "https://www.googleapis.com/oauth2/v3/token");
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, "code={$_GET['code']}&client_id={$client_id}&client_secret={$client_secret}&redirect_uri={$redirect}&grant_type=authorization_code");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $output = curl_exec($ch);
コード例 #5
0
ファイル: deleteGroup.php プロジェクト: hillfias/LDAPWebApp
<?php

header("Content-Type: text/plain");
/**
 * delete a group
 * @param : group name [required]
 * @return : success/fail message (txt)
 * */
if (!empty($_POST['group'])) {
    // LDAP ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    // On a besoin de récupérer les infos sur les groupes pour le formulaire/ pour ajouter un nouvel utilisateur
    include '../ldap/index.php';
    $ds = connectionLDAP();
    // LDAP ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    $name = $_POST['group'];
    $dn = "cn={$name},ou=groups,dc=rBOX,dc=lan";
    // Supression de l'entrée de l'annuaire
    $r = ldap_delete($ds, $dn);
    if ($r) {
        echo 'Le groupe a été correctement supprimé.';
    } else {
        echo 'Données non conformes.';
    }
    kill($ds);
}
コード例 #6
0
ファイル: compile.php プロジェクト: ATofighi/PHP-CPP-Compile
     }
 }
 // Step 2 - Execute the program, only if there is no compile error
 $descriptorspec = array(0 => array("file", "{$cwd}input.txt", "r"), 1 => array("file", "{$cwd}output.txt", "w"), 2 => array("file", "{$cwd}error-output.txt", "a"));
 chmod($cwd . 'myfile.out', 0777);
 // Start the Counter
 $start_time = time();
 // Start the program execution
 $process = proc_open("ulimit -Sv {$memory_limit};\nLD_PRELOAD={$path}/sandbox/EasySandbox.so {$cwd}/myfile.out", $descriptorspec, $pipes, $cwd, $env);
 // Time to sleep, for the program to complete
 usleep($time_limit * 1000);
 // Now awake up to see if the execution is complete
 $status = proc_get_status($process);
 if ($status['running']) {
     // If the process is still running, terminate it
     kill($status['pid']);
     proc_terminate($process);
     echo json_encode(array('type' => 'ERROR', 'content' => 'Time limit exceeded'));
     removeFiles();
     exit;
 }
 if (is_resource($process)) {
     // It is important that you close any pipes before calling
     // proc_close in order to avoid a deadlock
     $return_value = proc_close($process);
     $end_time = time();
     // echo "Total Time taken - " . date('H:m:s', $end_time - $start_time);
     //		echo $return_value;
     $command_output = str_replace("\r\n", "\n", rtrim(trim(file_get_contents($cwd . 'output.txt'))));
     if (substr($command_output, 0, 26) == "<<entering SECCOMP mode>>\n") {
         $command_output = substr($command_output, 26);
コード例 #7
0
ファイル: item2.func.php プロジェクト: jiangtiandao/phpdts
function deathnote($itmd = 0, $dnname = '', $dndeath = '', $dngender = 'm', $dnicon = 1, $sfn)
{
    global $db, $tablepre, $log, $killnum, $mode, $achievement;
    global ${'itm' . $itmd}, ${'itms' . $itmd}, ${'itmk' . $itmd}, ${'itme' . $itmd}, ${'itmsk' . $itmd};
    $dn =& ${'itm' . $itmd};
    $dnk =& ${'itmk' . $itmd};
    $dne =& ${'itme' . $itmd};
    $dns =& ${'itms' . $itmd};
    $dnsk =& ${'itmsk' . $itmd};
    $mode = 'command';
    if ($dn != '■DeathNote■' && $dn != '四面亲手制作的■DeathNote■') {
        $log .= '道具使用错误!<br>';
        return;
    } elseif ($dns <= 0) {
        $dn = $dnk = $dnsk = '';
        $dne = $dns = 0;
        $log .= '道具不存在!<br>';
        return;
    }
    if (!$dnname) {
        return;
    }
    if ($dnname == $sfn && $dn != '四面亲手制作的■DeathNote■') {
        $log .= "你不能自杀。<br>";
        return;
    }
    if (!$dndeath) {
        $dndeath = '心脏麻痹';
    }
    if ($dn == '四面亲手制作的■DeathNote■') {
        $dndeath = "使用了天然呆四面的假冒伪劣■DeathNote■";
    }
    //echo "name=$dnname,gender = $dngender,icon=$dnicon,";
    if ($dn != '四面亲手制作的■DeathNote■') {
        $result = $db->query("SELECT * FROM {$tablepre}players WHERE name='{$dnname}' AND type = 0");
    } else {
        $result = $db->query("SELECT * FROM {$tablepre}players WHERE name='{$sfn}' AND type = 0");
    }
    if (!$db->num_rows($result)) {
        $log .= "你使用了■DeathNote■,但是什么都没有发生。<br>哪里出错了?<br>";
    } else {
        $edata = $db->fetch_array($result);
        if (($dngender != $edata['gd'] || $dnicon != $edata['icon']) && $dn != '四面亲手制作的■DeathNote■') {
            $log .= "你使用了■DeathNote■,但是什么都没有发生。<br>哪里出错了?<br>";
        } else {
            if ($dn != '四面亲手制作的■DeathNote■') {
                $log .= "你将<span class=\"yellow b\">{$dnname}</span>的名字写在了■DeathNote■上。<br>";
                $log .= "<span class=\"yellow b\">{$dnname}</span>被你杀死了。";
                include_once GAME_ROOT . './include/state.func.php';
                kill('dn', $dnname, 0, $edata['pid'], $dndeath);
                $killnum++;
            } else {
                $log .= "你将<span class=\"yellow b\">{$dnname}</span>的名字写在了■DeathNote■上。<br>";
                $log .= "但就在这时,你突然感觉一阵晕眩。<br>你失去了意识。<br>";
                $log .= "<span class='lime'>“这张■DeathNote■似乎制作不合格呢,还真是对不起呢……”<br></span>";
                include_once GAME_ROOT . './include/state.func.php';
                death('fake_dn', '', 0, $dndeath);
                $killnum++;
            }
        }
    }
    $dns--;
    if ($dns <= 0) {
        $log .= '■DeathNote■突然燃烧起来,转瞬间化成了灰烬。<br>';
        $dn = $dnk = $dnsk = '';
        $dne = $dns = 0;
    }
    return;
}
コード例 #8
0
ファイル: irc_lib.php プロジェクト: cmn32480/exec-irc-bot
function handle_data($data, $is_sock = False, $auth = False, $exec = False)
{
    global $buckets;
    global $alias_locks;
    global $dest_overrides;
    global $admin_accounts;
    global $admin_data;
    global $admin_is_sock;
    global $admin_aliases;
    global $exec_errors;
    global $exec_list;
    global $throttle_time;
    global $ignore_list;
    if ($auth == False) {
        echo "" . date("Y-m-d H:i:s", microtime(True)) . " > {$data}";
        handle_errors($data);
    } else {
        term_echo("*** auth = true");
    }
    $items = parse_data($data);
    if ($items !== False) {
        write_out_buffer_data($items);
        if ($items["destination"] == DEBUG_CHAN) {
            return;
        }
        if ($auth == False and $is_sock == True) {
            log_items($items);
        }
        if (in_array($items["nick"], $ignore_list) == True) {
            return;
        }
        if (isset($buckets[BUCKET_IGNORE_NEXT]) == True and $items["nick"] == get_bot_nick()) {
            unset($buckets[BUCKET_IGNORE_NEXT]);
            return;
        }
        if ($items["prefix"] == IRC_HOST and strpos(strtolower($items["trailing"]), "throttled") !== False) {
            term_echo("*** THROTTLED BY SERVER - REFUSING ALL OUTGOING MESSAGES TO SERVER FOR " . THROTTLE_LOCKOUT_TIME . " SECONDS ***");
            $throttle_time = microtime(True);
            return;
        }
        if ($items["cmd"] == 330) {
            authenticate($items);
        }
        if ($items["cmd"] == 376) {
            dojoin(INIT_CHAN_LIST);
        }
        if ($items["cmd"] == "NOTICE" and $items["nick"] == "NickServ" and $items["trailing"] == NICKSERV_IDENTIFY_PROMPT) {
            if (file_exists(PASSWORD_FILE) == True and NICKSERV_IDENTIFY === "1") {
                rawmsg("NickServ IDENTIFY " . trim(file_get_contents(PASSWORD_FILE)), True);
            }
            startup();
        }
        $args = explode(" ", $items["trailing"]);
        if (in_array($args[0], $admin_aliases) == True or has_account_list($args[0]) == True) {
            if ($auth == False and $is_sock == True) {
                term_echo("authenticating \"" . $args[0] . "\"...");
                $admin_data = $items["data"];
                $admin_is_sock = $is_sock;
                rawmsg("WHOIS " . $items["nick"]);
                return;
            }
        }
        $alias = $args[0];
        handle_events($items);
        switch ($alias) {
            case ALIAS_ADMIN_NICK:
                if (count($args) == 2) {
                    rawmsg(":" . get_bot_nick() . " NICK :" . trim($args[1]));
                    set_bot_nick(trim($args[1]));
                }
                break;
            case ALIAS_ADMIN_QUIT:
                if (count($args) == 1) {
                    write_out_buffer_command($items, "quit");
                    process_scripts($items, ALIAS_QUIT);
                }
                break;
            case ALIAS_ADMIN_PS:
                if (count($args) == 1) {
                    write_out_buffer_command($items, "ps");
                    ps($items);
                }
                break;
            case ALIAS_ADMIN_KILL:
                if (count($args) == 2) {
                    write_out_buffer_command($items, "kill");
                    kill($items, $args[1]);
                }
                break;
            case ALIAS_ADMIN_KILLALL:
                if (count($args) == 1) {
                    write_out_buffer_command($items, "killall");
                    killall($items);
                }
                break;
            case ALIAS_LIST:
                if (check_nick($items, $alias) == True) {
                    if (count($args) == 1) {
                        write_out_buffer_command($items, "list");
                        get_list($items);
                    }
                }
                break;
            case ALIAS_LIST_AUTH:
                if (check_nick($items, $alias) == True) {
                    if (count($args) == 1) {
                        write_out_buffer_command($items, "listauth");
                        get_list_auth($items);
                    }
                }
                break;
            case ALIAS_LOCK:
                if (check_nick($items, $alias) == True) {
                    if (count($args) == 2) {
                        write_out_buffer_command($items, "lock");
                        $alias_locks[$items["nick"]][$items["destination"]] = $args[1];
                        privmsg($items["destination"], $items["nick"], "alias \"" . $args[1] . "\" locked for nick \"" . $items["nick"] . "\" in \"" . $items["destination"] . "\"");
                    } else {
                        privmsg($items["destination"], $items["nick"], "syntax: " . ALIAS_LOCK . " <alias>");
                    }
                }
                break;
            case ALIAS_UNLOCK:
                if (check_nick($items, $alias) == True and isset($alias_locks[$items["nick"]][$items["destination"]]) == True) {
                    write_out_buffer_command($items, "unlock");
                    privmsg($items["destination"], $items["nick"], "alias \"" . $alias_locks[$items["nick"]][$items["destination"]] . "\" unlocked for nick \"" . $items["nick"] . "\" in \"" . $items["destination"] . "\"");
                    unset($alias_locks[$items["nick"]][$items["destination"]]);
                }
                break;
            case ALIAS_ADMIN_DEST_OVERRIDE:
                if (count($args) == 2) {
                    write_out_buffer_command($items, "dest_override");
                    privmsg($items["destination"], $items["nick"], "destination override \"" . $args[1] . "\" set for nick \"" . $items["nick"] . "\" in \"" . $items["destination"] . "\"");
                    $dest_overrides[$items["nick"]][$items["destination"]] = $args[1];
                } else {
                    privmsg($items["destination"], $items["nick"], "syntax: " . ALIAS_ADMIN_DEST_OVERRIDE . " <dest>");
                }
                break;
            case ALIAS_ADMIN_DEST_CLEAR:
                if (isset($dest_overrides[$items["nick"]][$items["destination"]]) == True) {
                    write_out_buffer_command($items, "dest_clear");
                    $override = $dest_overrides[$items["nick"]][$items["destination"]];
                    unset($dest_overrides[$items["nick"]][$items["destination"]]);
                    privmsg($items["destination"], $items["nick"], "destination override \"{$override}\" cleared for nick \"" . $items["nick"] . "\" in \"" . $items["destination"] . "\"");
                }
                break;
            case ALIAS_ADMIN_IGNORE:
                if (count($args) == 2) {
                    if (in_array($args[1], $ignore_list) == False) {
                        write_out_buffer_command($items, "ignore");
                        privmsg($items["destination"], $items["nick"], get_bot_nick() . " set to ignore " . $args[1]);
                        $ignore_list[] = $args[1];
                        if (file_put_contents(IGNORE_FILE, implode("\n", $ignore_list)) === False) {
                            privmsg($items["destination"], $items["nick"], "error saving ignore file");
                        }
                    }
                } else {
                    privmsg($items["destination"], $items["nick"], "syntax: " . ALIAS_ADMIN_IGNORE . " <nick>");
                }
                break;
            case ALIAS_ADMIN_UNIGNORE:
                if (count($args) == 2) {
                    if (in_array($args[1], $ignore_list) == True) {
                        $i = array_search($args[1], $ignore_list);
                        if ($i !== False) {
                            write_out_buffer_command($items, "unignore");
                            privmsg($items["destination"], $items["nick"], get_bot_nick() . " set to listen to " . $args[1]);
                            unset($ignore_list[$i]);
                            $ignore_list = array_values($ignore_list);
                            if (file_put_contents(IGNORE_FILE, implode("\n", $ignore_list)) === False) {
                                privmsg($items["destination"], $items["nick"], "error saving ignore file");
                            }
                        } else {
                            privmsg($items["destination"], $items["nick"], $args[1] . " not found in " . get_bot_nick() . " ignore list");
                        }
                    }
                } else {
                    privmsg($items["destination"], $items["nick"], "syntax: " . ALIAS_ADMIN_UNIGNORE . " <nick>");
                }
                break;
            case ALIAS_ADMIN_LIST_IGNORE:
                if (count($ignore_list) > 0) {
                    write_out_buffer_command($items, "ignorelist");
                    privmsg($items["destination"], $items["nick"], get_bot_nick() . " ignore list: " . implode(", ", $ignore_list));
                } else {
                    privmsg($items["destination"], $items["nick"], get_bot_nick() . " isn't ignoring anyone");
                }
                break;
            case ALIAS_ADMIN_REHASH:
                if (count($args) == 1) {
                    if (exec_load() === False) {
                        privmsg($items["destination"], $items["nick"], "error reloading exec file");
                        doquit();
                    } else {
                        write_out_buffer_command($items, "rehash");
                        process_exec_helps();
                        process_exec_inits();
                        process_exec_startups();
                        $users = get_users();
                        foreach ($users[get_bot_nick()]["channels"] as $channel => $timestamp) {
                            rawmsg("NAMES {$channel}");
                        }
                        privmsg($items["destination"], $items["nick"], "successfully reloaded exec file (" . count($exec_list) . " aliases)");
                    }
                }
                break;
            case ALIAS_ADMIN_BUCKETS_DUMP:
                if (count($args) == 1) {
                    write_out_buffer_command($items, "buckets_dump");
                    buckets_dump($items);
                }
                break;
            case ALIAS_ADMIN_BUCKETS_SAVE:
                if (count($args) == 1) {
                    write_out_buffer_command($items, "buckets_save");
                    buckets_save($items);
                }
                break;
            case ALIAS_ADMIN_BUCKETS_LOAD:
                if (count($args) == 1) {
                    write_out_buffer_command($items, "buckets_load");
                    buckets_load($items);
                }
                break;
            case ALIAS_ADMIN_BUCKETS_FLUSH:
                if (count($args) == 1) {
                    write_out_buffer_command($items, "buckets_flush");
                    buckets_flush($items);
                }
                break;
            case ALIAS_ADMIN_BUCKETS_LIST:
                if (count($args) == 1) {
                    write_out_buffer_command($items, "buckets_list");
                    buckets_list($items);
                }
                break;
            case ALIAS_INTERNAL_RESTART:
                if (count($args) == 1 and $items["cmd"] == CMD_INTERNAL) {
                    define("RESTART", True);
                    process_scripts($items, ALIAS_QUIT);
                }
                break;
            case ALIAS_ADMIN_RESTART:
                if (count($args) == 1) {
                    write_out_buffer_command($items, "restart");
                    define("RESTART", True);
                    process_scripts($items, ALIAS_QUIT);
                }
                break;
            case ALIAS_ADMIN_EXEC_CONFLICTS:
                if (count($args) == 1) {
                    # TODO
                    # $admin_aliases $reserved_aliases
                }
                break;
            case ALIAS_ADMIN_EXEC_LIST:
                if (count($args) == 1) {
                    # TODO
                }
                break;
            case ALIAS_ADMIN_EXEC_TIMERS:
                if (count($args) == 1) {
                    # TODO
                }
                break;
            case ALIAS_ADMIN_EXEC_ERRORS:
                if (count($args) == 1) {
                    $n = count($exec_errors);
                    if ($n > 0) {
                        write_out_buffer_command($items, "exec_load_errors");
                        privmsg($items["destination"], $items["nick"], "exec load errors:");
                        $i = 0;
                        foreach ($exec_errors as $filename => $messages) {
                            if ($i == $n - 1) {
                                privmsg($items["destination"], $items["nick"], "  └─" . $filename);
                                for ($j = 0; $j < count($messages); $j++) {
                                    if ($j == count($messages) - 1) {
                                        privmsg($items["destination"], $items["nick"], "     └─" . $messages[$j]);
                                    } else {
                                        privmsg($items["destination"], $items["nick"], "     ├─" . $messages[$j]);
                                    }
                                }
                            } else {
                                privmsg($items["destination"], $items["nick"], "  ├─" . $filename);
                                for ($j = 0; $j < count($messages); $j++) {
                                    if ($j == count($messages) - 1) {
                                        privmsg($items["destination"], $items["nick"], "  │  └─" . $messages[$j]);
                                    } else {
                                        privmsg($items["destination"], $items["nick"], "  │  ├─" . $messages[$j]);
                                    }
                                }
                            }
                            $i++;
                        }
                    } else {
                        privmsg($items["destination"], $items["nick"], "no errors");
                    }
                }
                break;
            default:
                process_scripts($items, "");
                # execute scripts occurring for a specific alias
                process_scripts($items, ALIAS_ALL);
                # process scripts occuring for every line (* alias)
        }
    }
}
コード例 #9
0
ファイル: functions.php プロジェクト: baltincsoft/VarnerCC
function get_row_info($tab_name, $col, $row_id, &$row, $show_err = 1)
{
    global $conni;
    $SQL = "SELECT * FROM {$tab_name} where {$col}='{$row_id}'";
    #    print $SQL."<br>";
    $rs = mysqli_query($SQL) or die($SQL);
    if (mysqli_error($conni) != '') {
        error_page(mysqli_error($conni), "Database Error");
        die;
    }
    if (mysqli_num_rows($rs) == 0 and $show_err == 1) {
        kill("Invalid Row id Id#{$row_id} for table {$tab_name}");
    }
    $row = mysqli_fetch_assoc($rs);
    return mysqli_num_rows($rs);
}
コード例 #10
0
<?php

$skip_login = true;
require_once 'functions.php';
$id = (int) $_GET['id'];
if (!$id) {
    kill("Invalid link opened");
}
$hash = $_GET['hash'];
$gethash = $_GET['hash'];
$info = $db->query("SELECT * FROM people WHERE id = {$id}");
$hash = encrypt($id . $info->email);
if ($hash != $gethash) {
    die("Sorry, this link is invalid. Please click the link in your e-mail. If this does not work, contact us at info@openstreets.co.za.");
} else {
    logThis(12, $id);
    $db->query("UPDATE people SET active = 1 WHERE id = {$id} LIMIT 1");
    $date = date("r");
    $message = "A new user signed up for the mailing list and was registered in the database.\n\nName: {$info->firstname} {$info->lastname}\nE-mail: {$info->email}\nDate: {$date}\n\nMore details:\n" . URL . "people/{$id}";
    $headers = 'From: noreply@friends.openstreets.co.za' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
    mail("*****@*****.**", "Open Streets Subscription", $message, $headers);
}
?>
<!doctype html>
<html>
<head>
<title>Newsletter subscription | Friends of Open Streets</title>
<?php 
echo $head;
?>
<style type="text/css">
コード例 #11
0
ファイル: connection_handler.php プロジェクト: laiello/zircd
                        $names .= $chars . $user['nick'] . ' ';
                    }
                }
                send($me, ':' . $config['name'] . ' 353 ' . $me['nick'] . ' = ' . $target . ' :' . $names);
                send($me, ':' . $config['name'] . ' 366 ' . $me['nick'] . ' ' . $target . ' :End of /NAMES list.');
                break;
            case 'ping':
                // PONG DAMNIT!
                if (strpos($args[1], ':') === false) {
                    $args[1] = ':' . $args[1];
                }
                send($me, ':' . $config['name'] . ' PONG ' . $config['name'] . ' ' . $args[1]);
                break;
                // tabbing jumps
        }
        // select
    }
    // while
    // closed?
    $error = socket_last_error($me['sock']);
    //echo $error;
    if ($error == 10053 || $error == 10054 || $error === false) {
        // he failed.
        echo $me['nick'] . " has died.\r\n";
        kill($me, 'Something failed...');
        array_removal($me, $conn);
    }
}
// foreach
sleep(1);
// 100% CPU ftl
コード例 #12
0
<?php

#consumes 2 list files and tries downloading missing files over http, could also be some scp command injected via shell_exec or directly bash script
$basepath = '/home/devsite/';
#base local path
#find $basepath/media > media.prod.list;#1
$prodlist = $basepath . 'media.prod.list';
#find $basepath/media -type f > medias.list;#2
$devlist = $basepath . 'medias.list';
$distantDomain = 'http://productionwebsite.com/';
/**********************************************/
new fun();
pretitle(1);
#assumes : +ob_start();
if (!is_file($prodlist) or !is_file($devlist)) {
    kill("missing parameters");
}
$copied = [];
$lf = __FILE__ . '.log';
$a = explode("\n", fgc($prodlist));
$b = explode("\n", fgc($devlist));
$missing = array_diff($a, $b);
$c = ['a' => count($a), 'b' => count($b), 'missing' => count($missing)];
out($c, $lf);
foreach ($missing as $url) {
    if (strpos($url, '.') === FALSE) {
        continue;
    }
    $targetFile = $basepath . $url;
    #str_replace(' ','%20',$url);
    if (is_file($targetFile)) {
コード例 #13
0
ファイル: fun.php プロジェクト: Ben749/racetrack
function lockfile($f)
{
    global $unlinks;
    if (substr($f, 0, 1) != '/') {
        $cwd = getcwd();
        $f = $cwd . '/' . $f;
    }
    #from the script for reference
    if (is_file($f)) {
        kill("locked {$f}");
    }
    touch($f);
    $unlinks[] = $f;
}
コード例 #14
0
<?php

include 'php/autoload.php';
function kill()
{
    $GLOBALS['db']->close();
    die;
}
if (!$isLoggedIn) {
    kill(';failed-not-logged-in');
}
if (is_null($me->getAdmin()) || !$me->getAdmin()->canMakeAdmin()) {
    kill(';failed-insufficient-permissions');
}
$action = $_GET['action'];
if ($action == 'delete') {
    $id = $_GET['id'];
    kill($db->query('DELETE FROM Admins WHERE userId = ?', array($id), array(SQLITE3_TEXT)));
} elseif ($action == 'recruit') {
    $username = $_GET['username'];
    $id = $db->scalar('SELECT userId FROM Users WHERE username = ?', array($username), array(SQLITE3_TEXT));
    if ($id === false) {
        kill(';failed-user-doesnt-exist');
    } else {
        $canReview = $_GET['canReview'] == 'y';
        $canMakeAdmin = $_GET['canMakeAdmin'] == 'y';
        kill($db->addAdmin($id, $canReview, $canMakeAdmin));
    }
}
コード例 #15
0
ファイル: testes.php プロジェクト: hmschreiner/PHPUtils
<?php

require 'vendor/autoload.php';
$sSql = "SELECT * FROM testes.teste inner join  coisa.neh on teste.codigo = neh.codigo where teste.xoxo = 1 and teste.xoxb is true;";
$oObjeto = new StdClass();
$oObjeto->aArray = array(1, 2, 3, 4, 5, "6", array(7));
$oObjeto->backtrace = debug_backtrace();
\PHP\Utils::dump_sql($sSql);
\PHP\Utils::dump($sSql, $oObjeto);
dump_sql($sSql);
dump($sSql, $oObjeto);
kill($sSql, $oObjeto);
\PHP\Utils::kill($sSql, $oObjeto);
echo "Não deve aparecer";
コード例 #16
0
ファイル: kill.php プロジェクト: Adeptx/adeptx_core
<?
	return kill($argv, $argc);

	function kill($argv, $argc) {
		$cloud_id = $argv[1];
		if (isset($argv['i'])) {
			$cloud_id = $argv['i'];
		}
		if (isset($argv['id'])) {
			$cloud_id = $argv['id'];
		}

		if (empty($cloud_id)) {
			throw new Exception("Укажите ID процесса, который вы хотите остановить", 3495);
		}

		echo '<div class="last-answer"></div><script>cloude_close(' . $cloud_id . '); $(".last-answer").last().text("Остановлен процесс #" + ' . $cloud_id . ');</script>';
	}
コード例 #17
0
 function onPost($postData, FormSubmit $sender)
 {
     kill($this->testBox);
 }
コード例 #18
0
ファイル: combat.func.php プロジェクト: jiangtiandao/phpdts
function combat($active = 1, $wep_kind = '')
{
    global $log, $mode, $main, $cmd, $battle_title, $db, $tablepre, $pls, $message, $now, $w_log, $nosta, $hdamage, $hplayer;
    global $pid, $name, $club, $inf, $lvl, $exp, $killnum, $bid, $tactic, $pose, $hp, $mhp;
    global $wep, $wepk, $wepe, $weps, $wepsk;
    global $edata, $w_pid, $w_name, $w_pass, $w_type, $w_endtime, $w_deathtime, $w_gd, $w_sNo, $w_icon, $w_club, $w_hp, $w_mhp, $w_sp, $w_msp, $w_att, $w_def, $w_pls, $w_lvl, $w_exp, $w_money, $w_bid, $w_inf, $w_rage, $w_pose, $w_tactic, $w_killnum, $w_state, $w_wp, $w_wk, $w_wg, $w_wc, $w_wd, $w_wf, $w_teamID, $w_teamPass;
    global $w_wep, $w_wepk, $w_wepe, $w_weps, $w_arb, $w_arbk, $w_arbe, $w_arbs, $w_arh, $w_arhk, $w_arhe, $w_arhs, $w_ara, $w_arak, $w_arae, $w_aras, $w_arf, $w_arfk, $w_arfe, $w_arfs, $w_art, $w_artk, $w_arte, $w_arts, $w_itm0, $w_itmk0, $w_itme0, $w_itms0, $w_itm1, $w_itmk1, $w_itme1, $w_itms1, $w_itm2, $w_itmk2, $w_itme2, $w_itms2, $w_itm3, $w_itmk3, $w_itme3, $w_itms3, $w_itm4, $w_itmk4, $w_itme4, $w_itms4, $w_itm5, $w_itmk5, $w_itme5, $w_itms5, $w_itm6, $w_itmk6, $w_itme6, $w_itms6, $w_wepsk, $w_arbsk, $w_arhsk, $w_arask, $w_arfsk, $w_artsk, $w_itmsk0, $w_itmsk1, $w_itmsk2, $w_itmsk3, $w_itmsk4, $w_itmsk5, $w_itmsk6;
    global $infinfo, $w_combat_inf;
    global $rp, $w_rp, $action, $w_action, $achievement, $w_achievement, $skills, $w_skills, $skillpoint, $w_skillpoint;
    $battle_title = '战斗发生';
    if (!$wep_kind) {
        $w1 = substr($wepk, 1, 1);
        $w2 = substr($wepk, 2, 1);
        if (($w1 == 'G' || $w1 == 'J') && $weps == $nosta) {
            $wep_kind = $w2 ? $w2 : 'P';
        } else {
            $wep_kind = $w1;
        }
    } elseif (strpos($wepk, $wep_kind) === false && $wep_kind != 'back') {
        $wep_kind = substr($wepk, 1, 1);
    }
    $wep_temp = $wep;
    include_once GAME_ROOT . './include/game/clubskills.func.php';
    if ($active) {
        if ($wep_kind == 'back') {
            $log .= "你逃跑了。";
            $action = '';
            $mode = 'command';
            return;
        }
        $enemyid = $active ? str_replace('enemy', '', $action) : $bid;
        if (!$enemyid || strpos($action, 'enemy') === false) {
            $log .= "<span class=\"yellow\">你没有遇到敌人,或已经离开战场!</span><br>";
            $action = '';
            $mode = 'command';
            return;
        }
        $result = $db->query("SELECT * FROM {$tablepre}players WHERE pid='{$enemyid}'");
        if (!$db->num_rows($result)) {
            $log .= "对方不存在!<br>";
            $action = '';
            $mode = 'command';
            return;
        }
        $edata = $db->fetch_array($result);
        if ($edata['pls'] != $pls) {
            $log .= "<span class=\"yellow\">" . $edata['name'] . "</span>已经离开了<span class=\"yellow\">{$plsinfo[$pls]}</span>。<br>";
            $action = '';
            $mode = 'command';
            return;
        } elseif ($edata['hp'] <= 0) {
            global $corpseprotect, $gamestate;
            $log .= "<span class=\"red\">" . $edata['name'] . "</span>已经死亡,不能被攻击。<br>";
            if ($edata['endtime'] < $now - $corpseprotect && $gamestate < 40) {
                $action = 'corpse' . $edata['pid'];
                include_once GAME_ROOT . './include/game/battle.func.php';
                findcorpse($edata);
            }
            //$action = '';
            return;
        }
        if ($message) {
            //			foreach ( Array('<','>',';',',') as $value ) {
            //				if(strpos($message,$value)!==false){
            //					$message = str_replace ( $value, '', $message );
            //				}
            //			}
            $log .= "<span class=\"lime\">你对{$edata['name']}大喊:{$message}</span><br>";
            if (!$edata['type']) {
                $w_log = "<span class=\"lime\">{$name}对你大喊:{$message}</span><br>";
                logsave($edata['pid'], $now, $w_log, 'c');
            }
        }
        extract($edata, EXTR_PREFIX_ALL, 'w');
        init_battle(1);
        include_once GAME_ROOT . './include/game/attr.func.php';
        $log .= "你向<span class=\"red\">{$w_name}</span>发起了攻击!<br>";
        $att_dmg = attack($wep_kind, 1);
        global $ggflag;
        if ($ggflag) {
            return;
        }
        $w_hp -= $att_dmg;
        if ($w_hp > 0 && $w_tactic != 4 && $w_pose != 5) {
            global $rangeinfo;
            $w_w1 = substr($w_wepk, 1, 1);
            $w_w2 = substr($w_wepk, 2, 1);
            if (($w_w1 == 'G' || $w_w1 == 'J') && $w_weps == $nosta) {
                $w_wep_kind = $w_w2 ? $w_w2 : 'P';
            } else {
                $w_wep_kind = $w_w1;
            }
            //if (($rangeinfo [$wep_kind] == $rangeinfo [$w_wep_kind]) || ($rangeinfo [$w_wep_kind] == 'M')) {
            if ($rangeinfo[$wep_kind] <= $rangeinfo[$w_wep_kind] && $rangeinfo[$wep_kind] !== 0) {
                $counter = get_counter($w_wep_kind, $w_tactic, $w_club, $w_inf);
                $counter *= get_clubskill_bonus_counter($w_club, $w_skills, 'w_', $club, $skills, '');
                $counter_dice = rand(0, 99);
                if ($counter_dice < $counter) {
                    $log .= "<span class=\"red\">{$w_name}的反击!</span><br>";
                    $log .= npc_chat($w_type, $w_name, 'defend');
                    $def_dmg = defend($w_wep_kind);
                } else {
                    $log .= npc_chat($w_type, $w_name, 'escape');
                    $log .= "<span class=\"red\">{$w_name}处于无法反击的状态,逃跑了!</span><br>";
                }
            } else {
                $log .= npc_chat($w_type, $w_name, 'cannot');
                $log .= "<span class=\"red\">{$w_name}攻击范围不足,不能反击,逃跑了!</span><br>";
            }
        } elseif ($w_hp > 0) {
            $log .= "<span class=\"red\">{$w_name}逃跑了!</span><br>";
        }
    } else {
        $result = $db->query("SELECT * FROM {$tablepre}players WHERE pid='{$bid}'");
        $edata = $db->fetch_array($result);
        extract($edata, EXTR_PREFIX_ALL, 'w');
        init_battle(1);
        include_once GAME_ROOT . './include/game/attr.func.php';
        $log .= "<span class=\"red\">{$w_name}</span>突然向你袭来!<br>";
        $log .= npc_chat($w_type, $w_name, 'attack');
        npc_changewep();
        $w_w1 = substr($w_wepk, 1, 1);
        $w_w2 = substr($w_wepk, 2, 1);
        if (($w_w1 == 'G' || $w_w1 == 'J') && $w_weps == $nosta) {
            $w_wep_kind = $w_w2 ? $w_w2 : 'P';
        } else {
            $w_wep_kind = $w_w1;
        }
        $def_dmg = defend($w_wep_kind, 1);
        if ($hp > 0 && $tactic != 4 && $pose != 5) {
            global $rangeinfo;
            if ($rangeinfo[$wep_kind] >= $rangeinfo[$w_wep_kind] && $rangeinfo[$w_wep_kind] !== 0) {
                $counter = get_counter($wep_kind, $tactic, $club, $inf);
                $counter *= get_clubskill_bonus_counter($club, $skills, '', $w_club, $w_skills, 'w_');
                $counter_dice = rand(0, 99);
                if ($counter_dice < $counter) {
                    $log .= "<span class=\"red\">你的反击!</span><br>";
                    $wep_kind = substr($wepk, 1, 1);
                    $att_dmg = attack($wep_kind);
                    $w_hp -= $att_dmg;
                } else {
                    $log .= "<span class=\"red\">你处于无法反击的状态,逃跑了!</span><br>";
                }
            } else {
                $log .= "<span class=\"red\">你攻击范围不足,不能反击,逃跑了!</span><br>";
            }
        } elseif ($hp > 0) {
            $log .= "<span class=\"red\">你逃跑了!</span><br>";
        }
    }
    if ($hp == 0 && !$w_action) {
        $w_action = 'pacorpse' . $pid;
    }
    w_save($w_pid);
    $att_dmg = $att_dmg ? $att_dmg : 0;
    $def_dmg = $def_dmg ? $def_dmg : 0;
    if (!$w_type) {
        $w_inf_log = '';
        if ($w_combat_inf) {
            global $exdmginf;
            foreach ($exdmginf as $inf_ky => $w_inf_words) {
                if (strpos($w_combat_inf, $inf_ky) !== false) {
                    $w_inf_log .= "敌人的攻击造成你{$w_inf_words}了!<br>";
                }
            }
        }
        if ($active) {
            $w_log = "手持<span class=\"red\">{$wep_temp}</span>的<span class=\"yellow\">{$name}</span>向你袭击!<br>你受到其<span class=\"yellow\">{$att_dmg}</span>点攻击,对其做出了<span class=\"yellow\">{$def_dmg}</span>点反击。<br>{$w_inf_log}";
        } else {
            $w_log = "你发现了手持<span class=\"red\">{$wep_temp}</span>的<span class=\"yellow\">{$name}</span>并且先发制人!<br>你对其做出<span class=\"yellow\">{$def_dmg}</span>点攻击,受到其<span class=\"yellow\">{$att_dmg}</span>点反击。<br>{$w_inf_log}";
        }
        if ($hp == 0) {
            $w_log .= "<span class=\"yellow\">{$name}</span><span class=\"red\">被你杀死了!</span><br>";
            //include_once GAME_ROOT.'./include/game/achievement.func.php';
            //check_battle_achievement($w_achievement,$w_type,$name);
        }
        logsave($w_pid, $now, $w_log, 'b');
    }
    if ($att_dmg > $hdamage && $att_dmg >= $def_dmg) {
        $hdamage = $att_dmg;
        $hplayer = $name;
        save_combatinfo();
    } elseif ($def_dmg > $hdamage && !$w_type) {
        $hdamage = $def_dmg;
        $hplayer = $w_name;
        save_combatinfo();
    }
    //$bid = $w_pid;
    if ($w_hp <= 0 && $w_club != 99) {
        $w_bid = $pid;
        $w_hp = 0;
        if ($w_type == 0) {
            $killnum++;
        }
        include_once GAME_ROOT . './include/state.func.php';
        $killmsg = kill($wep_kind, $w_name, $w_type, $w_pid, $wep_temp);
        $log .= npc_chat($w_type, $w_name, 'death');
        include_once GAME_ROOT . './include/game/achievement.func.php';
        check_battle_achievement($name, $w_type, $w_name, $wep_temp);
        $log .= "<span class=\"red\">{$w_name}被你杀死了!</span><br>";
        //$rp = $rp + 20 ;
        if (!$w_type) {
            $rpup = $w_rp;
        } else {
            $rpup = 20;
        }
        if ($club == 19) {
            $rpdec = 30;
            $rpdec += get_clubskill_rp_dec($club, $skills);
            $rp += round($rpup * (100 - $rpdec) / 100);
        } else {
            $rp += $rpup;
        }
        if ($killmsg) {
            $log .= "<span class=\"yellow\">你对{$w_name}说:“{$killmsg}”</span><br>";
        }
        include_once GAME_ROOT . './include/game/battle.func.php';
        $result = $db->query("SELECT * FROM {$tablepre}players WHERE pid='{$w_pid}'");
        $cdata = $db->fetch_array($result);
        $action = 'corpse' . $edata['pid'];
        findcorpse($cdata);
        return;
    } else {
        if ($w_hp <= 0) {
            //有第二阶段
            if ($w_type) {
                $log .= npc_chat($w_type, $w_name, 'death');
                include_once GAME_ROOT . './include/system.func.php';
                $npcdata = evonpc($w_type, $w_name);
                $log .= '<span class="yellow">' . $w_name . '却没死去,反而爆发出真正的实力!</span><br>';
                if ($npcdata) {
                    addnews($now, 'evonpc', $w_name, $npcdata['name'], $name);
                    foreach ($npcdata as $key => $val) {
                        ${'w_' . $key} = $val;
                    }
                }
            } else {
                include_once GAME_ROOT . './include/state.func.php';
                $killmsg = kill($wep_kind, $w_name, $w_type, $w_pid, $wep_temp);
                $log .= '<span class="yellow">' . $w_name . '由于其及时按了BOMB键而原地满血复活了!</span><br>';
            }
        }
        $main = 'battle';
        init_battle(1);
        if (CURSCRIPT !== 'botservice') {
            include template('battleresult');
            //$cmd = '<br><br><input type="hidden" name="mode" value="command"><input type="radio" name="command" id="back" value="back" checked><a onclick=sl("back"); href="javascript:void(0);" >确定</a><br>';
            $cmd = ob_get_contents();
            ob_clean();
            //$bid = $hp <= 0 ? $bid : 0;
        }
        $action = '';
        return;
    }
}
コード例 #19
0
            }
        }
    }
    echo "false";
    kill();
}
//otherwise check for user map ownership with mapid given
/*$table = "maps_bought";
$q=sprintf("SELECT * FROM %s WHERE ign='%s'",
            mysql_real_escape_string($table),
            mysql_real_escape_string($username));
$results = mysql_query($q, $link);*/
$q = sprintf("SELECT * FROM %s WHERE ign='%s'", mysql_real_escape_string($table), mysql_real_escape_string($username));
$results = mysql_query($q, $link);
while ($row = mysql_fetch_array($results)) {
    $ids = split(",", $row[2]);
    //print_r($ids);
    for ($i = 0; $i < count($ids); $i++) {
        if ($ids[$i] == $mapid || $ids[$i] == -1) {
            echo "true";
            kill();
        }
    }
}
echo "false";
function kill()
{
    global $link;
    mysql_close($link);
    die;
}
コード例 #20
0
<?php

/**
 *
 *  ____            _        _   __  __ _                  __  __ ____  
 * |  _ \ ___   ___| | _____| |_|  \/  (_)_ __   ___      |  \/  |  _ \ 
 * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
 * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ 
 * |_|   \___/ \___|_|\_\___|\__|_|  |_|_|_| |_|\___|     |_|  |_|_| 
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * @author PocketMine Team
 * @link http://www.pocketmine.net/
 * 
 *
*/
/***REM_START***/
require_once dirname(__FILE__) . "/src/config.php";
require_once FILE_PATH . "/src/functions.php";
require_once FILE_PATH . "/src/dependencies.php";
/***REM_END***/
$server = new ServerAPI();
$server->start();
kill(getmypid());
//Fix for ConsoleAPI being blocked
exit(0);
コード例 #21
0
<?php

$skip_login = true;
require_once 'functions.php';
$list = $db->query("SELECT * FROM mailinglist_options WHERE active = 1 ORDER BY name");
if ($_GET['retry']) {
    $id = (int) $_GET['id'];
    $gethash = $_GET['hash'];
    $info = $db->query("SELECT * FROM people WHERE id = {$id}");
    $hash = encrypt($id . $info->email);
    if ($hash != $gethash) {
        kill("Hash is invalid");
    }
    require_once 'mailchimp.php';
    $MailChimp = new \Drewm\MailChimp(MAILCHIMP_API_KEY);
    $return = $MailChimp->call('lists/subscribe', array('id' => MAILCHIMP_LIST, 'email' => array('email' => $info->email)));
    if ($return['status'] == 'error') {
        $error = "Sorry, there was a problem confirming your registration. Please contact info@openstreets.co.za";
    }
    $print = "Confirmation mail was sent. Please check your e-mail in a few minutes to confirm your account";
}
if (trim($_POST['email'])) {
    $email = mysql_clean(trim($_POST['email']));
    $user = $db->query("SELECT * FROM people WHERE email = {$email} LIMIT 1");
    if ($user->num_rows) {
        $id = $user->id;
        $check = $db->query("SELECT * FROM people_mailinglists WHERE id = {$id}");
    }
    if (!check_mail($_POST['email'])) {
        $error = "Sorry, you did not provide a valid e-mail address. <a href='javascript:history.back(1)'>Click here to go back.</a>";
    } elseif (!is_array($_POST['list'])) {
コード例 #22
0
//  AcmlmBoard XD Plugin - User badges management tool
//  Access: administrators only
//  Based on ipbans.php
$title = __("User Badges Manager");
assertForbidden("editUserBadges");
if ($loguser['powerlevel'] < 3) {
    kill(__("You're not an administrator. There is nothing for you here."));
}
$crumbs = new PipeMenu();
$crumbs->add(new PipeMenuLinkEntry(__("Admin"), "admin"));
$crumbs->add(new PipeMenuLinkEntry(__("User Badges Manager"), "userbadges"));
makeBreadcrumbs($crumbs);
if ($_POST['action'] == __("Add")) {
    if ($_POST['color'] == -1 || empty($_POST['userid']) || empty($_POST['name'])) {
        kill(__("Please review your settings before adding a user badge."));
    } else {
        query("insert into {badges} values ({0}, {1}, {2})", (int) $_POST['userid'], $_POST['name'], (int) $_POST['color']);
        alert(__("Added."), __("Notice"));
    }
} elseif ($_GET['action'] == "delete") {
    query("delete from {badges} where owner = {0} and name = {1}", (int) $_GET['userid'], $_GET['name']);
    alert(__("Removed."), __("Notice"));
} elseif ($_GET['action'] == "deleteall") {
    query("delete from {badges} where owner = {0}", (int) $_GET['userid']);
    alert(__("Removed all badges of the user."), __("Notice"));
} elseif ($_GET['action'] == "newbadge") {
    $userID = "value=\"" . (int) $_GET['userid'] . "\"";
}
// Fetch badges
$qBadge = "SELECT owner, {badges}.name, {badges}.color, {users}.name username, {users}.sex sex, {users}.powerlevel powerlevel FROM {badges} JOIN {users} where owner = id";
コード例 #23
0
                 kill($unrarpid);
                 echo 'File has already been extracted, please delete extracted file if re-extraction is necessary.';
                 break 2;
             }
             if (strpos($chkline, 'Cannot find volume') !== FALSE) {
                 kill($unrarpid);
                 echo 'File has a missing volume and can not been extracted.';
                 break 2;
             }
             if (strpos($chkline, 'ERROR: Bad archive') !== FALSE) {
                 kill($unrarpid);
                 echo 'File has a bad volume and can not been extracted.';
                 break 2;
             }
             if (strpos($chkline, 'CRC failed') !== FALSE) {
                 kill($unrarpid);
                 echo 'File extraction has failed with a CRC error and was not been extracted.';
                 break 2;
             }
         }
     }
 }
 if (file_exists($arg2 . $logfile)) {
     $lines = file($arg2 . $logfile);
     foreach ($lines as $chkline) {
         if (strpos($chkline, 'All OK') !== FALSE) {
             echo 'File has successfully been extracted!';
             if (file_exists($arg2 . $logfile)) {
                 del($arg2 . $logfile);
             }
         }
コード例 #24
0
function unrarFile($downloadDir, $filename, $name, $password = "******")
{
    global $logfile, $cfg;
    $unrar = $cfg['bin_unrar'];
    $log = $downloadDir . $logfile;
    if (file_exists($log)) {
        @unlink($log);
    }
    if ($downloadDir . '/' . $filename === $downloadDir . '/' . $name) {
        $destdir = $downloadDir . '/' . str_replace('.rar', '', $name);
    } else {
        $destdir = $downloadDir . '/' . $name;
    }
    $Command = tfb_shellencode($unrar) . " x -o+ -p" . tfb_shellencode($password) . " " . tfb_shellencode($downloadDir . '/' . $filename) . " " . tfb_shellencode($destdir);
    $unrarpid = trim(shell_exec("nohup " . $Command . " > " . tfb_shellencode($log) . " 2>&1 & echo \$!"));
    echo 'Uncompressing file...<BR>PID is: ' . $unrarpid . '<BR>';
    usleep(250000);
    // wait for 0.25 seconds
    while (is_running($unrarpid)) {
        if (file_exists($log)) {
            $lines = file($log);
            foreach ($lines as $chkline) {
                if (strpos($chkline, 'already exists. Overwrite it ?') !== FALSE) {
                    kill($unrarpid);
                    debug('File has already been extracted, please delete extracted file if re-extraction is necessary.');
                    break 2;
                }
                if (strpos($chkline, 'Cannot find volume') !== FALSE) {
                    kill($unrarpid);
                    debug('File has a missing volume and can not been extracted.');
                    break 2;
                }
                if (strpos($chkline, 'ERROR: Bad archive') !== FALSE) {
                    kill($unrarpid);
                    debug('File has a bad volume and can not been extracted.');
                    break 2;
                }
                if (strpos($chkline, 'CRC failed') !== FALSE) {
                    kill($unrarpid);
                    debug('File extraction has failed with a CRC error and was not been extracted.');
                    break 2;
                }
            }
        }
        usleep(250000);
        // wait for 0.25 seconds
    }
    if (file_exists($log)) {
        $lines = file($log);
        foreach ($lines as $chkline) {
            if (strpos($chkline, 'All OK') !== FALSE) {
                debug('File has successfully been extracted!');
                @unlink($log);
                return;
            }
        }
    }
}
コード例 #25
0
 function query($query, $print = false, $action = false)
 {
     if ($query) {
         $result = $this->connection->query($query) or $action == "mailerror" ? mail(SYSADMIN, "MySQL Query Error", mysqli_error($this->connection) . "\n\n" . getinfo(), "From: " . EMAIL) : kill("Query:\n{$query}\n\nError:\n" . mysqli_error($this->connection) . "\n\n", "mysql");
         $this->insert_id = $this->connection->insert_id;
         $this->affected_rows = $this->connection->affected_rows;
         if ($print && LOCAL && defined("LOCAL")) {
             echo "<div style='\n\t\t\tbackground:#333; \n\t\t\tborder:2px solid #fff;\n\t\t\tpadding:5px; \n\t\t\tposition:fixed;\n\t\t\tfont-weight:bold;                  \n\t\t\ttop:0;\n\t\t\tcolor:#fff;\n\t\t\twidth:100%;\n\t\t\tleft:0;\n\t\t\tz-index:100000;\n\t\t\t'>\n\t\t\t\t{$query}\n\t\t\t  </div>";
         }
         return new DB_Result($result);
     } else {
         trigger_error("Function query(): The query is empty smart*ss. ", E_USER_ERROR);
     }
 }
コード例 #26
0
<?php

if ($loguser["powerlevel"] < 3) {
    kill("You must be an admin");
}
$uid = (int) $_GET["id"];
$user = fetch(query("select * from {users} where id={0}", $uid));
if (!$user) {
    kill("User not found");
}
if ($user["powerlevel"] > 0) {
    kill("You can't nuke a staff member. Demote him first.");
}
$passwordFailed = false;
if (isset($_POST["currpassword"])) {
    $sha = doHash($_POST["currpassword"] . $salt . $loguser['pss']);
    if ($loguser['password'] == $sha) {
        //Delete posts from threads by user
        query("delete pt from {posts_text} pt\n\t\t\t\tleft join {posts} p on pt.pid = p.id\n\t\t\t\tleft join {threads} t on p.thread = t.id\n\t\t\t\twhere t.user={0}", $uid);
        query("delete p from {posts} p\n\t\t\t\tleft join {threads} t on p.thread = t.id\n\t\t\t\twhere t.user={0}", $uid);
        //Delete posts by user
        query("delete pt from {posts_text} pt\n\t\t\t\tleft join {posts} p on pt.pid = p.id\n\t\t\t\twhere p.user={0}", $uid);
        query("delete p from {posts} p\n\t\t\t\twhere p.user={0}", $uid);
        //Delete threads by user
        query("delete t from {threads} t\n\t\t\t\twhere t.user={0}", $uid);
        //Delete usercomments by user or to user
        query("delete from {usercomments}\n\t\t\t\twhere uid={0} or cid={0}", $uid);
        //Delete THE USER ITSELF
        query("delete from {users}\n\t\t\t\twhere id={0}", $uid);
        //and then IP BAN HIM
        query("insert into {ipbans} (ip, reason, date) \n\t\t\t\tvalues ({0}, {1}, 0)\n\t\t\t\ton duplicate key update ip=ip", $user["lastip"], "Nuking " . $user["name"]);