本文整理汇总了PHP中create_error函数的典型用法代码示例。如果您正苦于以下问题:PHP create_error函数的具体用法?PHP create_error怎么用?PHP create_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create_error
if ($player->is_fed_protected()) {
create_error("You are under federal protection! That wouldn't be fair.");
}
if (!$sector->has_port()) {
create_error("There is no port in that sector!");
}
// check if he got enough turns
if ($player->get_info('turns') < 3) {
create_error("You do not have enough turns to attack this port!");
}
$db->query("SELECT * FROM ship_has_weapon NATURAL JOIN weapon_type " . "WHERE account_id = {$player->account_id} AND " . "game_id = {$player->game_id} " . "ORDER BY order_id");
if (!$db->next_record()) {
//do we have drones to attack?
$db->query("SELECT * FROM ship_has_hardware WHERE hardware_type_id = HARDWARE_COMBAT AND account_id = {$player->account_id} AND game_id = {$player->game_id}");
if (!$db->next_record()) {
create_error("What are you gonna do? Insult it to death?");
}
}
//set the attack start time
$time = time();
//only 1 shot per 2 seconds (stop double port raids)
$db->lock("port_attack_times");
//init vars
$db->query("SELECT * FROM port_attack_times WHERE game_id = {$player->game_id} AND sector_id = {$player->sector_id}");
if ($db->next_record()) {
$att_time = $db->f("time");
} else {
$att_time = 0;
}
while ($att_time + 2 >= $time) {
usleep(50000);
示例2: create_error
<?php
if ($account->isVeteran()) {
create_error('You cannot join a newbie game, shooo!');
}
require_once ENGINE . 'Default/game_join.php';
示例3: create_error
//(22,25,23,75,43,55,61,24,21,38,67,33,49)
// Top racials minus ATM + top UG/FED are restricted
if ($newShip['AlignRestriction'] == 2 && $player->getAlignment() > -100) {
create_error('You can\'t buy smuggler ships!');
}
if ($newShip['AlignRestriction'] == 1 && $player->getAlignment() < 100) {
create_error('You can\'t buy federal ships!');
}
if ($newShip['RaceID'] != 1 && $player->getRaceID() != $newShip['RaceID']) {
create_error('You can\'t buy other race\'s ships!');
}
/*if ($player->getAccountID() == 101)
create_error('Cheaters do NOT get ships!');*/
// do we have enough cash?
if ($player->getCredits() < $cost) {
create_error('You do not have enough cash to purchase this ship!');
}
// adapt turns
$player->setTurns(round($player->getTurns() * $newShip['Speed'] / $ship->getSpeed()));
//Don't times by game speed as getSpeed doesn't include it meaning ratio will be the same but less work.
// take the money from the user
if ($cost > 0) {
$player->decreaseCredits($cost);
} else {
$player->increaseCredits(-$cost);
}
// assign the new ship
$ship->decloak();
$ship->disableIllusion();
$ship->setShipTypeID($shipID);
// update again
示例4: create_error
}
// now transfer
$planet->shields += $amount;
$ship->hardware[1] -= $amount;
$account->log(11, "Player puts {$amount} shields on planet.", $player->sector_id);
// do the user wants to transfer drones?
} else {
if ($type_id == 4) {
// do we want transfer more than we have?
if ($amount > $ship->hardware[4]) {
create_error("You can't transfer more combat drones than you carry!");
}
// do we want to transfer more than we can carry?
if ($amount + $planet->drones > $planet->construction[2] * 20) {
create_error("The planet can't hold more than " . $planet->construction[2] * 20 . " drones!");
}
// now transfer
$planet->drones += $amount;
$ship->hardware[4] -= $amount;
$account->log(11, "Player puts {$amount} drones on planet.", $player->sector_id);
}
}
} else {
create_error("You must choose if you want to transfer to planet or to the ship!");
}
$ship->mark_seen();
// update both
$planet->update();
$ship->update_hardware();
$ship->mark_seen();
forward(create_container("skeleton.php", "planet_defense.php"));
示例5: create_error
}
} else {
create_error($access_token, 'PHP', 'init_user.php', 'No user found.', $db);
die('No user found.');
}
$result_token = mysql_query("select * from access_token where token = '" . $keyTok . "'", $db);
$row_token = mysql_fetch_array($result_token, MYSQL_ASSOC);
if ($row_user['password'] == $password) {
$row_array['accessTok'] = $row_token['token'];
$row_array['username'] = $row_user['username'];
$row_array['email'] = $row_user['email'];
} else {
create_error($access_token, 'PHP', 'init_user.php', 'Wrong password!', $db);
die('Wrong password!');
}
$session_get_query = mysql_query("select * from session where user_id = '" . $userId . "'", $db);
if (mysql_num_rows($session_get_query) > 0) {
} else {
$session_insert_query = mysql_query("insert into session (user_id) values('" . $userId . "')", $db);
}
if (!$session_get_query || mysql_num_rows($session_get_query) <= 0) {
create_error($access_token, 'PHP', 'init_user.php', 'No session found', $db);
die('No session found');
}
$session_get_row = mysql_fetch_array($session_get_query, MYSQL_ASSOC);
$sessionId = $session_get_row['id'];
$time_of_creation = date("Y/m/d H:i:s");
$history_insert_query = mysql_query("insert into history (session_id,time_of_creation) values('" . $sessionId . "','" . $time_of_creation . "')", $db);
echo json_encode($row_array);
//Close the database connection
mysql_close($db);
示例6: create_error
<?php
$notify_id = $_REQUEST['notify_id'];
if (!isset($notify_id)) {
create_error('You must choose the messages you want to delete.');
}
$db->query('DELETE FROM message_notify WHERE notify_id IN (' . $db->escapeArray($notify_id) . ')');
forward(create_container('skeleton.php', 'notify_view.php'));
示例7: IN
} else {
if ($var['task'] == 'reset_website') {
$db->query('UPDATE album SET website = \'\' WHERE account_id = ' . $db->escapeNumber($account_id));
} else {
if ($var['task'] == 'reset_birthdate') {
$db->query('UPDATE album SET day = 0, month = 0, year = 0 WHERE account_id = ' . $db->escapeNumber($account_id));
} else {
if ($var['task'] == 'reset_other') {
$db->query('UPDATE album SET other = \'\' WHERE account_id = ' . $db->escapeNumber($account_id));
} else {
if ($var['task'] == 'delete_comment') {
$comment_ids = $_REQUEST['comment_ids'];
// we just ignore if nothing was set
if (count($comment_ids) > 0) {
$db->query('DELETE
FROM album_has_comments
WHERE album_id = ' . $db->escapeNumber($account_id) . ' AND
comment_id IN (' . $db->escapeArray($comment_ids) . ')');
}
} else {
create_error('No action chosen!');
}
}
}
}
}
}
}
$container = create_container('skeleton.php', 'album_moderate.php');
transfer('account_id');
forward($container);
示例8: define
<?php
if (isset($var['alliance_id'])) {
$alliance_id = $var['alliance_id'];
} else {
$alliance_id = $player->alliance_id;
}
define('WITHDRAW', 0);
define('DEPOSIT', 1);
print_topic('Alliance Bank Report');
include get_file_loc('menue.inc');
print_bank_menue();
//get all transactions
$db->query("SELECT * FROM alliance_bank_transactions WHERE alliance_id = {$alliance_id} AND game_id = {$player->game_id}");
if (!$db->nf()) {
create_error("Your alliance has no recorded transactions");
}
while ($db->next_record()) {
if ($db->f("transaction") == 'Payment') {
if (!$db->f("exempt")) {
$trans[$db->f("payee_id")][WITHDRAW] += $db->f("amount");
} else {
$trans[0][WITHDRAW] += $db->f("amount");
}
} else {
if (!$db->f("exempt")) {
$trans[$db->f("payee_id")][DEPOSIT] += $db->f("amount");
} else {
$trans[0][DEPOSIT] += $db->f("amount");
}
}
示例9: getFleet
function getFleet(&$players, &$weapons)
{
if (DEBUG) {
print "Get Fleet<br>";
}
global $db, $session, $player;
$player_ids = array_keys($players);
$fleet = array();
// Is there a fed beacon in the sector?
$db->query('SELECT
location_type_id
FROM
location
WHERE location_type_id=201
AND sector_id=' . $player->sector_id . '
AND game_id=' . SmrSession::$game_id . '
LIMIT 1');
if ($db->next_record()) {
$have_beacon = TRUE;
$db->query('SELECT account_id FROM ship_has_cargo WHERE good_id IN (5,9,12) AND game_id=' . SmrSession::$game_id . ' AND account_id IN (' . implode(',', $player_ids) . ')');
while ($db->next_record()) {
$illegal_goods[$db->f('account_id')] = TRUE;
}
} else {
$have_beacon = FALSE;
}
foreach ($player_ids as $account_id) {
// Remove players that are fed protected from the fighting
if ($have_beacon && !isset($illegal_goods[$account_id]) && protected_rating($account_id, $players, $weapons)) {
// Player and their target must not have dropped into fed protection
if ($account_id == $player->account_id) {
create_error("You are under federal protection");
}
unset($players[$account_id]);
} else {
if ($account_id != $player->account_id) {
// We add the player and target to the fleet after capping
if ($players[$account_id][ALLIANCE_ID] == $player->alliance_id) {
$fleet[] = $account_id;
} else {
$fleet[] = $account_id;
}
}
}
}
// Cap fleet to the required size
$fleet_size = count($fleet);
if ($fleet_size > MAXIMUM_FLEET_SIZE - 1) {
// We shuffle to stop the same people being capped all the time
shuffle($fleet);
$temp = array();
$count = 0;
for ($j = 0; $j < $fleet_size; ++$j) {
if ($count < MAXIMUM_FLEET_SIZE - 1) {
$temp[] = $fleet[$j];
} else {
unset($players[$fleet[$j]]);
}
++$count;
}
$fleet = $temp;
}
// Add the inital combatants to their respective fleets
$fleet[] = (int) SmrSession::$old_account_id;
// Shuffle for random firing order
shuffle($fleet);
return $fleet;
}
示例10: mysql_fetch_array
}
$row_user = mysql_fetch_array($user, MYSQL_ASSOC);
$userId = $row_user['user_id'];
$gallery = mysql_query("select * from user where id = '" . $userId . "' and exclude = '0'", $db);
if (!$gallery || mysql_num_rows($gallery) <= 0) {
create_error($access_token, 'PHP', 'set_artist_status.php', 'No gallery found', $db);
die('No gallery found');
}
$row_gallery = mysql_fetch_array($gallery, MYSQL_ASSOC);
$galleryId = $row_gallery['gallery_id'];
if ($artist_status == 'true') {
$artist_update = mysql_query("update artist set display='1' where id='" . $artistId . "' and gallery_id='" . $galleryId . "'", $db);
$artwork_update = mysql_query("update artwork set display='1' where artist_id='" . $artistId . "'", $db);
if (!$artwork_update) {
create_error($access_token, 'PHP', 'set_artist_status.php', 'Not able to update the status of the artwork', $db);
die('Not able to update the status of the artwork');
}
} else {
$artist_update = mysql_query("update artist set display='0' where id='" . $artistId . "' and gallery_id='" . $galleryId . "'", $db);
$artwork_update = mysql_query("update artwork set display='0' where artist_id='" . $artistId . "'", $db);
if (!$artwork_update) {
create_error($access_token, 'PHP', 'set_artist_status.php', 'Not able to update the status of the artwork', $db);
die('Not able to update the status of the artwork');
}
}
if (!$artist_update) {
create_error($access_token, 'PHP', 'set_artist_status.php', 'Not able to update the status of the artist', $db);
die('Not able to update the status of the artist');
}
//Close the database connection
mysql_close($db);
示例11: mysql_connect
$db_name = $ini_array['db_name'];
$db_username = $ini_array['db_username'];
$db_password = $ini_array['db_password'];
##########################################
$db = mysql_connect($db_ip, $db_username, $db_password) or die("Could not connect");
mysql_select_db($db_name) or die("Could not select database");
include 'create_error.php';
//Get all information
$access_token = $_POST['access_token'];
if (!isset($access_token)) {
create_error('-', 'PHP', 'get_information.php', 'Access Token is Missing!', $db);
die('Access Token ID is Missing!');
}
$access = mysql_query("select * from access_token where token = '" . $access_token . "'", $db);
if (!$access || mysql_num_rows($access) <= 0) {
create_error($access_token, 'PHP', 'get_information.php', 'No user found', $db);
die('No user found');
}
$access_row = mysql_fetch_array($access, MYSQL_ASSOC);
$userId = $access_row['user_id'];
$infoForGallery = mysql_query("select * from info_for_user inner join information on info_for_user.info_id = information.id where user_id = '" . $userId . "'", $db);
$json_response_infos = array();
while ($row_infoForGallery = mysql_fetch_array($infoForGallery, MYSQL_ASSOC)) {
$row_array['id'] = $row_infoForGallery['info_id'];
$row_array['time'] = $row_infoForGallery['time'];
$row_array['message'] = $row_infoForGallery['message'];
array_push($json_response_infos, $row_array);
}
echo json_encode($json_response_infos);
//Close the database connection
mysql_close($db);
示例12: die
die('No session found');
}
$session_row = mysql_fetch_array($session, MYSQL_ASSOC);
$row_options['session'] = $session_row['id'];
$user = mysql_query("select * from user where id = '" . $userId . "' and exclude = '0'", $db);
if (!$user || mysql_num_rows($user) <= 0) {
create_error($access_token, 'PHP', 'get_errors.php', 'No user found', $db);
die('No user found');
}
$user_row = mysql_fetch_array($user, MYSQL_ASSOC);
$galleryId = $user_row['gallery_id'];
$optionId = $user_row['settings_id'];
$sectionId = $user_row['section_id'];
$section = mysql_query("select * from section where id = '" . $sectionId . "'", $db);
if (!$section || mysql_num_rows($section) <= 0) {
create_error($access_token, 'PHP', 'get_errors.php', 'No section found', $db);
die('No section found');
}
$section_row = mysql_fetch_array($section, MYSQL_ASSOC);
$sectionRef = $section_row['ref'];
if ($sectionRef == 1000 || $sectionRef == '1000') {
$result_errors = mysql_query("select * from error", $db);
$json_response_errors = array();
while ($row = mysql_fetch_array($result_errors, MYSQL_ASSOC)) {
$row_array['id'] = $row['id'];
$row_array['reference'] = $row['reference'];
$row_array['source_file'] = $row['source'];
$row_array['time'] = $row['time'];
$row_array['message'] = utf8_encode($row['message']);
$result_user = mysql_query("select user.username as username, gallery.name as gallery_name from user inner join gallery on user.gallery_id = gallery.id where user.id = '" . $row_array['user_id'] . "'", $db);
$user_row = mysql_fetch_array($section, MYSQL_ASSOC);
示例13: array
<?php
$action = $_REQUEST['action'];
if ($action == 'Skip >>') {
$container = array();
$container['url'] = 'skeleton.php';
$container['body'] = 'universe_create_ports.php';
$container['game_id'] = $var['game_id'];
forward($container);
}
$id = $_REQUEST['id'];
if (!isset($id)) {
create_error('Error while transmitting data from previous form!');
}
include get_file_loc('universe_create_location.inc');
foreach ($id as $location_type_id => $location_array) {
// first we deal with race HQ
if ($location_type_id == GOVERNMENT) {
foreach ($location_array as $galaxy_id => $hq_type) {
// 1 means no hq
if ($hq_type == 1) {
continue;
}
// put actual hq in
$hq_sector = create_location($var['game_id'], $galaxy_id, GOVERNMENT + $hq_type);
// ship shop and co (for racials only)
create_location($var['game_id'], $galaxy_id, RACIAL_SHIPS + $hq_type - 1, $hq_sector);
create_location($var['game_id'], $galaxy_id, RACIAL_SHOPS + $hq_type - 1, $hq_sector);
// create fed around hq
create_fed($var['game_id'], $galaxy_id, $hq_sector);
}
示例14: create_error
<?php
$sector =& $player->getSector();
if (!$sector->isLinked($var['target_sector']) && $sector->getSectorID() != $var['target_sector']) {
create_error('You cannot scan a sector you are not linked to.');
}
// initialize vars
$scanSector =& SmrSector::getSector($player->getGameID(), $var['target_sector']);
$template->assign('PageTopic', 'Sector Scan of #' . $scanSector->getSectorID() . ' (' . $scanSector->getGalaxyName() . ')');
$friendly_forces = 0;
$enemy_forces = 0;
$friendly_vessel = 0;
$enemy_vessel = 0;
// iterate over all forces in the target sector
$scanSectorAllForces =& $scanSector->getForces();
foreach ($scanSectorAllForces as &$scanSectorForces) {
// decide if it's a friendly or enemy stack
if ($player->sameAlliance($scanSectorForces->getOwner())) {
$friendly_forces += $scanSectorForces->getMines() * 3 + $scanSectorForces->getCDs() * 2 + $scanSectorForces->getSDs();
} else {
$enemy_forces += $scanSectorForces->getMines() * 3 + $scanSectorForces->getCDs() * 2 + $scanSectorForces->getSDs();
}
}
unset($scanSectorForces);
$scanSectorPlayers =& $scanSector->getOtherTraders($player);
foreach ($scanSectorPlayers as &$scanSectorPlayer) {
$scanSectorShip =& $scanSectorPlayer->getShip();
// he's a friend if he's in our alliance (and we are not in a 0 alliance
if ($player->traderMAPAlliance($scanSectorPlayer)) {
$friendly_vessel += $scanSectorShip->getAttackRating();
} else {
示例15: create_error
<?php
if (!$player->isLandedOnPlanet()) {
create_error('You are not on a planet!');
}
// create planet object
$planet =& $player->getSectorPlanet();
$template->assign('PageTopic', 'Planet : ' . $planet->getName() . ' [Sector #' . $planet->getSectorID() . ']');
require_once get_file_loc('menu.inc');
create_planet_menu($planet);
$PHP_OUTPUT .= '<p>There are no goods present on your ship or the planet!</p>';
$present = false;
$table .= '<p>';
$table .= '<table class="standard">';
$table .= '<tr>';
$table .= '<th></th>';
$table .= '<th>Good</th>';
$table .= '<th>Ship</th>';
$table .= '<th>Planet</th>';
$table .= '<th>Amount</th>';
$table .= '<th>Transfer to</th>';
$table .= '</tr>';
$GOODS =& Globals::getGoods();
foreach ($GOODS as $goodID => $good) {
if (!$ship->hasCargo($goodID) && !$planet->hasStockpile($goodID)) {
continue;
}
if (!$present) {
$present = true;
$PHP_OUTPUT = "";
}