Beispiel #1
0
function start_chaos($tur)
{
    global $char;
    //все места заняты - начинаем бой
    //создаем бой
    $combat_type = 11;
    $uid = create_combat($combat_type, $char['map_name'], $char['map_xpos'], $char['map_ypos'], $tur['format']);
    //закидываем туда игроков рандомно
    $sel_users = myquery("SELECT game_users_active_host.host_more,game_users_active.host,game_turnir_users.side,view_active_users.*,game_users_data.sex FROM game_turnir_users,view_active_users,game_users_data,game_users_active,game_users_active_host WHERE game_users_data.user_id=game_turnir_users.user_id AND game_turnir_users.user_id=view_active_users.user_id AND game_turnir_users.turnir_id=" . $tur['id'] . " AND game_users_active.user_id=view_active_users.user_id AND game_users_active_host.user_id=view_active_users.user_id ORDER BY RAND()");
    $user_side = 2;
    while ($us = mysql_fetch_array($sel_users)) {
        $user_side = 3 - $user_side;
        $hod = 1;
        $join = 0;
        $svit = 0;
        $k_komu = 0;
        $k_exp = 1;
        $k_gp = 0;
        $skill = 0;
        $func = 5;
        $delay = 44;
        $no_rejoin = 1;
        combat_insert($us, 0, $uid, $combat_type, $user_side, $hod, $join, $svit, $k_komu, $k_exp, $k_gp, $skill, $func, $delay, $no_rejoin);
        $pismo = iconv("Windows-1251", "UTF-8//IGNORE", "<span style=\"font-style:italic;font-size:12px;color:gold;\">Начинается турнирный хаотичный бой</span>");
        myquery("INSERT INTO game_log (`message`,`date`,`fromm`,`too`,ptype) VALUES ('" . mysql_real_escape_string($pismo) . "'," . time() . ",-1," . $us['user_id'] . ",1)");
    }
    myquery("DELETE game_turnir,game_turnir_users FROM game_turnir,game_turnir_users WHERE (game_turnir.id=" . $tur['id'] . ") AND (game_turnir.id=game_turnir_users.turnir_id) ");
    setLocation("http://" . domain_name . "/combat.php");
}
function destroy_all($par = "", $loc = "index.php")
{
    if ($loc == "index.php") {
        $loc = "http://" . domain_name . "/index.php?param={$par}";
    }
    mysql_close();
    session_unset();
    unset($_SESSION);
    setcookie("rpgsu_login", 0, time() - 84000000, "/");
    setcookie("rpgsu_pass", 0, time() - 84000000, "/");
    setcookie("rpgsu_sess", 0, time() - 84000000, "/");
    setcookie("rpgsu_admin", 0, time() - 84000000, "/");
    setLocation($loc);
    die;
}
Beispiel #3
0
 public function makeOffersOut($offerin)
 {
     $collection = [];
     $errors = [];
     $infos = [];
     $resellers = [];
     $minStartDelay = Config::get('offerin.delay', 115) * 60;
     $model = lib('model')->getStaticModel((int) $offerin->segment_id);
     $isCalendar = isAke($model, 'is_calendar', true);
     $now = time();
     $isPro = false;
     if (!isset($offerin->sellzone_id)) {
         $offerin->sellzone_id = 1;
         $offerin->save();
     }
     if (isset($offerin->company_id)) {
         $address = Model::Companyaddress()->findOrFail((int) $offerin->address_id);
         $isPro = true;
     } else {
         $address = Model::Accountaddress()->findOrFail((int) $offerin->address_id);
     }
     if (true === $isPro) {
         if (!isset($offerin->company_id)) {
             $offerin->company_id = (int) $address->company_id;
             $offerin = $offerin->save();
         }
     } else {
         if (!isset($offerin->account_id)) {
             $offerin->account_id = (int) $address->account_id;
             $offerin = $offerin->save();
         }
     }
     $locationOffer = lib('utils')->remember('get.location.address.' . $address->id, function ($address) {
         return getLocation($address);
     }, $isPro ? Model::Companyaddress()->getAge() : Model::Accountaddress()->getAge(), [$address]);
     if (empty($locationOffer)) {
         $coords = lib('geo')->getCoords($address->address . ' ' . $address->zip . ' ' . $address->city, 250);
         setLocation($address, $coords['lng'], $coords['lat']);
         $locationOffer = ['lng' => $coords['lng'], 'lat' => $coords['lat']];
     }
     $segment_id = (int) $offerin->segment_id;
     $family = repo('segment')->getFamilyfromItem((int) $segment_id);
     if (!empty($family)) {
         $market = current($family);
         $market_id = (int) $market['id'];
     } else {
         $market_id = $segment_id;
     }
     $offer = $offerin->toArray();
     if (isset($offer['date']) && isset($offer['time'])) {
         list($y, $m, $d) = explode('-', $offer['date'], 3);
         list($h, $i, $s) = explode(':', $offer['time'], 3);
         $start = mktime($h, $i, $s, $m, $d, $y);
     } else {
         $start = $offerin->created_at;
     }
     if ($start < $now) {
         $errors['starttime_error'] = 'Start time [' . date('Y-m-d H:i:s', $start) . '] is before now.';
     }
     $delaySeconds = $start - $now;
     $delai = (double) round($delaySeconds / 3600, 2);
     if ($delaySeconds < $minStartDelay) {
         $errors['delay_incorrect'] = 'The delay is incorrect [' . $delaySeconds . ' seconds]. The delay me be at less egual to ' . $minStartDelay . ' seconds.';
         return ['resellers' => $resellers, 'offers' => $collection, 'errors' => $errors, 'infos' => $infos];
     }
     $langue = $offerin->langue;
     if (!strlen($langue) || empty($langue) || strtolower($langue) == 'non') {
         $langue = false;
     }
     if ($langue) {
         $langues = lib('forms')->getLanguagesFromSegmentId($segment_id);
         if (!in_array($langue, $langues)) {
             $langue = false;
         }
     }
     $this->cleanToPay($offerin->segment_id);
     $products = Model::Productdata()->where(['segment_id', '=', (int) $offerin->segment_id])->where(['sellzone_id', '=', (int) $offerin->sellzone_id])->cursor();
     foreach ($products as $product) {
         $item = [];
         $reseller = Model::Reseller()->model($product['reseller']);
         $company = Model::Company()->model($product['company']);
         // $company    = Model::Company()->where(['reseller_id', '=', (int) $product['reseller_id']])->first(true);
         if ($reseller && $company) {
             // $statusId = (int) lib('status')->getId('reseller', 'REGISTER');
             if (false === $product['status']) {
                 $infos[$reseller->id]['status'] = true;
                 continue;
             }
             $infos[$reseller->id] = [];
             $options = $product['options'];
             $hasAgenda = isAke($options, 'has_agenda', false);
             // $hasAgenda = lib('option')->get('agenda.partage', $reseller, false);
             $item['reseller_calendar'] = $hasAgenda;
             $item['reseller_id'] = $reseller->id;
             $item['segment_id'] = $segment_id;
             if (true === $isPro) {
                 $item['company_id'] = $offer['company_id'];
             } else {
                 $item['account_id'] = $offer['account_id'];
             }
             $locationReseller = lib('utils')->remember('has.locations.companies.' . $product['reseller_id'], function ($reseller_id) {
                 $company = Model::Company()->where(['reseller_id', '=', (int) $reseller_id])->first(true);
                 $coords = lib('geo')->getCoordsMap($company->address . ' ' . $company->zip . ' ' . $company->city);
                 $loc = ['lng' => $coords['lng'], 'lat' => $coords['lat']];
                 return $loc;
             }, Model::Company()->getAge(), [$product['reseller_id']]);
             $quantity = (double) $this->getQuantity($offer);
             /* si une langue est demandée on vérifie si le revendeur la parle, sinon, on passe au suivant */
             if ($langue) {
                 // $speak = lib('option')->get('langue.' . $market_id . '.' . $langue, $reseller, false);
                 $speak = isAke($options['languages'], $langue, false);
                 if (false === $speak) {
                     $infos[$reseller->id]['language'] = true;
                     continue;
                 }
             }
             $distanceMaxOffer = isset($offer['distance_max']) ? (double) $offer['distance_max'] : 0;
             // $distanceMaxReseller    = (double) lib('option')->get('zone.intervention.' . $market_id, $reseller, 0);
             $distanceMaxReseller = (double) isAke($options, 'distance_max', 0);
             $distance = distanceKmMiles($locationOffer['lng'], $locationOffer['lat'], $locationReseller['lng'], $locationReseller['lat']);
             $km = (double) $distance['km'];
             $item['distance'] = $km;
             if (0 < $distanceMaxOffer || 0 < $distanceMaxReseller) {
                 if ($distanceMaxOffer < $km && $distanceMaxOffer > 0) {
                     $infos[$reseller->id]['distance_reseller'] = true;
                     continue;
                 }
                 if ($distanceMaxReseller < $km && $distanceMaxReseller > 0) {
                     $infos[$reseller->id]['distance_buyer'] = true;
                     continue;
                 }
             }
             // $delai_presta = lib('option')->get('delai.intervention.' . $market_id, $reseller, 0);
             $delai_presta = isAke($options, 'delai_min', 0);
             $item['date_max_offer'] = (int) $start - 3600;
             if (0 < $delai_presta) {
                 if ($delai < $delai_presta) {
                     $infos[$reseller->id]['delay_reseller'] = true;
                     continue;
                 } else {
                     $item['date_max_offer'] = (int) $start - $delai_presta * 3600;
                 }
             }
             if ($hasAgenda) {
                 $item['date_max_offer'] = $item['date_max_offer'] > $now + 3600 ? $now + 3600 : $item['date_max_offer'];
             } else {
                 $item['date_max_offer'] = $item['date_max_offer'] > $now + 1800 ? $now + 1800 : $item['date_max_offer'];
             }
             $makePrice = $amount = (double) $this->makePrice($offer, $product['product']);
             $minAmount = isAke($options, 'amount_min', 0);
             if ($minAmount > $amount) {
                 $infos[$reseller->id]['amount_reseller'] = true;
                 continue;
             }
             $tva = isAke($product['product'], 'tva', 1);
             $discount_default_quantity = isAke($product['product'], 'discount_default_quantity', 0);
             $discount_default_amount = (double) isAke($product['product'], 'discount_default_amount', 0);
             $discount_price_quantity = isAke($product['product'], 'discount_price_quantity', 0);
             $discount_price_amount = (double) isAke($product['product'], 'discount_price_amount', 0);
             $fixed_costs_default = (double) isAke($product['product'], 'fixed_costs_default', 0);
             $travel_costs_default = (double) isAke($product['product'], 'travel_costs_default', 0);
             $shipping_costs_default = (double) isAke($product['product'], 'shipping_costs_default', 0);
             $item['fixed_costs'] = $fixed_costs_default;
             $item['travel_costs'] = $travel_costs_default;
             $item['shipping_costs'] = $shipping_costs_default;
             $item['discount'] = 0;
             $item['tva_id'] = (int) $tva;
             if ($discount_default_quantity > 0 && $discount_default_amount > 0) {
                 if ($quantity >= $discount_default_quantity) {
                     $discount = (double) round($amount * $discount_default_amount / 100, 2);
                     $amount -= $discount;
                     $item['discount'] = $discount;
                 }
             } else {
                 if ($discount_price_quantity > 0 && $discount_price_amount > 0) {
                     if ($amount >= $discount_price_quantity) {
                         $discount = (double) round($amount * $discount_price_amount / 100, 2);
                         $amount -= $discount;
                         $item['discount'] = $discount;
                     }
                 }
             }
             if (0 < $fixed_costs_default) {
                 $amount += $fixed_costs_default;
             }
             if (0 < $shipping_costs_default) {
                 $amount += $shipping_costs_default;
             }
             if (0 < $travel_costs_default) {
                 $travel_costs = (double) $travel_costs_default * $km;
                 $amount += $travel_costs;
                 $item['travel_costs'] = $travel_costs;
             }
             $optionsOffer = $this->extractOptions($offer);
             if (!empty($optionsOffer)) {
                 foreach ($optionsOffer as $opt) {
                     $value = isAke($offer, $opt, 0);
                     if ($value > 0) {
                         $price = isAke($product['product'], $this->transform($opt), 0);
                         $amountOption = (double) $price * $quantity;
                         $amount += $amountOption;
                         $item[$this->transform($opt)] = $amountOption;
                     }
                 }
             }
             $resellers[] = $reseller->id;
             $item['amount'] = (double) $amount;
             $item['offerin_id'] = (int) $offer['id'];
             if (true === $isCalendar) {
                 if (isset($product['product']['taux_horaire'])) {
                     $duration = (double) $makePrice / $product['product']['taux_horaire'];
                 } else {
                     $duration = $quantity;
                 }
                 $end = $start + 3600 * $duration;
                 $item['duration'] = $end - $start;
                 $employees = $this->getEmployeesCan((int) $start, (int) $end, (int) $product['reseller_id']);
                 if (empty($employees)) {
                     $infos[$reseller->id]['no_employee'] = true;
                     Model::offerouttrash()->create($item)->save();
                     continue;
                 }
                 $item['reselleremployees'] = $employees;
                 $item['start'] = $start;
                 $item['end'] = $end;
             } else {
                 $employees = Model::Reselleremployee()->where(['reseller_id', '=', (int) $reseller->id])->select('id')->cursor()->toArray();
                 $item['reselleremployees'] = $employees;
             }
             $item['status_id'] = (int) lib('status')->getId('offerout', 'SHOWN');
             $offerOut = Model::Offerout()->create($item)->save();
             $item['offerout_id'] = $offerOut->id;
             $collection[] = $item;
         }
     }
     $return = [];
     $return['resellers'] = $resellers;
     $return['offers'] = $collection;
     if (!empty($errors)) {
         $return['errors'] = $errors;
     }
     if (!empty($infos)) {
         $return['infos'] = $infos;
     }
     $offerin->resellers = $resellers;
     if (true === $isCalendar) {
         $offerin->start = $start;
     }
     $offerin->save();
     return $return;
 }
Beispiel #4
0
    getCityByID($cityID, $mysqli);
}
if ($functionname == 'delCity') {
    $cityID = $_POST["cityID"];
    delCity($cityID, $mysqli);
}
if ($functionname == 'getCityByStateID') {
    $stateID = $_POST["stateID"];
    getCityByStateID($stateID, $mysqli);
}
/*Location*/
if ($functionname == 'setLocation') {
    $locationID = $_POST["locationID"];
    $locationName = $_POST["locationName"];
    $locationRegionID = $_POST["locationRegionID"];
    setLocation($locationID, $locationName, $locationRegionID, $mysqli);
}
if ($functionname == 'getLocation') {
    getLocation($mysqli);
}
if ($functionname == 'getLocationByID') {
    $locationID = $_POST["locationID"];
    getLocationByID($locationID, $mysqli);
}
if ($functionname == 'delLocation') {
    $locationID = $_POST["locationID"];
    delLocation($locationID, $mysqli);
}
/*Port*/
if ($functionname == 'setPort') {
    $portID = $_POST["portID"];
Beispiel #5
0
 private function receiveLocation($object)
 {
     include "location.php";
     $content = setLocation($object->FromUserName, (string) $object->Location_X, (string) $object->Location_Y);
     $result = $this->transmitText($object, $content);
     return $result;
 }
Beispiel #6
0
    if ($_GET['page'] == 45) {
        $check = mysqlresult(myquery("SELECT COUNT(*) FROM bookgame_users_flags WHERE bookgame={$book_id} AND user_id={$user_id} AND (flag=8 OR flag=9)"), 0, 0);
        if ($check != 2) {
            $print_text = 1;
            $alt_text = "«ААА!!!,- крик Аргалакса звенит под потолком.- Я вызываю Жаррадана Мара и Шарелу, Ведьму Снега!!» Ты можешь противиться заклинаниям двух колдунов, только если есть Щит Времени и Лёд. Но их у тебя не оказалось, и ты бесславно погиб на поле боя!";
        }
    }
}
include "quest_bookgame.inc.php";
if (isset($_GET['page']) and $_GET['page'] == 9) {
    /*
    $sel = myquery("SELECT * FROM bookgame_users_flags WHERE bookgame=$book_id AND user_id=$user_id AND flag=1");
    if (mysql_num_rows($sel))
    {
    	$flag = mysql_fetch_array($sel);
    	echo '<br />Ты знаешь пароль! Переходи к <a href="http://'.domain_name.''.$_SERVER['PHP_SELF'].'?page='.$flag['value'].'">'.$flag['value'].'</a><br />';
    }
    */
    if (!isset($_GET['pass'])) {
        echo 'Если ты знаешь пароль, то введи его: <input type="text" size="5" value="0" id="pass">&nbsp;&nbsp;&nbsp;<input type="button" onClick="location.href=\'http://' . domain_name . '' . $_SERVER['PHP_SELF'] . '&page=9&pass=\'+document.getElementById(\'pass\').value+\'\'" value="Ввести пароль">';
    } else {
        $pass = (int) $_GET['pass'];
        if ($pass == 23) {
            myquery("UPDATE bookgame_users SET step=23 WHERE bookgame={$book_id} AND user_id={$user_id}");
        } else {
            myquery("UPDATE bookgame_users SET step=37 WHERE bookgame={$book_id} AND user_id={$user_id}");
        }
        setLocation("http://" . domain_name . '' . $_SERVER['PHP_SELF']);
    }
}
echo '<br /><br /><br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="?exit">Выйти из квеста</a>';
Beispiel #7
0
                         $sel_usid = myquery("SELECT user_id FROM craft_build_rab WHERE build_id={$build_id} AND eliksir>={$number_shahta_min} AND eliksir<={$number_shahta_max} AND user_id<>{$user_id}");
                         while (list($usid) = mysql_fetch_array($sel_usid)) {
                             //$msg = mysql_real_escape_string("Завал уровня. build=id=$build_id,level=$level,kol_obalov=$kol_obvalov,number_shahta_min=$number_shahta_min,number_shahta_max=$number_shahta_max");
                             //myquery("INSERT DELAYED INTO game_pm (komu, otkogo, theme, post, view, time) VALUES ('612', '".$usid."', 'Завал уровня. Прочие', '$msg','0','".time()."')");
                             exit_from_craft("", 1, $usid);
                         }
                     }
                     exit_from_craft("", 1, $char['user_id'], 1);
                 } else {
                 }
             } else {
                 echo '<br /><br />Указан неправильный код.';
             }
             unset($_SESSION['captcha']);
             unset($_POST['digit']);
             setLocation("craft.php");
         }
         /*
         */
     }
 } elseif (isset($_GET['klin'])) {
     $check = myquery("SELECT * FROM craft_resource_user WHERE user_id={$user_id} AND res_id={$id_resource_brevno} AND col>0 LIMIT 1");
     if ($check != false and mysql_num_rows($check) > 0) {
         myquery("UPDATE craft_build_mining SET geksa_obval=geksa_obval-2 WHERE id={$id_geks}");
         $res_user = mysql_fetch_array($check);
         if ($res_user['col'] == 1) {
             myquery("DELETE FROM craft_resource_user WHERE id=" . $res_user['id'] . "");
         } else {
             myquery("UPDATE craft_resource_user SET col=GREATEST(0,col-1) WHERE id=" . $res_user['id'] . "");
         }
         myquery("insert into craft_stat (build_id, gp, res_id, dob, vip, dat, user, type) values (0, 0, " . $res_user['id'] . ", 0, -1, " . time() . ", {$user_id}, 'z')");
function join_attack_user($char, $player, $svit)
{
    $user_id = $char['user_id'];
    $map = mysql_fetch_array(myquery("SELECT * FROM game_maps WHERE id='" . $char['map_name'] . "'"));
    list($type, $npc) = mysql_fetch_array(myquery("SELECT combat_type, npc FROM combat WHERE combat_id=" . $player['boy'] . ""));
    switch ($type) {
        case 1:
            list($side) = mysql_fetch_array(myquery("SELECT side FROM combat_users WHERE combat_id=" . $player['boy'] . " and user_id=" . $player['user_id'] . " and npc=0"));
            break;
        case 2:
            $error = 'duel';
            break;
        case 3:
            $sred_level = 0;
            $sred_level_1 = 0;
            $side_1 = 0;
            $sred_level_2 = 0;
            $side_2 = 0;
            $kol = 0;
            $sel = myquery("SELECT clevel,side FROM combat_users WHERE combat_id='" . $player['boy'] . "' AND `join`=0 AND svitok=0");
            while ($boyuser = mysql_fetch_array($sel)) {
                $sred_level += $boyuser['clevel'];
                $kol++;
                if ($side_1 == 0 or $side_1 == $boyuser['side']) {
                    $side_1 = $boyuser['side'];
                    $sred_level_1 += $boyuser['clevel'];
                } elseif ($side_2 == 0 or $side_2 == $boyuser['side']) {
                    $side_2 = $boyuser['side'];
                    $sred_level_2 += $boyuser['clevel'];
                }
            }
            $sred_level = round($sred_level / $kol);
            if ($sred_level_1 <= $sred_level_2) {
                $side = $side_1;
            } else {
                $side = $side_2;
            }
            break;
        case 4:
            $side = $char['clan_id'];
            break;
        case 5:
            $side = $char['user_id'];
            break;
        case 6:
            $side = $char['sklon'];
            break;
        case 7:
            $side = $char['race'];
            break;
    }
    if ($svit == 2 and clans_war == 0) {
        list($side) = mysql_fetch_array(myquery("SELECT side FROM combat_users WHERE combat_id=" . $player['boy'] . " AND user_id=" . $player['user_id'] . ""));
    }
    if (!isset($side)) {
        list($side) = mysql_fetch_array(myquery("SELECT side FROM combat_users WHERE combat_id=" . $player['boy'] . " AND user_id=" . $player['user_id'] . ""));
    }
    $k_komu = 0;
    $svit_id = 0;
    //используем свиток
    if ($svit == 1) {
        $svit_id = svitok_small_item_id;
    } elseif ($svit == 2) {
        $svit_id = svitok_sred_item_id;
    }
    if ($svit_id != 0) {
        $ch = myquery("SELECT id FROM game_items WHERE user_id={$user_id} AND priznak=0 AND used IN (12,13,14) AND item_id='" . $svit_id . "' LIMIT 1");
        if (mysql_num_rows($ch)) {
            $svitok = mysql_fetch_array($ch);
            $Item = new Item($svitok['id']);
            $Item->use_item();
        }
        $k_komu = $player['user_id'];
    }
    save_stat($char['user_id'], '', '', 1, '', '', $player['user_id'], '', '', '', '', '');
    $nam = 0;
    if ($type == 1) {
        $nam = 14;
    }
    if ($type == 2) {
        $nam = 15;
    }
    if ($type == 3) {
        $nam = 16;
    }
    if ($type == 4) {
        $nam = 17;
    }
    if ($type == 5) {
        $nam = 18;
    }
    if ($type == 6) {
        $nam = 49;
    }
    if ($type == 7) {
        $nam = 48;
    }
    //Снимем с атакующего игрока эффект неуязвимости, если бой не с ботом
    if ($npc == 0) {
        myquery("DELETE FROM game_obelisk_users WHERE user_id=" . $char['user_id'] . " AND type=6");
    }
    list($current_hod) = mysql_fetch_array(myquery("SELECT hod FROM combat WHERE combat_id=" . $player['boy'] . ""));
    //Кидаем в бой игрока
    combat_insert($char, 0, $player['boy'], $type, $side, $current_hod, 1, $svit, $k_komu, $map['k_exp'] / 100, $map['k_gp'] / 100, 0, 6, $nam, 1);
    setLocation("http://" . domain_name . "/combat.php");
}
 <?php 
if (function_exists("start_debug")) {
    start_debug();
}
if (preg_match('/.inc.php/', $_SERVER['PHP_SELF'])) {
    setLocation('index.php');
} else {
    // Помощь новичкам
    if ($char['clevel'] < 5) {
        include 'template_intro.inc.php';
    }
    // Тут был чат на гексе
    $online_range = time() - 300;
    /*
    $result_messages = myquery("SELECT * FROM game_chat WHERE map_name='" . $char['map_name'] . "' AND map_xpos='" . $char['map_xpos'] . "' AND map_ypos='" . $char['map_ypos'] . "' AND post_time>$online_range ORDER BY post_time LIMIT 60");
    if (mysql_num_rows($result_messages))
    {
    	$i = 0;
    	QuoteTable('open');
    	while ($player_messages = mysql_fetch_array($result_messages))
    	{
    		switch (floor($i/4))
    		{
    			case 0:
    				$font_color = 'eeeeee';
    				break;
    			case 1:
    				$font_color = 'c6c6c6';
    				break;
    			case 2:
    				$font_color = 'bbbbbb';
                //попробуем так
                setLocation("../act.php?func=main");
            }
            break;
            //1.2 - сдача квеста
        //1.2 - сдача квеста
        case 12:
            //проверим, все ли в норме
            if (!isset($done)) {
                include 'quest_engine_types/quests_engine_leaving.php';
            } else {
                //”—“јЌќ¬»ћ ‘” Ќ ÷»ё "»√–ј"
                ForceFunc($user_id, 5);
                set_delay_reason_id($user_id, 1);
                if (isset($_SESSION['for_quest'])) {
                    unset($_SESSION['for_quest']);
                }
                //выход в сз
                //попробуем так
                setLocation("../act.php?func=main");
            }
            break;
    }
}
include "../inc/template_footer.inc.php";
if ($_SERVER['REMOTE_ADDR'] == debug_ip) {
    show_debug();
}
if (function_exists("save_debug")) {
    save_debug();
}
Beispiel #11
0
		<img src="http://<?php 
        echo img_domain;
        ?>
/combat/n.jpg">
		<?php 
        if ($state['combat_id'] > 0 and $state['hod'] > 0) {
            ShowCombatLog($state['combat_id'], $state['hod']);
        }
        break;
    case 10:
        $combat->print_begin();
        break;
    default:
        $combat->clear_combat();
        end_script_combat();
        setLocation("act.php");
        break;
}
?>
<script type="text/javascript" language="JavaScript">
function upchat()
{
	ch_fr = top.window.frames.chat;
	if (ch_fr)
	{
		bt = ch_fr.document.getElementById("select_game_chat");
		if (bt)
		{
			if (bt.style.display!="inline")
			{
				bt.style.display="inline";
			<br /><br />Описание бота:<br /><textarea cols="30" rows="10" name="npc_opis"></textarea> </td>
			</tr></table><br><br><input name="submit" type="submit" value="Сохранить">';
        }
    } elseif (isset($_GET['edit'])) {
        $itemc = mysql_fetch_array(myquery("SELECT * FROM game_npc_template WHERE npc_id=" . $_GET['edit'] . ""));
        if (isset($_POST['submit'])) {
            if (!isset($_POST['canmove'])) {
                $canmove = 0;
            } else {
                $canmove = 1;
            }
            myquery("UPDATE game_npc_template SET npc_name='" . $_POST['npc_name'] . "',npc_race='" . $_POST['npc_race'] . "',npc_max_hp='" . $_POST['npc_max_hp'] . "',npc_max_mp='" . $_POST['npc_max_mp'] . "',npc_level='" . $_POST['npc_level'] . "',respawn='" . $_POST['respawn'] . "',npc_str='" . $_POST['npc_str'] . "',npc_str_deviation='" . $_POST['npc_str_deviation'] . "',npc_dex='" . $_POST['npc_dex'] . "',npc_dex_deviation='" . $_POST['npc_dex_deviation'] . "',npc_pie='" . $_POST['npc_pie'] . "',npc_pie_deviation='" . $_POST['npc_pie_deviation'] . "',npc_vit='" . $_POST['npc_vit'] . "',npc_vit_deviation='" . $_POST['npc_vit_deviation'] . "',npc_spd='" . $_POST['npc_spd'] . "',npc_spd_deviation='" . $_POST['npc_spd_deviation'] . "',npc_ntl='" . $_POST['npc_ntl'] . "',npc_ntl_deviation='" . $_POST['npc_ntl_deviation'] . "',npc_exp_max='" . $_POST['npc_exp_max'] . "',npc_gold='" . $_POST['npc_gold'] . "',canmove='" . $canmove . "',item='" . $_POST['item'] . "',agressive='" . $_POST['agressive'] . "',agressive_level='" . $_POST['agressive_level'] . "',npc_img='" . $_POST['npc_img'] . "',npc_opis='" . $_POST['npc_opis'] . "' WHERE npc_id=" . $_GET['edit'] . "");
            //сохраняем шаблон бота
            myquery("Update game_npc Set EXP=" . $_POST['npc_exp_max'] . " Where npc_id=" . $_GET['edit'] . "");
            //Изменяем получаемый опыт с бота
            setLocation("admin.php?opt=main&option=npc_template&page=" . $_GET['page'] . "");
        } elseif (isset($_GET['npcopt'])) {
            require_once 'npc_template_option.inc.php';
        } else {
            echo '
			<form name="edit_npc_template" action="admin.php?opt=main&option=npc_template&edit=' . $_GET['edit'] . '&page=' . $page . '" method="POST">
			<table border=0><tr><td><table border=0 bgcolor=111111>
			<tr><td>Имя (раса): </td><td><input type="text" name="npc_name" size="40" value="' . $itemc['npc_name'] . '"> <br /> (<input type="text" name="npc_race" size="35" value="' . $itemc['npc_race'] . '">)</td></tr>
			<tr><td>Жизни/Мана: </td><td><input type="text" name="npc_max_hp" size="7" value="' . $itemc['npc_max_hp'] . '">/<input type="text" name="npc_max_mp" size="7" value="' . $itemc['npc_max_mp'] . '"></td></tr>
			<tr><td>Уровень: </td><td><input type="text" name="npc_level" size="5" value="' . $itemc['npc_level'] . '"></td></tr>
			<tr><td>Время воскрешения: </td><td><input type="text" name="respawn" size="10" value="' . $itemc['respawn'] . '"> секунд</td></tr>
			<tr><td>Сила: </td><td><input type="text" size="5" value="' . $itemc['npc_str'] . '" name="npc_str">&plusmn;<input type="text" size="5" value="' . $itemc['npc_str_deviation'] . '" name="npc_str_deviation"></td></tr>
			<tr><td>Выносливость: </td><td><input type="text" size="5" value="' . $itemc['npc_dex'] . '" name="npc_dex">&plusmn;<input type="text" size="5" value="' . $itemc['npc_dex_deviation'] . '" name="npc_dex_deviation"></td></tr>
			<tr><td>Ловкость: </td><td><input type="text" size="5" value="' . $itemc['npc_pie'] . '" name="npc_pie">&plusmn;<input type="text" size="5" value="' . $itemc['npc_pie_deviation'] . '" name="npc_pie_deviation"></td></tr>
			<tr><td>Защита: </td><td><input type="text" size="5" value="' . $itemc['npc_vit'] . '" name="npc_vit">&plusmn;<input type="text" size="5" value="' . $itemc['npc_vit_deviation'] . '" name="npc_vit_deviation"></td></tr>
			<tr><td>Мудрость: </td><td><input type="text" size="5" value="' . $itemc['npc_spd'] . '" name="npc_spd">&plusmn;<input type="text" size="5" value="' . $itemc['npc_spd_deviation'] . '" name="npc_spd_deviation"></td></tr>
Beispiel #13
0
         if (domain_name == 'testing.rpg.su' or domain_name == 'localhost') {
             $dlit = 5;
         } else {
             $dlit = max(120, 600 - getCraftLevel($user_id, 7) * 20);
         }
         if (isset($from_house)) {
             $build_id = 'sawmill';
         }
         $ad = 0;
         if (isset($_GET['part4'])) {
             $ad = $_GET['add'];
         }
         myquery("DELETE FROM craft_build_rab WHERE user_id={$user_id}");
         myquery("INSERT INTO craft_build_rab (user_id,build_id,date_rab,dlit,eliksir,`add`) VALUES ({$user_id},'{$build_id}'," . time() . ",{$dlit},'{$type_work}',{$ad})");
         ForceFunc($user_id, func_craft);
         setLocation("../craft.php");
     } else {
         echo 'Ты не можешь начать работу на лесопилке (введен неправильный код или у тебя недостаточно свободного места в инвентаре)!<br><br><br><br>';
     }
 } else {
     echo 'Для начала работы введи указанный ниже код <br>и нажми кнопку "Начать работу на лесопилке"<br>';
     echo '<br><img src="../captcha_new/index.php?' . time() . '">';
     $action = "";
     if (isset($from_house)) {
         if (isset($_GET['raspil_brevno'])) {
             $action = "?raspil_brevno" . $add_url;
         }
         if (isset($_GET['doski'])) {
             if (isset($_GET['strel'])) {
                 $action = "?doski&strel" . $add_url;
             }
Beispiel #14
0
 $sel_hod = myquery("SELECT * FROM arcomage_history WHERE arcomage_id='" . $arcomage['id'] . "' AND user_id='{$user_id}' AND hod='{$hod}'");
 $cards2end = 1;
 // calculate history
 while ($h_card = mysql_fetch_array($sel_hod) and $cards2end > 0) {
     if ($h_card['fall'] == 1) {
         $cards2end -= 1;
     } else {
         $cards2end -= 1;
         $cards2end += extra_hod($h_card['card_id']);
     }
 }
 // and last card (not inseted into DB yet)
 $cards2end -= 1 - (1 - isset($_GET['fall'])) * extra_hod($card);
 if ($cards2end < 1) {
     myquery("UPDATE arcomage_users SET func=2,hod=" . time() . " WHERE user_id='{$user_id}'");
     setLocation("arcomage.php");
 }
 if (isset($_GET['fall'])) {
     myquery("INSERT INTO arcomage_history (arcomage_id,user_id,card_id,fall,hod) VALUES ('" . $charboy['arcomage_id'] . "','{$user_id}','{$card}',1,'{$hod}')");
 } elseif (!isset($_GET['fall']) and check_dostup($card, $charboy) == 1) {
     myquery("INSERT INTO arcomage_history (arcomage_id,user_id,card_id,fall,hod) VALUES ('" . $charboy['arcomage_id'] . "','{$user_id}','{$card}',0,'{$hod}')");
     if ($cards2end >= 0) {
         $users = array();
         $sel_init = myquery("SELECT * FROM arcomage_users WHERE arcomage_id='" . $charboy['arcomage_id'] . "'");
         while ($userboy = mysql_fetch_array($sel_init)) {
             $q = $userboy['user_id'];
             $users[$q]['tower'] = $userboy['tower'];
             $users[$q]['wall'] = $userboy['wall'];
             $users[$q]['bricks'] = $userboy['bricks'];
             $users[$q]['bricks_add'] = $userboy['bricks_add'];
             $users[$q]['gems'] = $userboy['gems'];
Beispiel #15
0
 function Moder($action, $replys)
 {
     $location = "index.php";
     if ($this->forum_admin or $this->user_rights['category'] == 4) {
         $ar = explode(",", $replys);
         if (sizeof($ar) > 0) {
             //В ar номера обрабатываемых ответов
             $action = (int) $action;
             for ($i = 0; $i < sizeof($ar); $i++) {
                 if ($i == 0) {
                     list($topic_id) = mysql_fetch_array(myquery("SELECT topics_id FROM forum_otv WHERE id=" . $ar[$i] . ""));
                 }
                 if ($action == 1) {
                     $this->DeleteReply($ar[$i]);
                 }
                 if ($action == 2) {
                     $this->RestoreReply($ar[$i]);
                 }
                 if ($action == 3) {
                     $this->DeleteEndReply($ar[$i]);
                 }
             }
             $location = "index.php?act=topic&id={$topic_id}";
             if (isset($_GET['page'])) {
                 $location .= "&page=" . $_GET['page'];
             }
         }
     }
     setLocation("{$location}");
 }
Beispiel #16
0
                 echo '<td align="center"><input type="text" size="8" name="doska_repair" value="' . min($kol_res, $ho['doska_repair']) . '"></td></tr><tr><td colspan="4" style="height:5px;background-color:#585858;border:1px groove;">';
             }
             if ($ho['stone_repair'] > 0) {
                 $kol_res = mysqlresult(myquery("SELECT col FROM craft_resource_user WHERE user_id={$user_id} AND res_id={$id_resource_blok}"), 0, 0);
                 echo '<tr><td rowspan=3>КАМЕННЫЕ БЛОКИ</td>';
                 echo '<td>Требуется для ремонта</td>';
                 echo '<td align="center">' . $ho['stone_repair'] . '</td></tr>';
                 echo '<tr><td>Имеется с собой</td>';
                 echo '<td align="center">' . $kol_res . '</td></tr>';
                 echo '<tr><td>Вложить в ремонт</td>';
                 echo '<td align="center"><input type="text" size="8" name="stone_repair" value="' . min($kol_res, $ho['stone_repair']) . '"></td></tr>';
             }
             echo '</table>';
             echo '<br /><br /><input type="submit" name="save" value="Отремонтировать"></form>';
         } else {
             setLocation("town.php?option=" . $option . "&part4");
         }
     }
 } else {
     if (isset($_GET['repairall'])) {
         include '../inc/craft/craft.inc.php';
         $need_blok = 0;
         $need_doska = 0;
         $put_blok = 0;
         $put_doska = 0;
         $check_doska = myquery("SELECT col FROM craft_resource_user WHERE user_id=" . $user_id . " AND res_id=" . $id_resource_doska . "");
         if (mysql_num_rows($check_doska) == 0) {
             $kol_doska = 0;
         } else {
             $kol_doska = mysqlresult($check_doska, 0, 0);
         }
Beispiel #17
0
 public function searchNearByAddress($address, $query)
 {
     $collection = lib('collection');
     $coords = lib('geo')->getCoords($address);
     $url = 'http://search.mappy.net/search/1.0/find?extend_bbox=1&bbox=' . $coords['lat1'] . ',' . $coords['lng1'] . ',' . $coords['lat2'] . ',' . $coords['lng2'] . '&q=' . urlencode($query) . '&favorite_country=' . $coords['country_id'] . '&language=FRE&&max_results=199';
     dd($url);
     $key = 'serach.near.' . sha1($url);
     $json = redis()->get($key);
     if (!$json) {
         $json = dwn($url);
         redis()->set($key, $json);
     }
     $data = json_decode($json, true);
     $pois = isAke($data, 'pois', []);
     foreach ($pois as $service) {
         $dbService = rdb('geo', 'service')->where(['code', '=', $service['rubricId']])->first(true);
         if ($dbService) {
             $id = $dbService->id;
         } else {
             if (isset($service['allRubrics'])) {
                 if (count($service['allRubrics'])) {
                     foreach ($service['allRubrics'] as $rubrikA) {
                         $idr = isAke($rubrikA, 'id');
                         $lr = isAke($rubrikA, 'label');
                         $pr = isAke($rubrikA, 'rubricParentId');
                         if ($idr == $service['rubricId']) {
                             $spi = rdb('geo', 'service')->firstOrCreate(['code' => $idr])->setLabel($lr)->setFamily($pr)->save();
                             $id = $spi->id;
                         }
                     }
                 }
             }
         }
         $serviceproxIds = $supplements = [];
         $serviceproxIds[] = $id;
         $poi = $service['id'];
         $checkEtab = rdb('geo', 'etablissement')->where(['poi', '=', (string) $poi])->first(true);
         $add = $checkEtab ? false : true;
         unset($service['id']);
         if (false === $add) {
             $service['id'] = $checkEtab->id;
         }
         unset($service['offer']);
         unset($service['prov']);
         unset($service['pjBlocId']);
         unset($service['thematicId']);
         if (isset($service['tabs'])) {
             if (count($service['tabs'])) {
                 foreach ($service['tabs'] as $tmp) {
                     $tmpUrl = isAke($tmp, 'url', false);
                     $tmpId = isAke($tmp, 'appId', false);
                     if (false !== $tmpUrl && false !== $tmpId) {
                         $key = 'inf.' . $poi . '.' . $tmpId;
                         if ($tmpId == 'pj') {
                             $inf = redis()->get($key);
                             if (empty($inf)) {
                                 $infHtml = dwn($tmpUrl);
                                 $inf = substr($infHtml, strlen('callback('), -1);
                                 redis()->set($key, $inf);
                             }
                             $inf = json_decode($inf, true);
                             $t = isAke($inf, 'tabs', []);
                             if (!empty($t)) {
                                 foreach ($t as $tmpT) {
                                     $b = isAke($tmpT, 'blocks', []);
                                     $t = isAke($tmpT, 'tags', []);
                                     if (!empty($b)) {
                                         for ($ti = 0; $ti < count($b); $ti += 2) {
                                             $seg = $b[$ti];
                                             $seg2 = $b[$ti + 1];
                                             if (is_array($seg) && is_array($seg2)) {
                                                 $title = isAke($seg, 'title', false);
                                                 $kv = isAke($seg2, 'keyValue', false);
                                                 if (false !== $title && false !== $kv) {
                                                     $title = Inflector::urlize($title);
                                                     foreach ($kv as $tmpRow) {
                                                         $supplements[$title][] = [$tmpRow['key'] => $tmpRow['value']];
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         } elseif ($tmpId == 'indoor') {
                         } elseif ($tmpId == 'localbusinesspremium') {
                         } elseif ($tmpId == 'total') {
                         } elseif ($tmpId == 'totalaccess') {
                         } elseif ($tmpId == 'darty') {
                         } elseif ($tmpId == 'eleclerc') {
                         } elseif ($tmpId == 'moteurproduitpromo') {
                         } elseif ($tmpId == 'mappyshopping') {
                         } elseif ($tmpId == 'booking') {
                             $inf = redis()->get($key);
                             if (empty($inf)) {
                                 $infHtml = dwn($tmpUrl);
                                 $inf = substr($infHtml, strlen('callback('), -1);
                                 redis()->set($key, $inf);
                             }
                             $inf = json_decode($inf, true);
                             /* TODO */
                         } elseif ($tmpId == 'localbusinessdiscovery') {
                             $inf = redis()->get($key);
                             if (empty($inf)) {
                                 $infHtml = dwn($tmpUrl);
                                 $inf = substr($infHtml, strlen('callback('), -1);
                                 redis()->set($key, $inf);
                             }
                             $inf = json_decode($inf, true);
                             $t = isAke($inf, 'tabs', []);
                             if (!empty($t)) {
                                 foreach ($t as $tmpT) {
                                     $b = isAke($tmpT, 'blocks', []);
                                     if (!empty($b)) {
                                         foreach ($b as $tmpB) {
                                             $kv = isAke($tmpB, 'keyValue', false);
                                             if (false !== $kv) {
                                                 foreach ($kv as $tmpRow) {
                                                     $tmpK = Inflector::urlize($tmpRow['key']);
                                                     $supplements['infos'][$tmpK] = $tmpRow['value'];
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         } else {
                             $inf = redis()->get($key);
                             if (empty($inf)) {
                                 $infHtml = dwn($tmpUrl);
                                 $inf = substr($infHtml, strlen('callback('), -1);
                                 redis()->set($key, $inf);
                             }
                             $inf = json_decode($inf, true);
                         }
                     }
                 }
             }
         }
         unset($service['tabs']);
         unset($service['contextualPoiUrl']);
         unset($service['providerIds']);
         unset($service['pjRatingId']);
         unset($service['hasUnclaimableProvider']);
         unset($service['additionalInfos']);
         unset($service['additionalInfo']);
         unset($service['coordinateProvider']);
         unset($service['coordinateProvider3D']);
         unset($service['offerType']);
         unset($service['rubricId']);
         unset($service['closestPanoramicId']);
         if (isset($service['allRubrics'])) {
             if (count($service['allRubrics'])) {
                 foreach ($service['allRubrics'] as $rubrikA) {
                     $idr = isAke($rubrikA, 'id');
                     $lr = isAke($rubrikA, 'label');
                     $pr = isAke($rubrikA, 'rubricParentId');
                     $spi = rdb('geo', 'service')->firstOrCreate(['code' => $idr])->setLabel($lr)->setFamily($pr)->save();
                 }
             }
             unset($service['allRubrics']);
         }
         if (isset($service['additionalRubricIds'])) {
             if (count($service['additionalRubricIds'])) {
                 foreach ($service['additionalRubricIds'] as $newRubrique) {
                     $spi = rdb('geo', 'service')->firstOrCreate(['code' => $newRubrique]);
                     $serviceproxIds[] = $spi->id;
                 }
             }
         }
         unset($service['additionalRubricIds']);
         unset($service['brandIconUrl']);
         unset($service['slat']);
         unset($service['slng']);
         unset($service['salt']);
         unset($service['brand']);
         unset($service['indoors']);
         unset($service['visibleIn3D']);
         unset($service['townCode']);
         if (isset($service['town'])) {
             $service['city'] = $service['town'];
             unset($service['town']);
         }
         if (isset($service['positions3D'])) {
             if (isset($service['positions3D']['origin'])) {
                 if (isset($service['positions3D']['origin']['alt'])) {
                     $service['altitude'] = $service['positions3D']['origin']['alt'];
                     unset($service['positions3D']);
                 }
             }
         }
         if (isset($service['way'])) {
             $service['address'] = $service['way'];
             unset($service['way']);
         }
         if (isset($service['pCode'])) {
             $service['zip'] = $service['pCode'];
             unset($service['pCode']);
             unset($service['positions3D']);
         }
         if (isset($service['lat']) && isset($service['lng'])) {
             $distances = distanceKmMiles($coords['lng1'], $coords['lat1'], $service['lng'], $service['lat']);
             $service['distance'] = (double) $distances['km'];
         }
         ksort($service);
         $service['poi'] = $poi;
         if (false === $add) {
             $collection[] = $service;
         }
         if (true === $add) {
             $distance = $service['distance'];
             unset($service['distance']);
             $etab = rdb('geo', 'etablissement')->firstOrCreate($service)->setPoi($poi)->save();
             setLocation($etab, $etab->lng, $etab->lat);
             if (!empty($supplements)) {
                 foreach ($supplements as $supK => $supV) {
                     $setter = setter($supK);
                     $etab->{$setter}($supV);
                 }
                 $etab->save();
             }
             $fields = $etab->_keys();
             $sFields = array_merge(array_keys($service), array_keys($supplements));
             $except = ['id', 'poi', 'created_at', 'updated_at'];
             $resave = false;
             $expurge = [];
             foreach ($fields as $field) {
                 if (!in_array($field, $except)) {
                     if (!in_array($field, $sFields)) {
                         $expurge[] = $field;
                         $etab = $etab->expurge($field);
                         $resave = true;
                     }
                 }
             }
             if (true === $resave) {
                 $etab = $etab->save();
             }
             foreach ($serviceproxIds as $serviceproxId) {
                 $spTmp = rdb('geo', 'service')->find((int) $serviceproxId);
                 $spTmp->attach($etab);
             }
             $zone = rdb('geo', 'zone')->find(1);
             $zone->attach($etab);
             $service['new'] = true;
             $service['id'] = $etab->id;
             $service['distance'] = $distance;
         }
         $collection[] = $service;
     }
     if (!empty($collection)) {
         $tuples = $new = [];
         $collection->sortBy('distance');
         foreach ($collection as $row) {
             $hasPoi = isAke($row, 'poi', false);
             if (false === $hasPoi) {
                 $new[] = $row;
             } else {
                 $poi = sha1($hasPoi);
                 if (!in_array($poi, $tuples)) {
                     $tuples[] = $poi;
                     $new[] = $row;
                 }
             }
         }
         $collection = lib('collection', [$new]);
     }
     return $collection->toArray();
 }
		</td>
		</tr>
		</table>
		</form>
		<br />
		<br />
		<h4>Ресурсы для квеста:</h4>
		<br />
		<div id="quest_res"></div>
		<?php 
    } else {
        if (isset($_POST['submit_quest'])) {
            myquery("INSERT INTO dungeon_quests (quest_level,quest_id,name,description) VALUES ('" . $_POST['questlevel'] . "','" . $_POST['questid'] . "','" . $_POST['questname'] . "','" . $_POST['questdesc'] . "') ON DUPLICATE KEY UPDATE quest_level='" . $_POST['questlevel'] . "',quest_id='" . $_POST['questid'] . "',name='" . $_POST['questname'] . "',description='" . $_POST['questdesc'] . "'");
            if (isset($_POST['newquest'])) {
                $idquest = mysql_insert_id();
                setLocation("admin.php?opt=main&option=quest_moria&edit={$idquest}");
                die;
            }
        }
        if (isset($_GET['delete'])) {
            myquery("DELETE FROM dungeon_quests WHERE id=" . $_GET['delete'] . "");
        }
        //добавление нового квеста
        $selal = myquery("SELECT quest_level,quest_id FROM dungeon_quests ORDER BY quest_level DESC, quest_id DESC LIMIT 1");
        if (mysql_num_rows($selal) > 0) {
            $new = mysql_fetch_array($selal);
        } else {
            $new = array();
            $new["quest_level"] = 1;
            $new["quest_id"] = 0;
        }
Beispiel #19
0
                $check_items = myquery("SELECT gif.name, (v1.kol - ifnull(v2.kol, 0)) as kol FROM \n\t\t\t\t(SELECT item_id, count(item_id) as kol FROM game_users_complects_items WHERE complect_id='" . $compl['id'] . "' GROUP BY item_id) as v1\n\t\t\t\tJOIN game_items_factsheet gif ON v1.item_id = gif.id\n\t\t\t\tLEFT JOIN (SELECT item_id, count(item_id) as kol FROM game_items WHERE user_id='" . $char['user_id'] . "' AND priznak=0 AND item_uselife>0 AND ref_id=0 GROUP BY item_id) as v2 \n\t\t\t\tON (v1.item_id=v2.item_id) WHERE v1.kol>v2.kol OR v2.kol IS NULL");
                if (mysql_num_rows($check_items) > 0) {
                    echo 'У вас нет всех необходимых предметов:';
                    while ($it = mysql_fetch_array($check_items)) {
                        echo '<br>' . $it['name'] . ' - ' . $it['kol'] . ' шт.';
                    }
                } else {
                    $find_items = myquery("SELECT item_id, used FROM game_users_complects_items WHERE complect_id='" . $compl['id'] . "' AND used>0");
                    while (list($id, $used) = mysql_fetch_array($find_items)) {
                        list($it_id) = mysql_fetch_array(myquery("SELECT id FROM game_items WHERE user_id='" . $char['user_id'] . "' AND priznak=0 AND item_uselife>0 AND used=0 AND ref_id=0 AND item_id='" . $id . "' LIMIT 1"));
                        $Item = new Item($it_id);
                        $Item->up(0, $used, 0);
                        if ($from_house) {
                            setLocation("hero.php?house&option=" . $option . "");
                        } else {
                            setLocation("act.php?func=inv");
                        }
                    }
                    echo 'Комплект одет!';
                }
            }
        }
    }
    QuoteTable('close');
} elseif (isset($_GET['del_complect'])) {
    $check = myquery("SELECT status FROM game_users_complects WHERE user_id='" . $char['user_id'] . "' AND id='" . $_GET['del_complect'] . "'");
    if (mysql_num_rows($check) == 1) {
        list($status) = mysql_fetch_array($check);
        if ($status == 1) {
            myquery("DELETE FROM game_users_complects_items WHERE complect_id='" . $_GET['del_complect'] . "'");
        } elseif ($status == 0) {
Beispiel #20
0
}
if (!isset($_SESSION['katorga_checksum_href'])) {
    setLocation("../act.php");
    exit;
}
if (!isset($_SESSION['katorga_checksum_href'])) {
    setLocation("../act.php");
    exit;
}
if ($_GET['id'] != $_SESSION['katorga_checksum_href']) {
    setLocation("../act.php");
    exit;
}
$prisoner = myquery("SELECT * FROM game_prison WHERE user_id='{$user_id}'");
if (!mysql_num_rows($prisoner)) {
    setLocation("../act.php");
    exit;
}
$prisoner = mysql_fetch_array($prisoner);
if ($char['map_name'] == 666) {
    if ($char['map_xpos'] == 1 and $char['map_ypos'] == 1) {
        $option = 'work';
    } elseif ($char['map_xpos'] == 0 and $char['map_ypos'] == 0) {
        $option = 'exit';
    } elseif ($char['map_xpos'] == 0 and $char['map_ypos'] == 1 or $char['map_xpos'] == 1 and $char['map_ypos'] == 0 or $char['map_xpos'] == 1 and $char['map_ypos'] == 2 or $char['map_xpos'] == 2 and $char['map_ypos'] == 0 or $char['map_xpos'] == 2 and $char['map_ypos'] == 1) {
        $option = 'run';
    } else {
        echo 'FATAL ERROR 1784';
        $st = 'Это был игрок: ' . $char['name'] . '. Попытка взлома механизма Каторги.';
        //$name='Inquisitor_I';
        //$id=mysql_result(myquery("SELECT user_id FROM game_users WHERE name='$name'"),0,0);
 public function take($id = 0, $place_id, $kol = 1)
 {
     $check1 = $this->init_res_nonuser($id, $place_id);
     if ($check1 == 1) {
         $kol = min($kol, $this->res_nonuser['col']);
         //Даём ресурс игроку
         $check2 = $this->add_user(0, $this->char['user_id'], $kol, $this->res_nonuser['dead_time']);
         if ($check2 == 1) {
             //Забираем ресурс с карты
             $this->add_map(0, 0, -$kol);
         } elseif ($this->message_type == 1) {
             setLocation("act.php?errror=full_inv");
             if (function_exists("save_debug")) {
                 save_debug();
             }
             exit;
         }
     }
 }
function arcomage_user($char, $player, $money)
{
    global $user_id;
    $id = $player['user_id'];
    list($map_id) = mysql_fetch_array(myquery("SELECT map_name FROM game_users_map WHERE user_id={$id}"));
    $map = mysql_fetch_array(myquery("SELECT * FROM game_maps WHERE id={$map_id}"));
    if ($map['name'] == 'Арена Хаоса') {
        return '';
    }
    if ($map['dolina'] == 1) {
        return '';
    }
    list($map_id) = mysql_fetch_array(myquery("SELECT map_name FROM game_users_map WHERE user_id={$user_id}"));
    $map = mysql_fetch_array(myquery("SELECT * FROM game_maps WHERE id={$map_id}"));
    if ($map['name'] == 'Арена Хаоса') {
        return '';
    }
    if ($map['dolina'] == 1) {
        return '';
    }
    if (played_arco($player['user_id']) != 0) {
        //нельзя нападать на игроков в две башни
        return 'Игрок играет в Две Башни';
    }
    $r = mt_rand(1, 5);
    if ($r == 1) {
        $tower_win = 50;
        $resource_win = 150;
        $tower = 10;
        $wall = 5;
        $bricks = 10;
        $gems = 10;
        $monsters = 10;
        $bricks_add = 2;
        $gems_add = 2;
        $monsters_add = 2;
    } elseif ($r == 2) {
        $tower_win = 100;
        $resource_win = 100;
        $tower = 20;
        $wall = 15;
        $bricks = 15;
        $gems = 15;
        $monsters = 15;
        $bricks_add = 1;
        $gems_add = 1;
        $monsters_add = 1;
    } elseif ($r == 3) {
        $tower_win = 150;
        $resource_win = 250;
        $tower = 30;
        $wall = 20;
        $bricks = 20;
        $gems = 20;
        $monsters = 20;
        $bricks_add = 5;
        $gems_add = 5;
        $monsters_add = 5;
    } elseif ($r == 4) {
        $tower_win = 100;
        $resource_win = 300;
        $tower = 20;
        $wall = 10;
        $bricks = 20;
        $gems = 20;
        $monsters = 20;
        $bricks_add = 3;
        $gems_add = 3;
        $monsters_add = 3;
    } else {
        $tower_win = 200;
        $resource_win = 150;
        $tower = 20;
        $wall = 20;
        $bricks = 20;
        $gems = 20;
        $monsters = 20;
        $bricks_add = 2;
        $gems_add = 2;
        $monsters_add = 2;
    }
    $nachalo = time();
    myquery("DELETE FROM arcomage_call WHERE user_id='{$user_id}'");
    myquery("DELETE FROM arcomage_call WHERE user_id='{$id}'");
    $ins = myquery("insert into arcomage (hod,tower_win,resource_win,money,timehod,user1, user1_name, user2, user2_name) values (1,'{$tower_win}','{$resource_win}','{$money}', {$nachalo}, {$user_id}, '" . $char['name'] . "', {$id}, '" . $player['name'] . "')");
    $uid = mysql_insert_id();
    myquery("DELETE FROM arcomage_users WHERE user_id='{$user_id}'");
    myquery("DELETE FROM arcomage_users_cards WHERE user_id='{$user_id}'");
    $ins = myquery("insert into arcomage_users (arcomage_id,user_id,tower,wall,bricks,gems,monsters,bricks_add,gems_add,monsters_add,func,hod) values ('{$uid}','{$user_id}','{$tower}','{$wall}','{$bricks}','{$gems}','{$monsters}','{$bricks_add}','{$gems_add}','{$monsters_add}','6',{$nachalo})");
    $is = mysql_insert_id();
    $charboy = mysql_fetch_array(myquery("SELECT * FROM arcomage_users WHERE id='{$is}'"));
    for ($n = 1; $n <= 5; $n++) {
        $new_card = get_new_card($charboy, 0);
        $ins = myquery("insert into arcomage_users_cards (arcomage_id,user_id,card_id) values ('{$uid}','{$user_id}','{$new_card}')");
    }
    myquery("DELETE FROM arcomage_users WHERE user_id='{$id}'");
    myquery("DELETE FROM arcomage_users_cards WHERE user_id='{$id}'");
    $ins = myquery("insert into arcomage_users (arcomage_id,user_id,tower,wall,bricks,gems,monsters,bricks_add,gems_add,monsters_add,func,hod) values ('{$uid}','{$id}','{$tower}','{$wall}','{$bricks}','{$gems}','{$monsters}','{$bricks_add}','{$gems_add}','{$monsters_add}','7',{$nachalo})");
    $is = mysql_insert_id();
    $charboy = mysql_fetch_array(myquery("SELECT * FROM arcomage_users WHERE id='{$is}'"));
    for ($n = 1; $n <= 5; $n++) {
        $new_card = get_new_card($charboy, 0);
        $ins = myquery("insert into arcomage_users_cards (arcomage_id,user_id,card_id) values ('{$uid}','{$id}','{$new_card}')");
    }
    set_delay_reason_id($user_id, 10);
    set_delay_reason_id($id, 10);
    // Пробный
    setLocation("arcomage.php");
    // Попробуем так забросить противника в бой. Тут есть потенциальные проблемы.
    // Т.к. точно ли мы уверены, что игрок находится в тех режимах, из которых можно выйти в бой. А мы его форсируем.
    ForceFunc($id, 4);
    return '';
}
     echo '<br><a href="?begin" target="game">Нет, я ' . echo_sex('передумал', 'передумала') . '</a><br><br>';
 } elseif (isset($_GET['do_exit'])) {
     myquery("UPDATE dungeon_users_data SET last_visit=" . time() . " WHERE user_id=" . $user_id . "");
     myquery("UPDATE game_users_map SET map_xpos=25,map_ypos=20,map_name=18 WHERE user_id={$user_id}");
     setLocation("../act.php");
 } elseif (isset($_GET['task']) and isset($_SESSION['dungeon']['quest_id'])) {
     $quest_id = $_SESSION['dungeon']['quest_id'];
     include "dungeon_inc/dungeon_quests.php";
     myquery("UPDATE dungeon_users_data SET " . $field2 . "=" . $quests[$level][$quest_id]['id'] . " WHERE user_id=" . $user_id . "");
     for ($i = 1; $i <= count($quests[$level][$quest_id]['res']); $i++) {
         $id = $quests[$level][$quest_id]["res"][$i]["id"];
         $col = $quests[$level][$quest_id]["res"][$i]["kol"];
         myquery("INSERT INTO dungeon_users_progress (user_id,quest_id,res_id,res_num) VALUES (" . $user_id . "," . $quests[$level][$quest_id]['id'] . "," . $id . "," . $col . ")");
     }
     unset($_SESSION['dungeon']['quest_id']);
     setLocation("?talk");
 } elseif (isset($_GET['choice']) or isset($_POST['choice']) and $_POST['choice'] == 3) {
     if (isset($_GET['choice'])) {
         $choice = $_GET['choice'];
     } else {
         $choice = 3;
     }
     //перс берет квест
     if ($choice == 1) {
         //проверим, нет ли у перса уже задания
         list($current_quest) = mysql_fetch_array(myquery("SELECT " . $field2 . " FROM dungeon_users_data WHERE user_id=" . $user_id . ""));
         if ($current_quest != 0) {
             //cкажем, что квест уже есть
             echo '<table cellpadding="0" cellspacing="0" width="80%" border="0"><tr><td><p align=justify><br>';
             echo '<font color=#aaffa8><b>Подожди-ка</b>, - хранитель подземелья сверился со своими записями. - <b>Но ты уже выполняешь наше задание! Сначала выполни одно, а потом уже получишь другое.</b></font><br><br>';
             echo '</p></tr></td></table>';
Beispiel #24
0
 public function up($id = 0, $used, $check_whole = 1)
 {
     global $user_time;
     global $_SESSION;
     $_SESSION['error_inv'] = '';
     if ($id > 0) {
         $this->init_item($id);
     }
     if ($used == 0) {
         switch ($this->fact['type']) {
             case 1:
                 $used = 1;
                 break;
             case 2:
                 $used = 2;
                 if (isset($_GET['slot']) and $_GET['slot'] == 2 and $this->char['clevel'] >= 3) {
                     $used = 19;
                 }
                 if (isset($_GET['slot']) and $_GET['slot'] == 3 and $this->char['clevel'] >= 7) {
                     $used = 20;
                 }
                 break;
             case 3:
                 $used = 3;
                 break;
             case 4:
                 $used = 4;
                 break;
             case 5:
                 $used = 5;
                 break;
             case 6:
                 $used = 6;
                 break;
             case 7:
                 $used = 7;
                 break;
             case 8:
                 $used = 8;
                 break;
             case 9:
                 $used = 9;
                 break;
             case 10:
                 $used = 10;
                 break;
             case 11:
                 $used = 11;
                 break;
             case 12:
                 $used = 12;
                 if (isset($_GET['slot']) and $_GET['slot'] == 2) {
                     $used = 13;
                 }
                 if (isset($_GET['slot']) and $_GET['slot'] == 3) {
                     $used = 14;
                 }
                 break;
             case 13:
                 $used = 12;
                 if (isset($_GET['slot']) and $_GET['slot'] == 2) {
                     $used = 13;
                 }
                 if (isset($_GET['slot']) and $_GET['slot'] == 3) {
                     $used = 14;
                 }
                 break;
             case 14:
                 $used = 17;
                 break;
             case 15:
                 $used = 18;
                 break;
             case 16:
                 $used = 15;
                 if (isset($_GET['slot']) and $_GET['slot'] == 2) {
                     $used = 16;
                 }
                 break;
             case 18:
                 $used = 4;
                 break;
             case 18:
                 $used = 4;
                 break;
             case 23:
                 $used = 22;
                 break;
             case 24:
                 $used = 21;
                 break;
         }
     }
     if ($check_whole == 0) {
         $this->item_up($used);
     } elseif ($this->fact['can_up'] == 1 and $this->item['priznak'] == 0 and $this->item['user_id'] == $this->char['user_id'] and $this->item['used'] == 0 and $used > 0 and (!$this->counted_item() or $this->fact['type'] == 12 or $this->fact['type'] == 13)) {
         if (getFunc($this->item['user_id']) == 2 and $this->fact['type'] == 24 and mysql_num_rows(myquery("SELECT * FROM game_items WHERE user_id=" . $this->item['user_id'] . " and priznak=0 and used=21 and item_id=" . $this->item['item_id'] . "")) == 0) {
             return;
         } else {
             if ($this->item['ref_id'] != 0) {
                 $_SESSION['error_inv'] = 'error_ident';
                 setLocation("act.php?func=inv&error_ident");
                 return;
             }
             if ($this->item['item_uselife'] == 0 and $this->fact['type'] != 12 and $this->fact['type'] != 13) {
                 $_SESSION['error_inv'] = 'error_broken';
                 setLocation("act.php?func=inv&error_broken&reason=delay");
                 return;
             }
             $check = $this->check_up();
             if ($check != 1) {
                 $_SESSION['error_inv'] = 'error_stat';
                 $_SESSION['error_stat'] = $check;
                 setLocation("act.php?func=inv&error_stat");
                 return;
             }
             $check_used = $this->check_used($used);
             if ($check_used != 1) {
                 $_SESSION['error_inv'] = 'error_broken';
                 setLocation("act.php?func=inv&error_broken&reason=delay");
                 return;
             }
             $check = myquery("SELECT id FROM game_items WHERE user_id=" . $this->char['user_id'] . " AND priznak=0 AND used={$used}");
             if (mysql_num_rows($check)) {
                 list($used_item) = mysql_fetch_array($check);
                 $ItemUsed = new Item($used_item);
                 $kol = $ItemUsed->item_down();
                 if ($kol == 1 and $used_item == $this->item['item_id']) {
                     $this->item['count_item'] = $this->item['count_item'] + 1;
                 }
             }
             $this->item_up($used);
         }
     }
 }
Beispiel #25
0
    } else {
        mt_srand(make_seed());
        $new_nas = mt_rand(1, $founder['nas'] - 10);
        mt_srand(make_seed());
        $new_teplo = mt_rand(1, 100);
        $new_state = $founder['state'] + 1;
        $mes = 'Выполнена ' . $new_state . ' из 3 стадий плавления.';
        myquery("UPDATE craft_build_founder SET nas={$new_nas},teplo={$new_teplo},state=state+1 WHERE user_id={$user_id}");
    }
    //Обновим страницу
    $option = 18;
    if (domain_name == 'localhost') {
        $option = 19;
    }
    $url = 'lib/town.php?option=' . $option . '&part4&add=18&mes=' . $mes;
    setLocation($url);
    exit_from_craft($add_query, 1);
} else {
    if ($hod > 0 and $hod <= time()) {
        //еще работает таймер
        $founder = mysql_fetch_array(myquery("SELECT craft_build_founder.*,craft_resource.name FROM craft_build_founder,craft_resource WHERE craft_build_founder.user_id={$user_id} AND craft_resource.id=craft_build_founder.res_id"));
        echo 'Ты ' . echo_sex('занят', 'занята') . ' работой в плавильном цехе<br /><br />Ты переплавляешь ресурс ' . $founder['name'] . '<br /><br />Стадия плавления - ' . ($founder['state'] + 1) . ' из 3<br /><br />';
        echo '<br>До конца работы осталось: <font color=ff0000><b><span id="timerr1">' . ($hod + $timeout - time()) . '</span></b></font> секунд</div> 
		<script language="JavaScript" type="text/javascript">
		function tim()
		{
			timer = document.getElementById("timerr1");
			if (timer.innerHTML<=0)
				location.reload();
			else
			{
Beispiel #26
0
    public function print_wait()
    {
        myquery("UPDATE combat_users SET time_last_active=" . time() . " WHERE user_id=" . $this->char['user_id'] . "");
        //запуск расчета хода
        // Проверка многокланового боя по 3 ход
        $cont = 1;
        if ($this->combat['combat_type'] == 4) {
            if ($this->combat['hod'] <= 3) {
                $rest = $this->combat['time_last_hod'] + $this->timeout - time();
                if ($rest > 0) {
                    $cont = 0;
                }
            }
        }
        if ($cont == 1) {
            $low_condition = 0;
            // Проверим, надо ли ожидать игроков, которые пропустили более 3-ёх ходов
            if ($this->combat['time_last_hod'] + $this->low_timeout - time() <= 0) {
                $low_condition = 1;
            }
            $all_users = mysql_result(myquery("SELECT COUNT(*) FROM combat_users WHERE combat_id=" . $this->combat['combat_id'] . " and (" . $low_condition . "=0 OR (" . $low_condition . "=1 and missed_actions<3))"), 0, 0);
            $wait_users = mysql_result(myquery("SELECT COUNT(*) FROM combat_users_state WHERE state=6 AND combat_id=" . $this->combat['combat_id'] . ""), 0, 0);
            if ($all_users == $wait_users or $this->combat['time_last_hod'] + $this->timeout - time() <= 0) {
                if ($this->combat['time_last_hod'] + $this->timeout - time() <= 0) {
                    // Завершаем бой, в котором один игрок ждёт подтверждения от другого
                    $check = myquery("SELECT user_id, state FROM combat_users_state WHERE state=1 AND combat_id=" . $this->combat['combat_id'] . " ");
                    if (mysql_num_rows($check) > 0) {
                        $this->clear_combat();
                        setLocation("act.php");
                        break;
                    }
                }
                // Сперва попробуем создать строку. Если она уже есть, mysql_affected_rows() вернет 0.
                myquery("INSERT IGNORE INTO combat_locked (combat_id, hod) VALUES ('" . $this->combat['combat_id'] . "'," . $this->combat['hod'] . ")");
                if (mysql_affected_rows()) {
                    $this->calculate();
                    setLocation("combat.php");
                    die;
                }
            }
        }
        $this->print_header();
        ?>
		<table style="width:100%" border="0" align="center" cellpadding="0" cellspacing="0">
			<tr>
				<td style="width:200px;" valign="top" bgcolor="#000000">
				<?php 
        $this->print_left();
        $rest_second = $this->combat['time_last_hod'] - time() + $this->timeout;
        ?>
				</td>
				<td valign="top" bgcolor="#000000">
				<meta http-equiv="refresh" content="15">
				<center>
				<span id="text_wait">Ожидание ходов противников<br></span>
				<span id="text_wait1">До конца хода осталось: <font color=ff0000><b>
				<span id="timerr1"><?php 
        echo $rest_second;
        ?>
</span></b></font> секунд</span>
				<script language="JavaScript" type="text/javascript">
				function tim()
				{
					timer = document.getElementById("timerr1");
					timer.innerHTML=timer.innerHTML-1;
					if (timer.innerHTML<=0)
					{
						timer.innerHTML = "";
						txt_wait = document.getElementById("text_wait1");
						txt_wait.innerHTML = "";
						txt_wait = document.getElementById("text_wait");
						txt_wait.innerHTML = "Подождите, выполняется расчет хода боя.";
					}
					else
					{
						window.setTimeout("tim()",1000);
					}
				}
				tim();
				</script>
				<br>
				<input type="button" class="button" value="Обновить" onClick="location.reload()"></center><br /><br /><br /><br /><br />
				<?php 
        $this->show_log();
        ?>
				</td>
				<td style="width:200px;" valign="top" bgcolor="#000000">
				<?php 
        $this->print_right();
        ?>
				</td>
			</tr>
		</table>
		<?php 
    }
Beispiel #27
0
    if (mysql_num_rows($check)) {
        $upd = myquery("update game_chat_option set color='{$col}',b='{$b}',i='{$i}',privat='{$priv}',font='{$font}',size='{$size}',ref='{$ref}',autosc='{$autosc}',frame='{$fram}' where user_id='{$user_id}'");
    } else {
        $upd = myquery("insert into game_chat_option (user_id,color,b,i,font,size,ref,autosc,frame) values ('{$user_id}','{$col}','{$b}','{$i}','{$font}','{$size}','{$ref}','{$autosc}','{$fram}')");
    }
    $msg = '<span style="font-weight:700;color:red;font-size:12px;">' . iconv("Windows-1251", "UTF-8//IGNORE", "Настройки изменены") . '</span>';
    myquery("insert into game_log (town,message,date,fromm,too,color,ptype) values (0,'" . mysql_real_escape_string($msg) . "','" . time() . "','',{$user_id},'" . $col . "',1)");
    unset($b);
    unset($i);
    unset($col);
    unset($font);
    unset($size);
    unset($ref);
    unset($autosc);
    unset($fram);
    setLocation("chat_online.php");
}
$ban = mysql_result(myquery("SELECT COUNT(*) FROM game_ban WHERE user_id='{$user_id}' AND type='0'"), 0, 0);
if ($ban > 0) {
    die('Ты ' . echo_sex('забанен', 'забанена') . '');
}
$bot = 'Нафаня';
?>
<html>
<head>
<title>Чат игры</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<style type="text/css">@import url("http://<?php 
echo domain_name;
?>
/style/global.css");</style>
Beispiel #28
0
 echo '<center>';
 echo '<b>Обменный пункт</b>';
 $link = "admin.php?opt=main&option=exchange";
 //Работа с группами товаров обменного пункта
 if (isset($_GET['groups'])) {
     echo ' -> <b>Управление группами</b>';
     //Создание новой группы
     if (isset($_GET['new'])) {
         echo ' -> <b>Создание новой группы</b>';
         if (isset($_POST['save']) and $_POST['keyword'] != "" and is_numeric($_POST['kol']) > 0 and $_POST['kol'] > 0) {
             $res = add_item_group(-999, $_POST['keyword'], $_POST['type'], $_POST['kol']);
             if ($res > 0) {
                 $mes = 'Предмет <b>' . $_POST['keyword'] . '</b> добавлен в группу <b>' . $res . '</b>';
                 add_admin_log($char, $mes);
                 $link_new = $link . "&groups&edit=" . $res;
                 setLocation($link_new);
             } else {
                 echo '<br><br><b>Что-то введено неверно!</b>';
             }
         } else {
             $add_link = $link . '&groups&new';
             new_item_group($add_link);
         }
         echo '<br><br><a href="' . $link . '&groups">Назад (Управление группами)</a>';
     } elseif (isset($_GET['edit'])) {
         $add_link = $link . '&groups&edit=' . $_GET['edit'];
         echo ' -> <b>Редактирование группы № ' . $_GET['edit'] . '</b>';
         if (isset($_POST['save']) and $_POST['keyword'] != "" and is_numeric($_POST['kol']) > 0 and $_POST['kol'] > 0) {
             $res = add_item_group($_GET['edit'], $_POST['keyword'], $_POST['type'], $_POST['kol']);
             if ($res > 0) {
                 $mes = 'Предмет <b>' . $_POST['keyword'] . '</b> добавлен в группу <b>' . $res . '</b>';
Beispiel #29
0
        if ($allpage > 1) {
            $href = '?option=comment&comm=' . $comm . '&user='******'user_id'] . '';
            echo 'Страница: ';
            show_page($page, $allpage, $href);
        }
        if ($user_id > 0) {
            if (isset($_POST['text'])) {
                $text = trim($_POST['text']);
                if ($text != '') {
                    $text = mysql_real_escape_string(htmlspecialchars($text));
                    $ins = myquery("insert into blog_comm (post_id, user_id, post, comm_time)\n\t\t\t\tvalues\n\t\t\t\t('" . $comm . "','" . $char['user_id'] . "','{$text}','" . time() . "')");
                    $up = myquery("update blog_post set comments=comments+1 where post_id='{$comm}'");
                    $sel = myquery("select user_id from blog_post where post_id='{$comm}'");
                    list($userr) = mysql_fetch_array($sel);
                    myquery("update blog_users set comments=comments+1, lastcomm='" . date("d.m.y H:i") . "' where user_id='{$userr}'");
                    setLocation("?option=comment&comm=" . $comm . "");
                }
            } else {
                echo '<center>';
                pokazat_formu_otveta('Оставить комментарий', 3, '');
            }
        }
        break;
    case 'setup':
        if ($user_id > 0) {
            $sel = myquery("select * from blog_users where user_id='" . $char['user_id'] . "'");
            $my = mysql_fetch_array($sel);
            if (!isset($_POST['see'])) {
                echo '
			<table border=0 width=100%>
				<tr>
Beispiel #30
0
 function setLocationAsync($object, $address)
 {
     $address = str_replace(["\n", "\r", ', ', ','], ' ', $address);
     $address = str_replace(['  '], ' ', $address);
     $cb = function ($id, $db, $table, $address) {
         $object = rdb($db, $table)->findOrFail($id);
         $coords = lib('geo')->getCoords($address, 250);
         setLocation($object, $coords['lng'], $coords['lat']);
     };
     lib('later')->set('setLocationAsync.' . Utils::token(), $cb, [$object->id, $object->db()->db, $object->db()->table, $address]);
     lib('later')->background();
 }