$ini = strpos($string, $start);
    if ($ini == 0) {
        return "";
    }
    $ini += strlen($start);
    $len = strpos($string, $end, $ini) - $ini;
    return substr($string, $ini, $len);
}
$get_aps = "/usr/local/psa/bin/aps -gp ";
$output = shell_exec($get_aps);
$outputs = explode('================================', $output);
$apps = array();
if (!empty($outputs)) {
    foreach ($outputs as $ap) {
        $app_id = intval(string_between($ap, "ID:", "\n"));
        $app_name = trim(string_between($ap, "Name:", "\n"));
        if ($app_id > 0) {
            $apps[$app_id] = $app_name;
            if (stristr($app_name, 'microweber')) {
                $the_app_id = $app_id;
            }
        }
    }
}
if (!isset($_SERVER['NEW_DOMAIN_NAME'])) {
    return;
}
$cmd_out = '';
$domain = $_SERVER['NEW_DOMAIN_NAME'];
$db_name = str_replace(array('.', '-'), '', $domain);
$db_name = "mw_" . substr($db_name, 0, 8) . rand();
Ejemplo n.º 2
-1
        $page = substr($listinvdata_link->href, strpos($listinvdata_link->href, '?page=') + strlen('?page='));
        array_push($pages, $page);
    }
}
$max_pages = max($pages);
for ($character_pages_counter = 1; $character_pages_counter <= $max_pages; $character_pages_counter++) {
    $listinvdata = file_get_html('http://shardsofdalaya.com/vendorlist/listinvdata.php?page=' . $character_pages_counter, false, $file_get_context);
    echo 'Page: ' . $character_pages_counter . '<br><br>';
    foreach ($listinvdata->find('a') as $listinvdata_link) {
        if (strpos($listinvdata_link->href, 'vendorinv.php?char=') !== false) {
            $character_name = substr($listinvdata_link->href, strpos($listinvdata_link->href, '?char=') + strlen('?char='));
            array_push($character_names, $character_name);
            $dump .= $character_name . "\n";
            echo 'Character: ' . $character_name . '<br>';
            $vendorinv = file_get_html('http://shardsofdalaya.com/vendorlist/vendorinv.php?char=' . $character_name, false, $file_get_context);
            $number_of_items_for_sale = string_between($vendorinv->plaintext, $character_name . ' has ', ' items for sale');
            $number_of_items_per_page = 10;
            $max_item_pages = ceil($number_of_items_for_sale / $number_of_items_per_page);
            if ($number_of_items_for_sale == 0) {
                continue;
            }
            for ($item_pages_counter = 1; $item_pages_counter <= $max_item_pages; $item_pages_counter++) {
                $vendorinv = file_get_html('http://shardsofdalaya.com/vendorlist/vendorinv.php?char=' . $character_name . '&page=' . $item_pages_counter, false, $file_get_context);
                foreach ($vendorinv->find('a') as $vendorinv_link) {
                    if (strpos($vendorinv_link->href, 'items.php?id=') !== false) {
                        $item_name = $vendorinv_link->innertext;
                        $item_name = fix_item_name($item_name);
                        array_push($item_names, $item_name);
                        $dump .= '    ' . $item_name . "\n";
                        $item_image = '';
                        $item_tags = '';