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


PHP call函数代码示例

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


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

示例1: indexforum

function indexforum()
{
    global $user;
    if (!$user['guest']) {
        $read = "AND r.user_id = '" . $user['id'] . "'";
    } else {
        $read = '';
    }
    $sql = call('sql_query', "SELECT b.id, b.board_name, b.topics_count, b.posts_count, b.visible, b.last_msg, p.id, p.post_time, p.author_id, p.name_author, p.topic_id, t.replies, b.board_description, r.user_id, r.board_id, p.subject, b.cat FROM forum_boards AS b LEFT OUTER JOIN forum_posts AS p ON p.id = b.last_msg LEFT OUTER JOIN forum_topics AS t ON b.id=t.board_id AND p.topic_id = t.topic_id LEFT OUTER JOIN board_read AS r ON r.board_id = b.id " . $read . " GROUP BY b.id ORDER BY item_order ASC");
    $fetch = array();
    $cats = call('sql_query', "SELECT * FROM forum_categories ORDER BY item_order ASC", 'cache');
    foreach ($cats as $cat) {
        $fetch[$cat['id']] = array('cat_id' => $cat['id'], 'cat_name' => $cat['cat_name'], 'boards' => array());
    }
    while ($row = call('sql_fetch_array', $sql)) {
        if (call('visiblecheck', $user['membergroup_id'], $row[4])) {
            $fetch[$row[16]]['boards'][$row[0]] = array('board_id' => $row[0], 'board_name' => $row[1], 'topics_count' => $row[2], 'post_count' => $row[3], 'visible' => $row[4], 'last_msg' => $row[5], 'post_id' => $row[6], 'post_time' => $row[7], 'author_id' => $row[8], 'name_author' => $row[9], 'topic_id' => $row[10], 'replies' => $row[11], 'board_description' => $row[12], 'read_user_id' => $row[13], 'read_board_id' => $row[14], 'subject' => $row[15], 'subject_shorten' => substr($row[15], 0, 25) . '...');
        }
    }
    foreach ($cats as $cat) {
        //see if there are any boards in a category
        if (!count($fetch[$cat['id']]['boards'])) {
            //looks like there arent any so lets remove the category from display
            unset($fetch[$cat['id']]);
        }
    }
    return $fetch;
}
开发者ID:eodivision,项目名称:eoCMS,代码行数:28,代码来源:indexforum.php

示例2: validate

 public function validate()
 {
     try {
         if (!$this->validate) {
             return true;
         } else {
             if (is_array($this->validate)) {
                 foreach ($this->validate as $validator => $options) {
                     if (!is_null($options)) {
                         if (is_numeric($validator)) {
                             $result = call('v::' . $options, $this->value());
                         } else {
                             $result = call('v::' . $validator, array($this->value(), $options));
                         }
                         if (!$result) {
                             return false;
                         }
                     }
                 }
                 return true;
             } else {
                 return call('v::' . $this->validate, $this->value());
             }
         }
     } catch (Exception $e) {
         return true;
     }
 }
开发者ID:nsteiner,项目名称:kdoc,代码行数:28,代码来源:base.php

示例3: viewtopic

function viewtopic($topicid)
{
    global $settings, $user, $error_die;
    if (isset($topicid) && is_numeric($topicid)) {
        if (!$user['guest']) {
            if ($user['posts_topic'] != '0' && $user['posts_topic'] != '') {
                $settings['posts_topic'] = $user['posts_topic'];
            }
        }
        # how many rows to show per page
        $rowsPerPage = $settings['posts_topic'];
        # by default we show first page
        $pageNum = 1;
        # if $_GET['page'] defined, use it as page number
        if (isset($_GET['page']) && is_numeric($_GET['page'])) {
            $pageNum = $_GET['page'];
        }
        # counting the offset
        $offset = ($pageNum - 1) * $rowsPerPage;
        $sql = call('sql_query', "SELECT u.avatar, u.posts, u.membergroup, u.signature, u.icq, u.aim, u.msn, u.yim, t.board_id, t.thread_title, t.thread_author, t.topic_ip, t.date_created, t.locked, p.id, p.post_time, p.author_id, p.name_author, p.subject, p.message, p.ip, p.disable_smiley, p.modified_time, p.modified_name, p.modified_nameid FROM forum_posts AS p LEFT OUTER JOIN forum_topics AS t ON p.topic_id=t.topic_id LEFT OUTER JOIN users AS u ON p.author_id=u.id WHERE t.topic_id = '{$topicid}' ORDER BY p.id ASC LIMIT {$offset}, {$rowsPerPage}");
        if (call('sql_num_rows', $sql) != 0) {
            $fetch = array();
            while ($row = call('sql_fetch_array', $sql)) {
                $fetch[] = array('avatar' => $row[0], 'posts' => $row[1], 'membergroup' => $row[2], 'signature' => $row[3], 'icq' => $row[4], 'aim' => $row[5], 'msn' => $row[6], 'yim' => $row[7], 'board_id' => $row[8], 'thread_title' => $row[9], 'thread_author' => $row[10], 'topic_ip' => $row[11], 'date_created' => $row[12], 'locked' => $row[13], 'post_id' => $row[14], 'post_time' => $row[15], 'author_id' => $row[16], 'name_author' => $row[17], 'subject' => $row[18], 'message' => $row[19], 'ip' => $row[20], 'disable_smiley' => $row[21], 'modified_time' => $row[22], 'modified_author' => !empty($row[24]) && call('userprofilelink', $row[24]) != false ? call('userprofilelink', $row[24]) : $row[23]);
            }
            # update the number of views in a topic
            $query = call('sql_query', "UPDATE forum_topics SET views = views+1 WHERE topic_id ='{$topicid}'");
            return $fetch;
        } else {
            $error_die[] = 'Error this topic does not exist';
            return false;
        }
    }
}
开发者ID:eodivision,项目名称:eoCMS,代码行数:34,代码来源:viewtopic.php

示例4: news

function news()
{
    global $user;
    // how many rows to show per page
    $rowsPerPage = 5;
    // by default we show first page
    $pageNum = 1;
    // if $_GET['page'] defined, use it as page number
    if (isset($_GET['page']) && is_numeric($_GET['page'])) {
        $pageNum = $_GET['page'];
    }
    // counting the offset
    $offset = ($pageNum - 1) * $rowsPerPage;
    $sql = call('sql_query', "SELECT n.id, n.subject, n.content, n.cat, n.created_by, n.visibility, nc.name, nc.image, n.views, n.time_created, n.extended, COUNT(c.type_id) FROM news n LEFT OUTER JOIN news_categories nc ON n.cat=nc.id LEFT OUTER JOIN comments c ON n.id = c.type_id AND c.comment_type = 'news' WHERE (n.start_time='0' OR n.start_time<=" . time() . " " . (DB_TYPE == 'sqlite' ? "OR n.start_time=''" : "") . ") AND (n.end_time='0' OR n.end_time>=" . time() . " " . (DB_TYPE == 'sqlite' ? "OR n.end_time=''" : "") . ") GROUP BY n.id ORDER BY n.time_created DESC LIMIT {$offset}, {$rowsPerPage}");
    if (call('sql_num_rows', $sql) == 0) {
        return false;
    }
    $fetch = array();
    while ($row = call('sql_fetch_array', $sql)) {
        if (call('visiblecheck', $user['membergroup_id'], $row[5])) {
            $fetch[] = array('news_id' => $row[0], 'subject' => $row[1], 'content' => $row[2], 'cat_id' => $row[3], 'created_by' => $row[4], 'visibility' => $row[5], 'cat_name' => $row[6], 'cat_image' => $row[7], 'views' => $row[8], 'time_created' => $row[9], 'extended' => $row[10], 'comments' => $row[11]);
        }
    }
    return $fetch;
}
开发者ID:eodivision,项目名称:eoCMS,代码行数:25,代码来源:news.php

示例5: addemoticon

function addemoticon($code, $image, $text)
{
    global $user, $error, $error_die;
    if (!$user['admin_panel']) {
        $error_die[] = 'You do not have permission to do this';
        //No one should be able to actually use this function except an admin, its there just to be safe ;)
        return false;
    }
    if (empty($code)) {
        $error[] = 'You must specify the code';
        return false;
    }
    if (empty($image)) {
        $error[] = 'You must specify an image';
        return false;
    }
    if (empty($text)) {
        $error[] = 'You must specify text';
        return false;
    }
    $code = str_replace(array("\"", "'"), '', $code);
    if (!errors()) {
        $query = call('sql_query', "INSERT INTO emoticons (code, image, alt) VALUES ('{$code}', '{$image}', '{$text}')");
        if ($query) {
            return true;
        }
    }
}
开发者ID:eodivision,项目名称:eoCMS,代码行数:28,代码来源:addemoticon.php

示例6: move

 protected function move()
 {
     $source = $this->source();
     if (is_null($source['name']) or is_null($source['tmp_name'])) {
         throw new Error('The file has not been found', static::ERROR_MISSING_FILE);
     }
     if ($source['error'] !== 0) {
         throw new Error('The upload failed', static::ERROR_FAILED_UPLOAD);
     }
     if (file_exists($this->to()) and $this->options['overwrite'] === false) {
         throw new Error('The file exists and cannot be overwritten', static::ERROR_UNALLOWED_OVERWRITE);
     }
     if ($source['size'] > $this->options['maxSize']) {
         throw new Error('The file is too big', static::ERROR_FILE_TOO_BIG);
     }
     if (is_callable($this->options['accept'])) {
         $accepted = call($this->options['accept'], new Media($source['tmp_name']));
         if ($accepted === false) {
             throw new Error('The file is not accepted by the server', static::ERROR_UNACCEPTED);
         }
     }
     if (!@move_uploaded_file($source['tmp_name'], $this->to())) {
         throw new Error('The file could not be moved', static::ERROR_MOVE_FAILED);
     }
 }
开发者ID:chrishiam,项目名称:LVSL,代码行数:25,代码来源:upload.php

示例7: editemoticon

function editemoticon($code, $image, $text, $id)
{
    global $user, $error, $error_die;
    if (!$user['admin_panel']) {
        $error_die[] = 'You do not have permission to do this';
        //No one should be able to actually use this function except an admin, its there just to be safe ;)
        return false;
    }
    if (empty($code)) {
        $error[] = 'You must specify the code';
        return false;
    }
    if (empty($image)) {
        $error[] = 'You must specify an image';
        return false;
    }
    if (empty($text)) {
        $error[] = 'You must specify text';
        return false;
    }
    if (!errors()) {
        $query = call('sql_query', "UPDATE emoticons SET code='{$code}', image='{$image}', alt='{$text}' WHERE id='{$id}'");
        if ($query) {
            return true;
        }
    }
}
开发者ID:eodivision,项目名称:eoCMS,代码行数:27,代码来源:editemoticon.php

示例8: klan_odrzuc_podanie

function klan_odrzuc_podanie($gracz, $id)
{
    //zabezpiecz zmienne
    $id = (int) $id;
    //jeżeli gracz nie jest  w klanie to nie może nic usunąć
    if ($gracz['id_klanu'] == 0) {
        $msg = "nie jesteś w klanie";
    } else {
        //sprawdź rangę gracza w klanie
        $ranga = one("select status from tribal_klany_gracze where gracz_id = " . $gracz['gracz'] . " and klan_id = " . $gracz['id_klanu'] . " limit 1");
        //jeżeli to nie mistrz klanu to nie może usunąć nic
        if ($ranga == 1) {
            $msg = "nie jesteś mistrzem klanu ani jego zastępcą";
        } else {
            //odrzuć podanie
            call("delete from tribal_klany_gracze where id = " . $id . " and klan_id = " . $gracz['id_klanu'] . " and status = 0");
            //nic nie usunięto
            if (mysql_affected_rows() == 0) {
                $msg = "nie ma takiego podania";
            } else {
                //odrzucono podanie
                $msg = "odrzucono podanie";
            }
        }
    }
    return $msg;
}
开发者ID:WlasnaGra,项目名称:Tribal,代码行数:27,代码来源:klan_odrzuc_podanie.php

示例9: usersonline

function usersonline()
{
    global $user;
    //set the amount of time the number of guests and users stored as online
    $timeout = time() - 600;
    //delete anyone that is greate than the $timeout
    $deleteuseronline = call('sql_query', "DELETE FROM user_online WHERE time_online<{$timeout}");
    if ($user['guest']) {
        //visiting person is a guest, check to see if they are already in the table
        $check_table = call('sql_query', "SELECT ip FROM user_online WHERE ip = '" . call('visitor_ip') . "'");
    } else {
        //person is a user, check to see if they are in the table
        $check_table = call('sql_query', "SELECT user_id FROM user_online WHERE user_id = '" . $user['id'] . "'");
    }
    //check the number of rows returned, if 0 insert them
    if (call('sql_num_rows', $check_table) == 0) {
        if ($user['guest']) {
            //insert user as a guest
            $insertuseronline = call('sql_query', "INSERT INTO user_online (user_id, time_online, ip) VALUES ('0', '" . time() . "', '" . call('visitor_ip') . "')");
        } else {
            //insert user
            $insertuseronline = call('sql_query', "INSERT INTO user_online (user_id, time_online, ip) VALUES ('" . $user['id'] . "', '" . time() . "', '" . call('visitor_ip') . "')");
            //update the last active
            call('sql_query', "UPDATE users SET lastlogin = '" . time() . "', time_online = '" . ($user['time_online'] + 600) . "' WHERE id = '" . $user['id'] . "'");
        }
    }
}
开发者ID:eodivision,项目名称:eoCMS,代码行数:27,代码来源:usersonline.php

示例10: route

 public function route($model, $form, $fieldName, $fieldType, $path)
 {
     $field = $form->fields()->{$fieldName};
     if (!$field or $field->type() !== $fieldType) {
         throw new Exception('Invalid field');
     }
     $routes = $field->routes();
     $router = new Router($routes);
     if ($route = $router->run($path)) {
         if (is_callable($route->action()) and is_a($route->action(), 'Closure')) {
             return call($route->action(), $route->arguments());
         } else {
             $controllerFile = $field->root() . DS . 'controller.php';
             $controllerName = $fieldType . 'FieldController';
             if (!file_exists($controllerFile)) {
                 throw new Exception(l('fields.error.missing.controller'));
             }
             require_once $controllerFile;
             if (!class_exists($controllerName)) {
                 throw new Exception(l('fields.error.missing.class'));
             }
             $controller = new $controllerName($model, $field);
             return call(array($controller, $route->action()), $route->arguments());
         }
     } else {
         throw new Exception(l('fields.error.route.invalid'));
     }
 }
开发者ID:irenehilber,项目名称:kirby-base,代码行数:28,代码来源:field.php

示例11: showposts

function showposts($id)
{
    global $settings, $user;
    if (!$user['guest']) {
        if ($user['posts_topic'] != '0' && $user['posts_topic'] != '') {
            $settings['posts_topic'] = $user['posts_topic'];
        }
    }
    // how many rows to show per page
    $rowsPerPage = $settings['posts_topic'];
    // by default we show first page
    $pageNum = 1;
    // if $_GET['page'] defined, use it as page number
    if (isset($_GET['page'])) {
        $pageNum = $_GET['page'];
    }
    // counting the offset
    $offset = ($pageNum - 1) * $rowsPerPage;
    $sql = call('sql_query', "SELECT t.board_id, p.id, p.post_time, p.subject, p.message, p.disable_smiley, b.visible, b.board_name, t.replies, t.topic_id FROM forum_posts AS p LEFT OUTER JOIN forum_topics AS t ON p.topic_id=t.topic_id LEFT OUTER JOIN forum_boards AS b ON t.board_id = b.id WHERE p.author_id = '{$id}' ORDER BY p.post_time DESC LIMIT {$offset}, {$rowsPerPage}");
    $num = call('sql_num_rows', $sql);
    if ($num != 0) {
        $fetch = array();
        while ($row = call('sql_fetch_array', $sql)) {
            if (call('visiblecheck', $user['membergroup_id'], $row[6])) {
                $fetch[] = array('board_id' => $row[0], 'post_id' => $row[1], 'post_time' => $row[2], 'subject' => $row[3], 'message' => $row[4], 'disable_smiley' => $row[5], 'board_name' => $row[7], 'replies' => ceil($row[8] / $settings['posts_topic']), 'topic_id' => $row[9]);
            }
        }
        $fetch['num'] = $num;
        return $fetch;
    }
}
开发者ID:eodivision,项目名称:eoCMS,代码行数:31,代码来源:showposts.php

示例12: addarticle

function addarticle($subject, $summary, $full_article, $cat, $rating, $comment)
{
    global $user, $error, $error_die;
    if (!$user['admin_panel']) {
        $error_die = 'You do not have permission to do this';
        //No one should be able to actually use this function except an admin, its there just to be safe ;)
        return false;
    }
    if (empty($subject)) {
        $error[] = 'You must specify a subject';
        return false;
    }
    if (empty($summary)) {
        $error[] = 'You must specify a summary';
        return false;
    }
    if (!isset($comment)) {
        $comment = 0;
    } else {
        $comment = 1;
    }
    if (!isset($rating)) {
        $rating = 0;
    } else {
        $rating = 1;
    }
    if (empty($error) && empty($error_die)) {
        $query = call('sql_query', "INSERT INTO articles (subject, summary, full_article, time_created, author_id, name_author, cat, views, ratings, comments) VALUES ('{$subject}', '{$summary}', '{$full_article}', '" . time() . "', '" . $user['id'] . "', '" . $user['user'] . "', '{$cat}', '0', '{$rating}', '{$comment}')");
        if ($query) {
            return true;
        }
    }
}
开发者ID:eodivision,项目名称:eoCMS,代码行数:33,代码来源:addarticle.php

示例13: zaloz_ciuch

function zaloz_ciuch($gracz, $id)
{
    $gracz = (int) $gracz;
    $id = (int) $id;
    $dane = row("select * from driver_gracze where gracz = " . $gracz);
    $ciuch = row($q = "select * from driver_ciuchy_gracze   inner join driver_ciuchy on id = c_id and gracz_id = " . $gracz . " where id = {$id} and status = 0 and gracz_id = " . $gracz . "");
    if (empty($ciuch)) {
        return "nie masz takiego sprzętu";
    } else {
        switch ($ciuch['typ']) {
            case 1:
                $zajety = one("select 1 from driver_ciuchy_gracze inner join driver_ciuchy on c_id = id where typ = 1 and status = 1 and gracz_id = " . $gracz);
                break;
            case 2:
                $zajety = one("select 1 from driver_ciuchy_gracze inner join driver_ciuchy on c_id = id where typ = 2 and status = 1 and gracz_id = " . $gracz);
                break;
            case 3:
                $zajety = one("select 1 from driver_ciuchy_gracze inner join driver_ciuchy on c_id = id where typ = 3 and status = 1 and gracz_id = " . $gracz);
                break;
            case 4:
                $zajety = one("select 1 from driver_ciuchy_gracze inner join driver_ciuchy on c_id = id where typ = 4 and status = 1 and gracz_id = " . $gracz);
                break;
        }
        if ($zajety == 1) {
            return "masz już założony sprzęt tego typu";
        }
        call("update driver_gracze set bonus_vmax = bonus_vmax + " . $ciuch['vmax'] . ", bonus_do100 = bonus_do100 + " . $ciuch['do100'] . " where gracz = {$gracz}");
        call("update driver_ciuchy_gracze set status = 1 where gracz_id = {$gracz} and c_id = {$id} limit 1");
        return "założono sprzęt";
    }
}
开发者ID:WlasnaGra,项目名称:Driver,代码行数:31,代码来源:zaloz_ciuch.php

示例14: szpiegowanie

function szpiegowanie($event)
{
    fx('dodaj_event');
    //atakujący
    $miasto1 = row("select * from tribal_miasta inner join tribal_gracze on gracz_id = gracz where miasto = " . $event['miasto_id']);
    //obrońca
    $miasto2 = row("select * from tribal_miasta inner join tribal_gracze on gracz_id = gracz  where miasto = " . $event['podtyp']);
    //pobierz dane broniących się szpiegów
    $obronca = row("select * from tribal_jednostki_miasta inner join tribal_jednostki on jednostka_id = jednostka where miasto_id = " . $event['podtyp'] . " and jednostka_id = 5 and ilosc > 0");
    $tekst1 = "Twoi szpiedzy z miasta " . $miasto1['nazwa'] . " szpiegują miasto " . $miasto2['nazwa'] . "<br/>";
    if (empty($obronca)) {
        $tekst1 .= "Nie napotkano oporu<br/>";
        $tekst2 = "Szpiedzy z wrogiego  szpiegują Twoje miasto " . $miasto2['nazwa'] . "<br/>";
    } else {
        //zabij odpowiednią ilość szpiegów po obu stronach
        $ilu = $event['ilosc'];
        $event['ilosc'] -= $obronca['ilosc'];
        $obronca['ilosc'] -= $ilu;
        if ($event['ilosc'] < 0) {
            $event['ilosc'] = 0;
        }
        if ($obronca['ilosc'] < 0) {
            $obronca['ilosc'] = 0;
        }
        //jeżeli obrońca w ogóle zabił jakiegoś szpiego to pokaż mu info z którego miasta przyszedł atak
        if ($ilu == $event['ilosc']) {
            $tekst2 = "Szpiedzy z miasta " . $miasto1['nazwa'] . " szpiegują Twoje miasto " . $miasto2['nazwa'] . "<br/>";
        } else {
            $tekst2 = "Szpiedzy z wrogiego  szpiegują Twoje miasto " . $miasto2['nazwa'] . "<br/>";
        }
    }
    if (empty($obronca['ilosc']) && !empty($event['ilosc'])) {
        $zwyciezca = 1;
        //zabij obrońcę
        call("update tribal_jednostki_miasta set ilosc = 0 where miasto_id = " . $miasto2['miasto'] . " and jednostka_id = 5");
        $tekst1 .= "Udało Ci się przeszpiegować miasto<br/>\n\t\t\tZdobyte informacje:<br/>\n\t\t\tDrewno: " . $miasto2['drewno'] . "\n\t\t\tKamień: " . $miasto2['kamien'] . "\n\t\t\tŻelazo: " . $miasto2['zelazo'] . "\n\t\t\tJedzenie: " . $miasto2['jedzenie'] . "\n\t\t\tPopulacja: " . $miasto2['populacja'] . "/" . $miasto2['populacja_max'] . "\n\t\t\t";
        $tekst2 .= "Twoi szpiedzy ponieśli klęskę<br/>";
    } elseif (empty($obronca['ilosc']) && empty($event['ilosc'])) {
        $zwyciezca = 0;
        //zabij obrońcę
        call("update tribal_jednostki_miasta set ilosc = 0 where miasto_id = " . $miasto2['miasto'] . " and jednostka_id = 5");
        $tekst1 .= "Twoi szpiedzy ponieśli klęskę<br/>";
        $tekst2 .= "Twoi szpiedzy zginęli ale nie dopuścili do infiltracji miasta<br/>";
    } else {
        $zwyciezca = 2;
        //zabij obrońcę
        call("update tribal_jednostki_miasta set ilosc = " . $obronca['ilosc'] . " where miasto_id = " . $miasto2['miasto'] . " and jednostka_id = 5");
        $tekst1 .= "Twoi szpiedzy ponieśli klęskę<br/>";
        $tekst2 .= "Twoi szpiedzy nie dopuścili do infiltracji miasta<br/>";
    }
    fx('wiadomosc_wyslij');
    $a = wiadomosc_wyslij(1, $miasto1['login'], $tekst1);
    $a = wiadomosc_wyslij(1, $miasto2['login'], $tekst2);
    if ($zwyciezca == 1) {
        //jeżeli wygrał to resztę szpiegów wyślij do domu
        $czas = $event['koniec'] - $event['start'];
        fx('dodaj_event');
        dodaj_event($event['miasto_id'], 21, $event['podtyp'], $event['ilosc'], $czas);
    }
}
开发者ID:WlasnaGra,项目名称:Tribal,代码行数:60,代码来源:szpiegowanie.php

示例15: ulepsz_auto

function ulepsz_auto($gracz, $id, $czesc)
{
    //zabezpiecz zmienne
    $gracz = (int) $gracz;
    $id = (int) $id;
    $czesc = (int) $czesc;
    //pobierz dane auta o podanym $id - sprawdź czy gracz takie posiada
    $auto = row("select * from driver_auta_gracze where id_gracza = {$gracz} and id_auta = {$id} limit 1");
    if (empty($auto)) {
        //jeżeli nie ma takiego auta
        return "nie ma takiego auta";
    } else {
        $sprzet = row("select * from driver_czesci where czesc = {$czesc} ");
        if (empty($sprzet)) {
            return "nie ma takiej części";
        } else {
            //pobierz dane gracza
            $data = row("select * from driver_gracze where gracz = {$gracz}");
            //jeżeli gracz ma za mało kasy
            if ($data['kasa'] < $sprzet['cena']) {
                return "masz za mało gotówki";
            } else {
                //ma kasę, zapłać za sprzęt
                call("update driver_gracze set kasa = kasa - " . $sprzet['cena'] . " where gracz = {$gracz}");
                call("update driver_auta_gracze set vmax = vmax + " . $sprzet['vmax'] . ", do100 = do100 + " . $sprzet['do100'] . ", wartosc = wartosc + " . $sprzet['cena'] * 0.9 . " where id_gracza = {$gracz} and id_auta = {$id} limit 1");
                call("update driver_auta_gracze set do100 = 3 where do100 < 3");
                return "ulepszono auto";
            }
        }
    }
}
开发者ID:WlasnaGra,项目名称:Driver,代码行数:31,代码来源:ulepsz_auto.php


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