• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_one函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: indexAction

 public function indexAction()
 {
     $departModel = M('Depart');
     $allDepart = $departModel->select();
     $adminuid = C('users')['666666'];
     $allDepart = get_one($allDepart, 'id');
     if ($this->uid != $adminuid) {
         $allDepart = array($allDepart[$this->uid]);
     }
     $this->assign('departList', $allDepart);
     $this->display();
 }
开发者ID:savey,项目名称:gpa,代码行数:12,代码来源:IndexController.class.php


示例2: caravan_send

 public function caravan_send($config, $player, $town, $wood, $stone, $iron)
 {
     $town = textV($town);
     $wood = (int) $wood;
     $stone = (int) $stone;
     $iron = (int) $iron;
     if ($wood + $stone + $iron < 1) {
         $msg = 'wyślij minimum 1 sztukę jakiegoś surowca';
     } elseif ($player->clan_id == 0) {
         $msg = 'nie jesteś w klanie, karawany można wysyłać tylko do sojuszników w swoim klanie';
     } elseif ($player->town->t_wood < $wood || $player->town->t_stone < $stone || $player->town->t_iron < $iron) {
         $msg = 'nie posiadasz tyle surowców';
     } else {
         $can = get_row($q = "select clan_id, t_id from users inner join towns on t_usr_id = usr_id where t_name = '" . $town . "' limit 1");
         if (empty($can)) {
             $msg = 'takie miasto nie istnieje';
         } elseif ($can->clan_id != $player->clan_id) {
             $msg = 'te miasto nie jest w tym samym klanie co ty';
         } else {
             $event_check = get_one("select count(*) from events where (e_type = 20 or e_type = 21) and e_done = 0 and e_t_id = " . $player->actual_town);
             if ($event_check > 9) {
                 $msg = 'masz już maksymalną ilość karawan w podróży';
             } else {
                 $market_lvl = get_one("select go_lvl from game_objects where go_type = 1 and go_subtype = 6 and go_t_id = " . $player->actual_town);
                 if (empty($market_lvl)) {
                     $msg = 'nie posiadasz rynku, jak chcesz wysłać karawanę??';
                 } elseif ($market_lvl <= $event_check) {
                     $msg = 'masz już maksymalną ilość karawan w podróży';
                 } else {
                     $y = get_row("select * from map where m_t_id =" . $can->t_id);
                     $x = get_row("select * from map where m_t_id =" . $player->actual_town);
                     if ($x->m_x != $y->m_x && $x->m_y == $y->m_y) {
                         $range = abs($y->m_x - $x->m_x) * 300;
                     } elseif ($x->m_x == $y->m_x && $x->m_y != $y->m_y) {
                         $range = abs($y->m_y - $x->m_y) * 300;
                     } else {
                         $range = floor(sqrt(pow(abs($y->m_x - $x->m_x), 2) + pow(abs($y->m_y - $x->m_y), 2))) * 300;
                     }
                     call("insert into caravan(ca_from, ca_to, ca_wood, ca_stone, ca_iron)\n\t\t\t\t\t\t\tvalue(" . $player->actual_town . "," . $can->t_id . "," . $wood . "," . $stone . "," . $iron . ")");
                     $ca = get_row("select last_insert_id() as ca, unix_timestamp() as estart");
                     require_once 'functions/TownMgr.php';
                     $TownMgr = new TownMgr();
                     $TownMgr->change_resources($config, $player->actual_town, -$wood, -$stone, -$iron, 0);
                     require_once 'functions/EventsMgr.php';
                     $EventMgr = new EventsMgr();
                     $EventMgr->event_add($config, $player->actual_town, 20, $can->t_id, $ca->ca, 0, $ca->estart, $ca->estart + $range, 0);
                     $msg = 'wysłano karawanę do miasta ' . $town;
                 }
             }
         }
     }
     return $msg;
 }
开发者ID:WlasnaGra,项目名称:Utopia,代码行数:53,代码来源:MarketMgr.php


示例3: buy_coins

 public function buy_coins($config, $player, $code)
 {
     $code = textV($code);
     $can = get_one($q = "select usr_id from vip_code where code ='" . $code . "' limit 1");
     if (!isset($can) || $can > 0) {
         $msg = 'niepoprawny kod';
     } else {
         call("update users set coins = coins + 100 where usr_id = " . $player->usr_id);
         call("update vip_code set usr_id = " . $player->usr_id . ", date = now() where code = '" . $code . "'");
         $msg = 'dodano 100 monet';
     }
     return $msg;
 }
开发者ID:WlasnaGra,项目名称:Utopia,代码行数:13,代码来源:VipMgr.php


示例4: msg_send

 public function msg_send($config, $user, $to, $text)
 {
     $user = (int) $user;
     $to = textV($to);
     $text = textV($text);
     $to_user = get_one("select usr_id from users where login ='" . $to . "' limit 1");
     if (!empty($to_user)) {
         call("insert into messages (m_from, m_to, m_type, m_text, m_date)\n\t\t\t\t  values(" . $user . "," . $to_user . ",2,'" . $text . "',now()),(" . $user . "," . $to_user . ",1,'" . $text . "',now())");
         return "wiadomość wysłano";
     } else {
         return "nie ma takiego użytkownika";
     }
 }
开发者ID:WlasnaGra,项目名称:Utopia,代码行数:13,代码来源:MsgMgr.php


示例5: new_town

 public function new_town($config, $player)
 {
     if ($player->actual_town == 0) {
         $is = get_one("select count(*) from towns where t_name ='" . $player->town . "'");
         if ($is == 1) {
             $player->town .= date("His");
         }
         call("\n\t\t\tinsert into towns (t_usr_id, t_name, t_nation, t_last_inc)\n\t\t\tvalue (" . $player->usr_id . ",'" . $player->town . "'," . $player->nation . ", unix_timestamp())\n\t\t\t");
         $town_id = get_one("select last_insert_id()");
         call("\n\t\t\tupdate map\n\t\t\tset m_t_id = {$town_id}\n\t\t\twhere m_t_id = 0\n\t\t\torder by rand() limit 1\n\t\t\t");
         call("\n\t\t\tupdate users\n\t\t\tset actual_town = {$town_id}\n\t\t\twhere usr_id = " . $player->usr_id);
         call("\n\t\t\tinsert into town_objects (to_t_id, to_gop_id, to_can)\n\t\t\tselect " . $town_id . ", gop_id, gop_can\n\t\t\tfrom game_objects_param\n\t\t\twhere gop_nation = " . $player->nation);
         reload($config, 'town', '');
     }
 }
开发者ID:WlasnaGra,项目名称:Utopia,代码行数:15,代码来源:TownMgr.php


示例6: login

 public function login($config, $login, $pass)
 {
     $msg = '';
     $login = textV($login);
     $pass = md5(textV($pass));
     $user = get_one("select usr_id from arena_users where login = '" . $login . "' and pass = '" . $pass . "' limit 1");
     if (!empty($user) && is_numeric($user) && $user > 0) {
         $_SESSION = array();
         $_SESSION['user'] = $user;
         call("update arena_users set last_login = unix_timestamp() where usr_id = " . $user);
         call("update arena_map inner join users on m_who = usr_id set m_who = 0, m_status = 1 where last_action <= unix_timestamp() - 300");
         reload($config, 'hero', '');
     } else {
         $msg = 'Wprowadzono błędne dane ';
     }
     return $msg;
 }
开发者ID:WlasnaGra,项目名称:Arena,代码行数:17,代码来源:RegisterMgr.php


示例7: require_auth

 /**
  * Verifies if the user is logged in and authenticates if not and POST contains username, else displays the login form
  * @return bool Returns true when the user has been logged in
  */
 function require_auth()
 {
     global $errors;
     // If user has already logged in...
     if ($this->logged_in) {
         return TRUE;
     }
     // Authenticate by POST data
     if (isset($_POST['username'])) {
         $username = $_POST['username'];
         $password = $_POST['password'];
         $user_id = get_one("SELECT user_id FROM user WHERE username = '{$username}' AND password = '{$password}'");
         if (!empty($user_id)) {
             $_SESSION['user_id'] = $user_id;
             return true;
         } else {
             $errors[] = "Vale kasutajanimi või parool";
         }
     }
     // Display the login form
     require 'templates/auth_template.php';
     // Prevent loading the requested controller (not authenticated)
     exit;
 }
开发者ID:henno,项目名称:varamu,代码行数:28,代码来源:Auth.php


示例8: intval

<?php

require "config.php";
require "system/database.php";
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
    if (isset($_GET["kuupaeva_id"]) && !empty($_GET["kuupaeva_id"])) {
        $id = intval($_GET["kuupaeva_id"]);
        $inimeste_arv = get_one("SELECT SUM(inimeste_arv) FROM broneering WHERE kuupaeva_id = {$id}");
        $vabad = 26 - $inimeste_arv;
        echo $vabad;
    }
} else {
    echo "Sa oled vales kohas. <a href='/do'>Mine tagasi esilehele!</a>";
}
开发者ID:DataKeyt,项目名称:meliss,代码行数:14,代码来源:check_free_places.php


示例9: isUser

require_once 'funkcje/podstawowe.php';
isUser($config);
$player = getUser($config);
if (empty($_GET['type'])) {
    $_GET['type'] = 0;
}
if (empty($_GET['subtype'])) {
    $_GET['subtype'] = 0;
}
if (empty($_GET['mid'])) {
    $_GET['mid'] = 0;
}
$_GET['mid'] = intV($_GET['mid']);
$_GET['type'] = intV($_GET['type']);
$_GET['subtype'] = intV($_GET['subtype']);
$object = get_one("select m_id from arena_map inner join arena_monsters on mo_id = m_subtype  where m_type = 5 and m_subtype =  " . $_GET['subtype'] . " and m_id = " . $_GET['mid'] . " limit 1");
if (!empty($object)) {
    switch ($_GET['subtype']) {
        case 1:
            $items = get_all("select * from arena_items_param ");
            echo "\n\t\t\t\t\t\t\t<div class='highslide-header'><b>Meglash</b> [esc - wyjście]\n\t\t\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t\t\t<li class='highslide-move'>\n\t\t\t\t\t\t\t\t\t\t<a style='color:#000000'  href='#' title='przesuń' onclick='return false'>\n\t\t\t\t\t\t\t\t\t\t\t<span>&lt;&gt;</span>\n\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t\t<li class='highslide-close'>\n\t\t\t\t\t\t\t\t\t\t<a style='color:#000000'  href='#' title='zamknij' onclick='hs.height = 120; hs.width = 220; return hs.close(this)'>\n\t\t\t\t\t\t\t\t\t\t\t<span>zamknij</span>\n\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t";
            $echo = '';
            if (is_array($items)) {
                foreach ($items as $item) {
                    $options = '';
                    if ($item->ip_gold <= $player->gold) {
                        $options .= "<a style='color:#000000'  href='?action=map&item_buy=" . $item->ip_id . "' >[ kup ]</a>";
                    }
                    $item->ip_text .= "<br/>";
                    if ($item->ip_attack > 0) {
                        $item->ip_text .= "Zwiększa <span class='red'>atak</span> herosa o <span class='red'>" . 1 * $item->ip_attack . "</span><br/>";
开发者ID:WlasnaGra,项目名称:Arena,代码行数:31,代码来源:market.php


示例10: get_all

}
$skills = get_all("select * from arena_skills_param left join arena_user_skills on sp_id = us_sp_id and us_usr_id =" . $player->usr_id);
$echo = '';
foreach ($skills as $skill) {
    if (empty($skill->us_lvl)) {
        $skill->us_lvl = 0;
        $skill->us_active = 0;
        $price = 1;
    } else {
        $price = $skill->us_lvl;
    }
    $options = '';
    if ($skill->us_active == 0 && $player->skills > $skill->us_lvl) {
        $options = "<a  href='?action=skills&skillup=" . $skill->sp_id . "'>[ zwiększ za " . $price . " PU ]</a> ";
    }
    $limit = get_one("select count(*) from arena_user_skills where us_usr_id = " . $player->usr_id . " and us_active = 1");
    if ($skill->us_active == 0 && $skill->us_lvl > 0 && $limit < 3) {
        $options .= "<a style='color:#F39604' href='?action=skills&active=" . $skill->sp_id . "'>[ aktywuj ]</a>";
    } elseif ($skill->us_active == 1 && $skill->us_lvl > 0) {
        $options .= "<a  href='?action=skills&deactive=" . $skill->sp_id . "'>[ deaktywuj ]</a>";
    }
    $skill->sp_text .= "<br/>";
    if ($skill->sp_attack > 0) {
        $skill->sp_text .= "Aktywowana zdolność będzie zwiększać <span class='red'>atak</span> herosa o <span class='red'>" . $price * $skill->sp_attack . "</span> [" . $skill->sp_attack . " na każdy poziom ]<br/>";
    }
    if ($skill->sp_defence > 0) {
        $skill->sp_text .= "Aktywowana zdolność będzie zwiększać <span class='red'>obronę</span> herosa o <span class='red'>" . $price * $skill->sp_defence . "</span> [" . $skill->sp_defence . " na każdy poziom ]<br/>";
    }
    if ($skill->sp_absorb > 0) {
        $skill->sp_text .= "Aktywowana zdolność będzie zwiększać <span class='red'>absorbcję</span> herosa o <span class='red'>" . $price * $skill->sp_absorb . "</span> [" . $skill->sp_absorb . " na każdy poziom ]<br/>";
    }
开发者ID:WlasnaGra,项目名称:Arena,代码行数:31,代码来源:skills.php


示例11: confirm_logged_in

<?php

require_once 'includes/load.php';
//ucitaj pomocne fajlove
include_once 'includes/header_admin.php';
//ukljuci admin menu
confirm_logged_in();
//potvrdi ulogovanost
if (isset($_GET['id'])) {
    //ako je prosledjen id
    $id = $_GET['id'];
    //preuzmi id
    $news = get_one('news', $id);
    //preuzmi podatke
} else {
    //ako nije prosledjen
    echo redirect('staff.php');
    //prebaci ga na staff.php
}
?>
<!-- POCETAK - prikazi sadrzaj vijesti -->
<h2><?php 
echo $news['title'];
?>
</h2>

<?php 
if (file_exists($news['img_path'])) {
    echo '<center><img src="' . $news['img_path'] . '" width="400"></center>';
}
?>
开发者ID:Ognj3n,项目名称:cms,代码行数:31,代码来源:content.php


示例12: build_end


//.........这里部分代码省略.........
                     //Wiedza o skałach
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_iron_inc = t_iron_inc * 1.1 where t_id = {$town}");
                     } else {
                         call("update towns set t_iron_inc = t_iron_inc * 1.1 where t_id = {$town}");
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                     }
                     break;
                 case 4:
                     //higiena
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_pop_max = t_pop_max * 1.1  where t_id = {$town}");
                     } else {
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                         call("update towns set t_pop_max = t_pop_max * 1.1  where t_id = {$town}");
                     }
                     break;
                 case 5:
                     //magazynynowanie
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_res_max = t_res_max * 1.2  where t_id = {$town}");
                     } else {
                         call("update towns set t_res_max = t_res_max * 1.2  where t_id = {$town}");
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                     }
                     break;
             }
             break;
         case 3:
             //units
             $is_unit = get_one("select go_id from game_objects where go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype} limit 1");
             if (empty($is_unit)) {
                 call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time, go_attack, go_defence, go_life, go_range, go_lvl)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} , {$object->gop_stone} , {$object->gop_iron}, {$object->gop_pop}, {$object->gop_time},{$object->gop_attack}, {$object->gop_defence}, {$object->gop_life}, {$object->gop_range}, {$count})");
             } else {
                 call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + {$count}\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
             }
             break;
         case 10:
             require_once 'functions/SpyMgr.php';
             $SpyMgr = new SpyMgr();
             $newevent->e_t_id = $town;
             $newevent->e_type = $type;
             $newevent->e_subtype = $subtype;
             $newevent->e_count = $count;
             $newevent->e_start = $start;
             $newevent->e_end = $end;
             $SpyMgr->spy_battle($config, $newevent);
             break;
         case 11:
             require_once 'functions/SpyMgr.php';
             $SpyMgr = new SpyMgr();
             $SpyMgr->spy_dismis($config, $town, $count);
             break;
         case 20:
             require_once 'functions/MarketMgr.php';
             $MarketMgr = new MarketMgr();
             $MarketMgr->caravan_unload($config, $subtype, $count);
             $back = $MarketMgr->caravan_back($config, $town, $count);
             break;
         case 21:
             require_once 'functions/MarketMgr.php';
             $MarketMgr = new MarketMgr();
             $MarketMgr->caravan_unload($config, $town, $count);
开发者ID:WlasnaGra,项目名称:Utopia,代码行数:67,代码来源:MainMgr.php


示例13: getUser

function getUser($config)
{
    $player = get_row("select *, unix_timestamp() as tnow from users where usr_id = {$_SESSION['user']}");
    $player->msg = get_one("select count(*) from messages where m_status = 0 and m_type = 1 and  m_to = " . $player->usr_id);
    return $player;
}
开发者ID:WlasnaGra,项目名称:Utopia,代码行数:6,代码来源:core.php


示例14: foreach

$echo = '';
foreach ($player_towns as $town) {
    $echo .= "<LI><a href='?action=town&set_town=" . $town->t_id . "'>{$town->t_name}</a></LI>";
}
echo $echo;
?>
		</UL>
	</div>
</DIV>
<DIV id="content" class="contentNormal">
	<?php 
if (!empty($_POST['name'])) {
    $_POST['name'] = textV($_POST['name']);
    if (!empty($_POST['name'])) {
        if (strlen($_POST['name']) >= 5 && strlen($_POST['name']) <= 15) {
            $ok = get_one("select count(*) from towns where t_name = '" . $_POST['name'] . "'");
            if ($ok > 0) {
                echo "ta nazwa jest zajęta<hr/>";
            } else {
                call("update towns set t_name = '" . $_POST['name'] . "' where t_id = " . $player->town->t_id);
                reload($config, 'town', '');
            }
        } else {
            echo "nieodpowiednia długość nazwy miasta (5-15znaków)<hr/>";
        }
    }
}
?>
	<form action='?action=town' method='post'>
		<input type='text' name='name' value ='<?php 
echo $player->town->t_name;
开发者ID:WlasnaGra,项目名称:Utopia,代码行数:31,代码来源:town.php


示例15: send_app

 public function send_app($config, $player, $clan)
 {
     $clan = (int) $clan;
     $msg = '';
     if ($player->clan_id > 0) {
         $msg = 'jesteś już w klanie';
     } else {
         $can = get_one("select c_id from clans where c_id = " . $clan);
         $is = get_one("select count(*)  from clans_users where cu_c_id = " . $clan . " and cu_usr_id = " . $player->usr_id);
         if (empty($can)) {
             $msg = 'nie ma takiego klanu';
         } elseif ($is > 0) {
             $msg = 'już złożyłeś podanie do tego klanu';
         } else {
             call("insert into clans_users (cu_c_id, cu_usr_id) value (" . $clan . "," . $player->usr_id . ")");
             $msg = 'wysłano podanie ';
         }
     }
     return $msg;
 }
开发者ID:WlasnaGra,项目名称:Utopia,代码行数:20,代码来源:ClanMgr.php


示例16: rand_lucky_phone

function rand_lucky_phone()
{
    //随机拿一条
    $sql = "SELECT * FROM `cxg_phone` AS t1 JOIN (SELECT ROUND(RAND() * ((SELECT MAX(id) FROM `cxg_phone`)-(SELECT MIN(id) FROM `cxg_phone`))+(SELECT MIN(id) FROM `cxg_phone`)) AS id) AS t2 WHERE t1.isLucky = 0 and t1.id >= t2.id ORDER BY t1.id LIMIT 1";
    $data = get_one($sql);
    return $data;
}
开发者ID:Flyu,项目名称:voting4wechat,代码行数:7,代码来源:api.function.php


示例17: intV

}
if (empty($_GET['subtype'])) {
    $_GET['subtype'] = 0;
}
if (empty($_GET['who'])) {
    $_GET['who'] = '';
}
if (empty($_GET['mid'])) {
    $_GET['mid'] = 0;
}
$_GET['mid'] = intV($_GET['mid']);
$_GET['type'] = intV($_GET['type']);
$_GET['subtype'] = intV($_GET['subtype']);
$_GET['who'] = textV($_GET['who']);
if (!empty($_GET['who'])) {
    $who = get_one("select usr_id from arena_users where login = '" . $_GET['who'] . "'");
    $object = get_row("select * from arena_map where m_who = " . $who . " limit 1");
    $player_map = get_row("select * from arena_map where m_who = " . $player->usr_id . " limit 1");
    if (!empty($object)) {
        if ($player_map->m_x >= $object->m_x - 1 && $player_map->m_x <= $object->m_x + 1 && $player_map->m_y >= $object->m_y - 1 && $player_map->m_y <= $object->m_y + 1) {
            echo "\n\t\t\t<div class='highslide-header'><b>" . $_GET['who'] . "</b> [esc - wyjście]\n\t\t\t\t<ul>\n\t\t\t\t\t<li class='highslide-move'>\n\t\t\t\t\t\t<a style='color:#000000'  href='#' style='color:#000000' title='przesuń' onclick='return false'>\n\t\t\t\t\t\t\t<span>&lt;&gt;</span>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</li>\n\t\t\t\t\t<li class='highslide-close'>\n\t\t\t\t\t\t<a style='color:#000000'  href='#' title='zamknij' onclick='hs.height = 120; hs.width = 220; return hs.close(this)'>\n\t\t\t\t\t\t\t<span>zamknij</span>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\n\t\t\t<p>\n\t\t\thello\n\t\t\t</p>\n\t\t\t\n\t\t\t";
        } else {
            echo "\n\t\t\t<div class='highslide-header'><b>" . $_GET['who'] . "</b> [esc - wyjście]\n\t\t\t\t<ul>\n\t\t\t\t\t<li class='highslide-move'>\n\t\t\t\t\t\t<a style='color:#000000'  href='#' title='przesuń' onclick='return false'>\n\t\t\t\t\t\t\t<span>&lt;&gt;</span>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</li>\n\t\t\t\t\t<li class='highslide-close'>\n\t\t\t\t\t\t<a style='color:#000000'  href='#' title='zamknij' onclick='hs.height = 120; hs.width = 220; return hs.close(this)'>\n\t\t\t\t\t\t\t<span>zamknij</span>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\n\t\t\t<p>\n\t\t\tza daleko\n\t\t\t</p>\n\t\t\t\n\t\t\t";
        }
    } else {
        echo "\n\t\t\t<div class='highslide-header'><b>...</b> [esc - wyjście]\n\t\t\t\t<ul>\n\t\t\t\t\t<li class='highslide-move'>\n\t\t\t\t\t\t<a style='color:#000000'  href='#' title='przesuń' onclick='return false'>\n\t\t\t\t\t\t\t<span>&lt;&gt;</span>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</li>\n\t\t\t\t\t<li class='highslide-close'>\n\t\t\t\t\t\t<a style='color:#000000'  href='#' title='zamknij' onclick='hs.height = 120; hs.width = 220; return hs.close(this)'>\n\t\t\t\t\t\t\t<span>zamknij</span>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\n\t\t\t\n\t\t\t";
    }
} else {
    $object = get_row("select * from arena_map left join arena_monsters on mo_id = m_subtype  where m_type = " . $_GET['type'] . " and m_subtype =  " . $_GET['subtype'] . " and m_id = " . $_GET['mid'] . " limit 1");
    $player_map = get_row("select * from arena_map where m_who = " . $player->usr_id . " limit 1");
    if (!empty($object)) {
开发者ID:WlasnaGra,项目名称:Arena,代码行数:31,代码来源:map.php


示例18: confirm_logged_in

<?php

require_once 'includes/load.php';
confirm_logged_in();
if (isset($_GET['id'])) {
    //ako je prosledjen id korisnika kroz URL
    $id = $_GET['id'];
    //preuzmi id
    $user = get_one('users', $id);
    //preuzmi podatke od njemu
    if ($user) {
        //da li postoji takav korisnik u bazi
        $query = "DELETE FROM users WHERE id='{$id}'";
        $result = mysqli_query($conn, $query);
        confirm_query($result);
        if (mysqli_affected_rows($conn) == 1) {
            //provjeri da li je obrisan jedan red iz baze
            echo redirect('logout.php');
            //preusmjeri ga na logout jer taj korisnik vise ne postoji u bazi
        }
    }
}
echo redirect('staff.php');
开发者ID:Ognj3n,项目名称:cms,代码行数:23,代码来源:delete_user.php


示例19: build

 public function build($config, $player, $type, $subtype, $count)
 {
     //mini walidacja, wszystkie dane powinny być liczbowe
     $type = (int) $type;
     $subtype = (int) $subtype;
     $count = (int) $count;
     //jeżeli w dziwny nie wiadomy sposób przesłano ilość mniejszą niż 1 to ustaw = 1
     if ($count < 1) {
         $count = 1;
     }
     //jeżeli budujemy coś innego niż jdnostkę to ilość = 1
     if ($type != 3) {
         $count = 1;
     }
     //ustaw nr błędu = 1 /nieokreślony
     $error = 1;
     //pobierz dane obiektu
     $object = get_row("\n\t\t\tselect * from game_objects_param \n\t\t\tleft join game_objects \n\t\t\ton go_t_id = " . $player->actual_town . "\n\t\t\tand go_gop_id = gop_id\n\t\t\twhere gop_type = " . $type . " and gop_subtype = " . $subtype . "\n\t\t\tlimit 1\n\t\t");
     //jeżeli obiektu nie ma na liście obiektów wybudowanych, to bierz pod uwagę parametry startowe
     if (empty($object->go_id)) {
         if (!empty($object->gop_id)) {
             $object->go_wood = $object->gop_wood;
             $object->go_stone = $object->gop_stone;
             $object->go_iron = $object->gop_iron;
             $object->go_pop = $object->gop_pop;
             $object->go_time = $object->gop_time;
             $object->go_lvl = 0;
         } else {
             //jeżeli w ogóle nie ma takiego obiektu ustaw error = 2
             $error = 2;
         }
     }
     //jeżeli obiekt to jednostka to ustaw max_lvl > lvl (de facto sprawdzane potem, bo przy jednostce nie ma limitów)
     if ($type == 3) {
         $object->gop_max_lvl = $object->go_lvl + 1;
     }
     //jeżeli nie wywaliło erroru 2
     if ($error == 1) {
         $object->go_wood = $object->go_wood * $count;
         $object->go_stone = $object->go_stone * $count;
         $object->go_iron = $object->go_iron * $count;
         $object->go_pop = $object->go_pop * $count;
         $object->go_time = $object->go_time * $count;
         if ($player->town->t_wood < $object->go_wood || $player->town->t_iron < $object->go_iron || $player->town->t_stone < $object->go_stone || $player->town->t_pop_max - $player->town->t_pop < $object->go_pop) {
             //jeżeli za mało surowców ustaw error = 3
             $error = 3;
         } else {
             if ($object->go_lvl == $object->gop_max_lvl) {
                 //jeżeli osiągnięto poziom maksymalny ustaw error = 4
                 $error = 4;
             } else {
                 //jeżeli nie to pobierz ilość aktywnych zdarzeń w kolejce dla danego typu
                 $events_check = get_one("select count(*) from events where e_t_id = " . $player->actual_town . " and e_type = " . $type . " and e_done = 0");
                 // w zależności od typu ustaw limit kolejki
                 switch ($type) {
                     case 1:
                         $max_events = 3;
                         break;
                         //budynki
                     //budynki
                     case 2:
                         $max_events = 2;
                         break;
                         //technologie
                     //technologie
                     case 3:
                         $max_events = 5;
                         break;
                         //jednostki
                     //jednostki
                     default:
                         $max_events = 0;
                         break;
                 }
                 $isbuild = get_one("select count(*) from events where e_t_id = " . $player->actual_town . " and e_type = " . $type . " and e_done = 0 and e_subtype = " . $subtype . "");
                 if ($events_check >= $max_events) {
                     //jeżeli osiągnięto limit kolejki dla danego typu  ustaw error = 5
                     $error = 5;
                 } elseif ($isbuild > 0) {
                     $error = 6;
                 } else {
                     //pobierz ostatni wykonywany element w kolejce
                     $last_event_time = get_one("select e_end from events where e_t_id = " . $player->actual_town . " and e_type = " . $type . " and e_done = 0 order by e_id desc");
                     $utime = get_one("select unix_timestamp()");
                     //jeżeli jest coś w kolejce to ustaw odpowiednio czas
                     if (!empty($last_event_time)) {
                         $start = $last_event_time;
                         $end = $object->go_time + $last_event_time;
                     } else {
                         $start = $utime;
                         $end = $utime + $object->go_time;
                     }
                     //dodaj element do kolejki
                     require_once 'functions/EventsMgr.php';
                     $event = new EventsMgr();
                     $event->event_add($config, $player->actual_town, $type, $subtype, $count, 0, $start, $end, 0);
                     //odejmij surowce
                     require_once 'functions/TownMgr.php';
                     $town = new TownMgr();
                     $town->change_resources($config, $player->actual_town, -$object->go_wood, -$object->go_stone, -$object->go_iron, $object->go_pop);
//.........这里部分代码省略.........
开发者ID:WlasnaGra,项目名称:Utopia,代码行数:101,代码来源:BuildMgr.php


示例20: skill_active

 public function skill_active($config, $player, $skill)
 {
     $skill = intV($skill);
     $can = get_row("select * from arena_skills_param inner join arena_user_skills on us_usr_id = " . $player->usr_id . " and us_sp_id = " . $skill . " where sp_id = " . $skill . " limit 1");
     $limit = get_one("select count(*) from arena_user_skills where us_usr_id = " . $player->usr_id . " and us_active = 1");
     if (empty($can)) {
         $msg = 'nie ma takiego skila';
     } elseif ($limit >= 3) {
         $msg = 'możesz mieć tylko 3 aktywne umiejętności';
     } elseif ($can->us_active == 1) {
         $msg = 'już aktywne';
     } else {
         call("update arena_user_skills set us_active = 1 where us_usr_id = " . $player->usr_id . " and us_sp_id = " . $skill);
         $this->add_stats($config, $player, $can->us_lvl * $can->sp_attack, $can->us_lvl * $can->sp_defence, $can->us_lvl * $can->sp_absorb, $can->us_lvl * $can->sp_life_max, $can->us_lvl * $can->sp_energy_max, $can->us_lvl * $can->sp_life_inc, $can->us_lvl * $can->sp_energy_inc, $can->us_lvl * $can->sp_dam_min, $can->us_lvl * $can->sp_dam_max);
         $msg = 'aktywowano umiejętność';
     }
     return $msg;
 }
开发者ID:WlasnaGra,项目名称:Arena,代码行数:18,代码来源:HeroMgr.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_online_payment_list函数代码示例发布时间:2022-05-15
下一篇:
PHP get_on_clause函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap