当前位置: 首页>>代码示例>>PHP>>正文


PHP do_mysql函数代码示例

本文整理汇总了PHP中do_mysql函数的典型用法代码示例。如果您正苦于以下问题:PHP do_mysql函数的具体用法?PHP do_mysql怎么用?PHP do_mysql使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了do_mysql函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: list_inloc

function list_inloc($pl, $action, $s = 0)
{
    global $sid;
    global $LOGIN;
    global $p;
    //$pl = preg_replace ('/[^a-z0-9_]/i', '', $pl);
    $action = preg_replace('/[^a-z0-9_&=\\.]/i', '', $action);
    $loc = $p['location'];
    // snachala igrokov: vyvedem
    $q = do_mysql("SELECT login, life, name FROM players WHERE location = '" . $loc . "' AND active = '1' AND id_player <> '" . $p['id_player'] . "' AND hidden = '0';");
    $inl = '<a class="blue" href="game.php?sid=' . $sid . '&action=' . $action . '&to=' . $LOGIN . '">на себя</a><br/>';
    while ($pp = mysql_fetch_assoc($q)) {
        $pp['life'] = explode('|', $pp['life']);
        $inl .= '<a class="blue" href="game.php?sid=' . $sid . '&action=' . $action . '&to=' . $pp['login'] . '">';
        $inl .= $pp['name'] . '</a>[' . round($pp['life'][0] / $pp['life'][1] * 100) . '%]<br/>';
    }
    $q = do_mysql("SELECT name, fullname, life, type FROM npc WHERE location = '" . $loc . "' AND (hidden = '0' OR hidden = '');");
    while ($n = mysql_fetch_assoc($q)) {
        if (!$s) {
            // znachit nelzja piokazyvatq govorjashih npc i torgovcev:
            if ($n['type'] == 's' || $n['type'] == 't') {
                continue;
            }
        }
        $n['life'] = explode('|', $n['life']);
        $inl .= '<a class="blue" href="game.php?sid=' . $sid . '&action=' . $action . '&to=' . $n['fullname'] . '">';
        $inl .= $n['name'] . '</a>[' . round($n['life'][0] / $n['life'][1] * 100) . '%]<br/>';
    }
    return $inl;
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:30,代码来源:f_list_inloc.php

示例2: decrease_misc

function decrease_misc($item, $count)
{
    //$item = preg_replace ('/[^a-z0-9_\.]/i', '', $item);
    $count = preg_replace('/[^0-9]/', '', $count);
    // vozmem nachalqnoe kolichestvo
    $sc = do_mysql("SELECT on_take FROM items WHERE fullname = '" . $item . "';");
    $sc = mysql_result($sc, 0);
    // esli count menqshe nulja, tupaja oshibka
    if ($count <= 0) {
        //put_error ('уменьшить на минусовое число нелзя, надо использовать увеличить');
        return 0;
    }
    // esli otnjav poluchitsja menqshe 0 tozhe nelzja, ob etom pozabotitsja nado v skriptah
    if ($sc - $count < 0) {
        //put_error ('как ты считал балбес, ведь меньше 0 получается');
        return 0;
    }
    // esli vse prodolzhaetsja, uvelichim i obnovim
    $nc = $sc - $count;
    if ($nc < 1) {
        include_once 'modules/f_delete.php';
        delete_item($item);
    }
    do_mysql("UPDATE items SET on_take = '" . $nc . "' WHERE fullname = '" . $item . "';");
    return 1;
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:26,代码来源:f_decrease_misc.php

示例3: get_loc

function get_loc($who, $stor, $depth = 1)
{
    // lokacija
    $id = is_player($who);
    if ($id) {
        $lq = do_mysql("SELECT location FROM players WHERE id_player = '" . $id . "';");
        $loc = mysql_result($lq, 0);
    } else {
        include_once 'modules/f_get_npc_info.php';
        $loc = get_npc_info($who, 'location');
    }
    $near = loc($loc, 'near');
    $lc = $near[$stor][0];
    if (!$lc) {
        return 0;
    }
    if ($depth == 2) {
        unset($near);
        $near = loc($lc, 'near');
    }
    if (!isset($near[$stor][0])) {
        return 0;
    }
    return $near[$stor][0];
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:25,代码来源:f_get_loc.php

示例4: teach_magic_from_sc

function teach_magic_from_sc($scroll, $npc, $login)
{
    //$scroll = preg_replace ('/[^a-z0-9_\.]/i', '', $scroll);
    //$npc = preg_replace ('/[^a-z0-9_\.]/i', '', $npc);
    //$login = preg_replace ('/[^a-z0-9_]/i', '', $login);
    $nid = is_npc($npc);
    $id = is_player($login);
    // v odnoj li lokacii
    $q = do_mysql("SELECT location FROM npc WHERE id_npc = '" . $nid . "';");
    if (!mysql_num_rows($q)) {
        return 0;
    }
    $loc1 = mysql_result($q, 0);
    $q = do_mysql("SELECT location FROM players WHERE id_player = '" . $id . "';");
    if (!mysql_num_rows($q)) {
        return 0;
    }
    $loc2 = mysql_result($q, 0);
    if ($loc1 != $loc2) {
        return 0;
    }
    include_once 'modules/f_has_item.php';
    if (!has_item($scroll, $login)) {
        put_g_error('у вас нету свитка!');
    }
    $q = do_mysql("SELECT on_take, price FROM items WHERE fullname = '" . $scroll . "' AND type = 's';");
    if (!mysql_num_rows($q)) {
        return 0;
    }
    $spell = mysql_fetch_assoc($q);
    // neumeet li on uzhe
    include_once 'modules/f_has_magic.php';
    if (has_magic($spell['on_take'], $login)) {
        put_g_error('вы уже умеете это заклинание!');
    }
    // cenu vyschitaem:
    $q = do_mysql("SELECT money FROM players WHERE id_player = '" . $id . "';");
    $money = mysql_result($q, 0);
    $cost = $spell['price'] * 10;
    if ($money < $cost) {
        put_g_error('нехватает серебра, нужно ' . $cost . ' серебреных!');
    }
    $money -= $cost;
    // dobavljaem zakl:
    $q = do_mysql("SELECT magic FROM players WHERE id_player = '" . $id . "';");
    $magic = mysql_result($q, 0);
    if (!$magic) {
        $magic = $spell['on_take'];
    } else {
        $magic .= '|' . $spell['on_take'];
    }
    // obnovim dannye:
    do_mysql("UPDATE players SET magic = '" . $magic . "', money = '" . $money . "' WHERE id_player = '" . $id . "';");
    // udaljaem svitok
    include_once 'modules/f_delete_item.php';
    delete_item($scroll);
    $q = do_mysql("SELECT name FROM magic WHERE fullname = '" . $spell['on_take'] . "';");
    $name = mysql_result($q, 0);
    exit_msg('магия', 'вы выучили заклинание ' . $name . ' за ' . $cost . ' серебреных!');
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:60,代码来源:f_teach_magic_from_sc.php

示例5: use_reagents

function use_reagents($spell, $login)
{
    //$spell = preg_replace ('/[^a-z0-9_]/i', '', $spell);
    //$login = preg_replace ('/[^a-z0-9_]/i', '', $login);
    if (!is_player($login)) {
        return 0;
    }
    // spisok reagentov:
    $q = do_mysql("SELECT reagents FROM magic WHERE fullname = '" . $spell . "';");
    if (!mysql_num_rows($q)) {
        return 0;
    }
    $rea = mysql_result($q, 0);
    if (!$rea) {
        return 1;
    }
    $rea = explode('|', $rea);
    // funkcija kotoroj udalim:
    include_once 'modules/f_decr_abstr_misc.php';
    $c = count($rea);
    for ($i = 0; $i < $c; $i++) {
        $rea[$i] = explode(':', $rea[$i]);
        decr_abstr_misc($rea[$i][0], $login, $rea[$i][1]);
    }
    return 1;
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:26,代码来源:f_use_reagents.php

示例6: set_w_effects

function set_w_effects($weapon, $dmg_type, $name)
{
    //$weapon = preg_replace ('/[^a-z0-9_\.]/', '', $weapon);
    //$name = preg_replace ('/[^a-z0-9_\.]/', '', $name);
    if (!$weapon) {
        return 0;
    }
    $q = do_mysql("SELECT on_drop FROM items WHERE fullname = '" . $weapon . "';");
    if (!mysql_num_rows($q)) {
        put_error('ner to weapo');
    }
    $effs = mysql_result($q, 0);
    $effs = explode('|', $effs);
    $c = count($effs);
    for ($i = 0; $i < $c; $i++) {
        if (rand(0, 100) <= 30) {
            include_once 'modules/f_set_affected.php';
            set_affected($name, $effs[$i]);
        }
    }
    // otdelqnyj razgovor s oglusheniem
    if ($dmg_type == 'drob') {
        if (rand(0, 100) <= 30) {
            include_once 'modules/f_set_affected.php';
            set_affected($name, 'oglushen');
        }
    }
    return 1;
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:29,代码来源:f_set_w_effects.php

示例7: start_blood

function start_blood($name)
{
    //$name = preg_replace ('/[^a-z0-9_\.]/i', '', $name);
    $id = is_player($name);
    if ($id) {
        $q = do_mysql("SELECT status1 FROM players WHERE id_player = '" . $id . "';");
        $st = mysql_result($q, 0);
        $st[2] = 1;
        do_mysql("UPDATE players SET status1 = '" . $st . "' WHERE id_player = '" . $id . "';");
        // regeneracija sposobna so vremenem pereborotq krovotechenie:
        $q = do_mysql("SELECT skills, last FROM players WHERE id_player = '" . $id . "';");
        $r = mysql_fetch_assoc($q);
        $r['skills'] = explode('|', $r['skills']);
        $r['last'] = explode('|', $r['last']);
        if ($r['skills'][5] > 0) {
            $time = time();
            $plus = 130 - 10 * $r['skills'][5];
            if ($plus < 30) {
                $plus = 30;
            }
            $r['last'][5] = $time + $plus;
            $last = $r['last'][0] . '|' . $r['last'][1] . '|' . $r['last'][2] . '|' . $r['last'][3] . '|' . $r['last'][4] . '|' . $r['last'][5] . '|' . $r['last'][6] . '|' . $r['last'][7] . '|' . $r['last'][8];
            do_mysql("UPDATE players SET last = '" . $last . "' WHERE id_player = '" . $id . "';");
        }
        return 1;
    }
    // proverjatq na npc nenado set_affected proverit
    include_once 'modules/f_set_affected.php';
    set_affected($name, 'krovotechenie');
    return 1;
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:31,代码来源:f_start_blood.php

示例8: use_mana

function use_mana($spell, $login)
{
    //$spell = preg_replace ('/[^a-z0-9_]/i', '', $spell);
    //$login = preg_replace ('/[^a-z0-9_]/i', '', $login);
    $q = do_mysql("SELECT mana FROM magic WHERE fullname = '" . $spell . "';");
    if (!mysql_num_rows($q)) {
        return 0;
    }
    $minus = mysql_result($q, 0);
    $id = is_player($login);
    $q = do_mysql("SELECT mana FROM players WHERE id_player = '" . $id . "';");
    if (!mysql_num_rows($q)) {
        return 0;
    }
    $mana = mysql_result($q, 0);
    $mana = explode('|', $mana);
    $mana[0] -= $minus;
    if ($mana[0] < 0) {
        return 0;
    }
    // many nehvatilo.
    $nmana = $mana[0] . '|' . $mana[1];
    do_mysql("UPDATE players SET mana = '" . $nmana . "' WHERE id_player = '" . $id . "';");
    return 1;
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:25,代码来源:f_use_mana.php

示例9: add_b_journal

function add_b_journal($what)
{
    return 1;
    global $p;
    global $LOGIN;
    $what = strip_tags(mysql_real_escape_string(trim($what)));
    // dlja togo, chtob i avtoru dobavili, (sohranen takoj in_battle nebudet)
    $c = count($p['in_battle']);
    for ($i = 0; $i < $c; $i++) {
        if (!$p['in_battle'][$i]) {
            continue;
        }
        if (substr($p['in_battle'][$i], 0, 2) == 'n.') {
            continue;
        }
        // ostaetsja igrok, emu dobavim
        $q = do_mysql("SELECT journal FROM players WHERE login = '" . $p['in_battle'][$i] . "';");
        $j = mysql_result($q, 0);
        $j .= '<br/>' . $what;
        do_mysql("UPDATE players SET journal = '" . $j . "' WHERE login = '" . $p['in_battle'][$i] . "';");
    }
    $q = do_mysql("SELECT journal FROM players WHERE id_player = '" . $p['id_player'] . "' AND in_battle > 0;");
    $j = mysql_fetch_assoc($q);
    if ($j['journal']) {
        $j['journal'] .= $what . '<br/>';
        do_mysql("UPDATE players SET journal = '" . $j['journal'] . "' WHERE id_player = '" . $p['id_player'] . "';");
    }
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:28,代码来源:f_add_b_journal.php

示例10: healer_stop_b

function healer_stop_b($healer, $patient, $cost)
{
    //$healer = preg_replace ('/[^a-z0-9_\.]/i', '', $healer);
    //$patient = preg_replace ('/[^a-z0-9_]/i', '', $patient);
    $cost = preg_replace('/[^0-9]/', '', $cost);
    $id = is_player($patient);
    $nid = is_npc($healer);
    $q = do_mysql("SELECT location, money, status1 FROM players WHERE id_player = '" . $id . "';");
    $p = mysql_fetch_assoc($q);
    $q = do_mysql("SELECT location FROM npc WHERE id_npc = '" . $nid . "';");
    $loc = mysql_result($q, 0);
    if ($p['location'] != $loc) {
        return 0;
    }
    if (!$p['status1'][2] && !$p['status1'][3] && !$p['status1'][4]) {
        exit_msg('целительство', 'вы итак полностью здоровы!');
    }
    $price = $cost;
    if ($p['money'] < $price) {
        exit_msg('целительство', 'у вас нехватает денег, надо ' . $price . ' серебра!');
    }
    $p['money'] -= $price;
    $p['status1'][2] = 0;
    $p['status1'][3] = 0;
    $p['status1'][4] = 0;
    do_mysql("UPDATE players SET money = '" . $p['money'] . "', status1 = '" . $p['status1'] . "' WHERE id_player = '" . $id . "';");
    exit_msg('целительство', 'вaши раны залечены! цена: ' . $price . ' серебра.');
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:28,代码来源:f_healer_stop_b.php

示例11: decr_abstr_misc

function decr_abstr_misc($prot, $who, $count, $other = 0)
{
    //$prot = preg_replace ('/[^a-z0-9_\.]/i', '', $prot);
    $count = preg_replace('/[^0-9]/', '', $count);
    //$who = preg_replace ('/[^a-z0-9_]/i', '', $who);
    if (!is_player($who)) {
        return 0;
    }
    if ($count < 1) {
        return 0;
    }
    $q = do_mysql("SELECT on_take FROM items WHERE belongs = '" . $who . "' AND is_in = 'inv' AND realname = '" . $prot . "' AND type = 'm';");
    if (!mysql_num_rows($q)) {
        return 0;
    }
    $ci = mysql_result($q, 0);
    if ($ci < $count) {
        return 0;
    }
    $ci -= $count;
    if ($ci) {
        do_mysql("UPDATE items SET on_take = '" . $ci . "' WHERE  belongs = '" . $who . "' AND is_in = 'inv' AND realname = '" . $prot . "';");
    } else {
        include_once 'modules/f_delete_item.php';
        $q = do_mysql("SELECT fullname FROM items WHERE belongs = '" . $who . "' AND is_in = 'inv' AND realname = '" . $prot . "' AND type = 'm';");
        $item = mysql_result($q, 0);
        delete_item($item);
    }
    return 1;
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:30,代码来源:f_decr_abstr_misc.php

示例12: heal

function heal($healer, $patient, $cost)
{
    //$healer = preg_replace ('/[^a-z0-9_\.]/i', '', $healer);
    //$patient = preg_replace ('/[^a-z0-9_]/i', '', $patient);
    $cost = preg_replace('/[^0-9]/', '', $cost);
    $id = is_player($patient);
    $nid = is_npc($healer);
    $q = do_mysql("SELECT location, money, life, status1 FROM players WHERE id_player = '" . $id . "';");
    $p = mysql_fetch_assoc($q);
    $q = do_mysql("SELECT location FROM npc WHERE id_npc = '" . $nid . "';");
    $loc = mysql_result($q, 0);
    if ($p['location'] != $loc) {
        return 0;
    }
    $p['life'] = explode('|', $p['life']);
    if ($p['life'][0] == $p['life'][1]) {
        exit_msg('целительство', 'вы итак полностью здоровы!');
    }
    $price = ceil(($p['life'][1] - $p['life'][0]) / 100) * $cost;
    if ($p['money'] < $price) {
        exit_msg('целительство', 'у вас нехватает денег, надо ' . $price . ' серебра!');
    }
    $p['money'] -= $price;
    $nlife = $p['life'][1] . '|' . $p['life'][1];
    $p['status1'][2] = 0;
    $p['status1'][3] = 0;
    $p['status1'][4] = 0;
    do_mysql("UPDATE players SET money = '" . $p['money'] . "', life = '" . $nlife . "', status1 = '" . $p['status1'] . "' WHERE id_player = '" . $id . "';");
    exit_msg('целительство', 'вы выздоровили! цена: ' . $price . ' серебра.');
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:30,代码来源:f_heal.php

示例13: check_reagents

function check_reagents($spell, $login)
{
    //$spell = preg_replace ('/[^a-z0-9_]/i', '', $spell);
    //$login = preg_replace ('/[^a-z0-9_]/i', '', $login);
    if (!is_player($login)) {
        return 0;
    }
    // spisok reagentov:
    $q = do_mysql("SELECT reagents FROM magic WHERE fullname = '" . $spell . "';");
    if (!mysql_num_rows($q)) {
        return 0;
    }
    $rea = mysql_result($q, 0);
    if (!$rea) {
        return 1;
    }
    $rea = explode('|', $rea);
    // funkcija kotoroj proverim:
    include_once 'modules/f_has_misc_count.php';
    $c = count($rea);
    $has = 1;
    for ($i = 0; $i < $c; $i++) {
        $rea[$i] = explode(':', $rea[$i]);
        // esli menqshe - 0
        if (has_misc_count($rea[$i][0], $rea[$i][1], $login) < 1) {
            $has = 0;
        }
    }
    return $has;
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:30,代码来源:f_check_reagents.php

示例14: damage_armor

function damage_armor($login, $shield = 0)
{
    do_mysql("UPDATE items SET str = str - 1 WHERE belongs = '" . $login . "' AND is_in LIKE 'a%' AND str > 0;");
    if ($shield) {
        do_mysql("UPDATE items SET str = str - 1 WHERE belongs = '" . $login . "' AND is_in = 'shi' AND str > 0;");
    }
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:7,代码来源:f_damage_armor.php

示例15: get_affected

function get_affected($name)
{
    //$name = preg_replace ('/[^a-z\._0-9]/i', '', $name);
    // pokachto tolqko chelam:
    $id = is_player($name);
    if ($id) {
        $q = do_mysql("SELECT affected FROM players WHERE id_player = '" . $id . "';");
        $a = mysql_result($q, 0);
    } else {
        $id = is_npc($name);
        if (!$id) {
            return 0;
        }
        $q = do_mysql("SELECT affected FROM npc WHERE id_npc = '" . $id . "';");
        if (!mysql_num_rows($q)) {
            return 0;
        }
        $a = mysql_result($q, 0);
    }
    if (!$a) {
        return 0;
    }
    $a = explode('|', $a);
    $c = count($a);
    for ($i = 0; $i < $c; $i++) {
        $a[$i] = explode(':', $a[$i]);
        $arr[] = $a[$i][0];
    }
    return $arr;
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:30,代码来源:f_get_affected.php


注:本文中的do_mysql函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。