本文整理匯總了PHP中loc函數的典型用法代碼示例。如果您正苦於以下問題:PHP loc函數的具體用法?PHP loc怎麽用?PHP loc使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了loc函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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];
}
示例2: MIN
break;
case "mppt_errors":
$query = "SELECT MIN(number) FROM `mppt_errors` WHERE date='" . $date_start . "' AND time >= '" . $time_start . "'\n";
$result = mysql_query($query) or die("Query failed date/time start:" . mysql_error());
$row = mysql_fetch_row($result);
$number_low = $row[0];
if ($number_low == NULL) {
loc('history_error1');
exit;
}
$query = "SELECT MAX(number) FROM `mppt_errors` WHERE date='" . $date_end . "' AND time <= '" . $time_end . "' \n";
$result = mysql_query($query) or die("Query failed date/time end:" . mysql_error());
$row = mysql_fetch_row($result);
$number_high = $row[0];
if ($number_high == NULL) {
loc('history_error2');
exit;
}
$_SESSION['number_low'] = $number_low;
$_SESSION['number_high'] = $number_high;
$_SESSION['table'] = 'mppt_errors';
mysql_free_result($result);
mysql_close($db);
header("Location:errors_table.php");
die;
break;
case "Energy":
$query = "SELECT TO_DAYS('" . $date_start . "')\n";
$result = mysql_query($query);
$row = mysql_fetch_row($result);
$number_start = $row[0];
示例3: unset
unset($_SESSION['test_email']);
loc('email_ok');
echo "<br>";
echo str_replace("\n", "<br>", shell_exec('tail /var/log/mail.log'));
}
if (isset($_SESSION['set_email'])) {
unset($_SESSION['set_email']);
loc('saved_succes');
echo "<br>";
}
?>
</form>
<br>
<br><br>
<input TYPE="button" style="font-weight:bolder; background-color:darkkhaki;" VALUE=" <?php
loc('MENU');
?>
" ONCLICK="HomeButton()">
<script>
function HomeButton()
{
location.href="index.php";
}
</script>
</body>
</html>
示例4: array
<?php
/**
* @file
* Definitions concerning structure.
*/
// #############################################################################
// Entity (fields') definitions.
// Note: each field's 'type' value is the name of the data_handler that is
// supposed to be processing the data that is supplied in the given field.
// -----------------------------------------------------------------------------
// DYNAMIC entity type. (e.g. menus fall in this type.)
$structure['entity_definitions']['dynamic'] = array('properties' => array('is_published'), 'fields' => array('field_title' => array('role' => 'data', 'type' => 'field_text', 'translatable' => TRUE, 'label' => loc('fl--title')), 'field_description' => array('role' => 'data', 'type' => 'field_text', 'translatable' => TRUE, 'label' => loc('fl--description')), 'field_body' => array('role' => 'data', 'type' => 'field_php', 'translatable' => FALSE, 'label' => FALSE)));
// #############################################################################
// Sections and contexts.
// -----------------------------------------------------------------------------
// Section definitions.
$structure['sections'] = array();
// -----------------------------------------------------------------------------
// Context definitions.
// If these conditions are being met, apply the following context.
$structure['contexts'] = array('by_section' => array(), 'by_path' => array());
示例5: foreach
<?php
include '../local/local.inc';
foreach (range('a', 'z') as $letter) {
$device = "/dev/sd" . $letter;
if (isset($_POST[$device])) {
echo $device;
}
}
if (isset($_POST['clean'])) {
include '../bd.php';
$result = mysql_query("TRUNCATE TABLE data", $db) or die(mysql_error());
$result = mysql_query("TRUNCATE TABLE bms", $db) or die(mysql_error());
$result = mysql_query("TRUNCATE TABLE settings", $db) or die(mysql_error());
$result = mysql_query("TRUNCATE TABLE bms_alert", $db) or die(mysql_error());
$result = mysql_query("TRUNCATE TABLE mppt", $db) or die(mysql_error());
mysql_close($db);
loc('tables_cleaned');
}
?>
<br><br>
<a href="index.php"><-<?php
loc('MENU');
?>
</a>
<br><br>
<a href="disk.php"><-<?php
loc('backward');
?>
</a>
示例6: mysql_result
$a1 = mysql_result($q, 0);
}
$q = do_mysql("SELECT fullname FROM items WHERE belongs = '" . $LOGIN . "' AND is_in = 'a6';");
if (!mysql_num_rows($q)) {
$a2 = '';
} else {
$a2 = mysql_result($q, 0);
}
$c1 = substr_count($a1, '.bo2.fur.');
$c3 = substr_count($a2, '.leg.fur.');
$c1 += $c3;
$c2 = substr_count($a1, '.bo2.bas.');
$c4 = substr_count($a2, '.leg.bas.');
$c2 += $c4;
include_once 'modules/f_loc.php';
$tem = loc($p['location'], 'temperature');
// iznachalqno temperatura budet na 1 menqshe
$tem -= 1;
if ($c1 == 2) {
$tem += 2;
}
if ($c2 == 2) {
$tem += 1;
}
if ($tem < 0) {
$p['status1'][1] = 0;
} else {
if ($tem == 0) {
$p['status1'][1] = 1;
} else {
$p['status1'][1] = 2;
示例7: loc
:</b><td><?php
echo $row['I_Ch'];
loc('A');
?>
</td></tr>
<tr><td><b><?php
loc('TINT');
?>
:</b><td><?php
echo $row['Temp_Int'];
?>
°С </td></tr>
<tr><td><b><?php
loc('E24');
?>
:</b><td><?php
echo $energy;
loc('kWh');
?>
</td></tr>
</table>
<?php
}
if (!file_exists("/var/map/.mppt") && !file_exists("/var/map/.map")) {
loc('START_SERVICES');
}
?>
示例8: chr
$offset_dop = 0x106;
}
$post = chr(0xff) . chr($offset_dop & 0xff) . chr($offset_dop >> 8) . chr($dop);
fwrite($to_map, $post);
echo $text['transmitted'] . "..<br>";
fclose($to_map);
do {
$result = mysql_query("SELECT result FROM eeprom_result WHERE offset =" . $offset_dop, $db) or die(mysql_error());
$row = mysql_fetch_assoc($result);
} while ($row[0] != 0);
mysql_free_result($result);
$result = mysql_query("TRUNCATE TABLE eeprom_result", $db) or die(mysql_error());
mysql_free_result($result);
sleep(2);
}
fclose($to_map);
mysql_close($db);
echo $text['saved_succes'] . " <br>";
header("Refresh:2; URL=" . $_SERVER['HTTP_REFERER']);
loc('2sec_return');
exit;
?>
示例9: delete_item
$max = -1;
$sk = -1;
for ($i = 22; $i < 30; $i++) {
if ($p['skills'][$i] > $max) {
$sk = $i;
$max = $p['skills'][$sk];
}
}
if (rand(0, 100) <= $p['skills'][2] * 7 + $p['skills'][$sk] * 5 + $p['skills'][4] && $sk) {
// pometili uspeshno
include_once 'modules/f_delete_item.php';
delete_item($item);
include_once 'modules/f_gain_item.php';
gain_item('i.q.que.tscroll', 1, $LOGIN);
$q = do_mysql("SELECT fullname FROM items WHERE realname = 'i.q.que.tscroll' AND belongs = '" . $LOGIN . "' ORDER BY id_item DESC LIMIT 1;");
$item = mysql_result($q, 0);
include_once 'modules/f_loc.php';
$loc = loc($p['location'], 'locinfo');
$name = 'свиток портал ' . $loc[1];
$rn = 'i.q.que.tscroll.' . $p['location'];
$rn = str_replace('|', '.', $rn);
do_mysql("UPDATE items SET name = '" . $name . "', on_take = '" . $p['location'] . "', realname = '" . $rn . "' WHERE fullname = '" . $item . "';");
add_journal('недолго думая вы мастерски нарисовали на свитке пейзаж окружающей вас местности. Возможно, когданибудь это поможет вам сюда вернутся...<br/>', $LOGIN);
} else {
include_once 'modules/f_delete_item.php';
delete_item($item);
add_journal('вы рисовали магические знаки на свитке до тех пор, пока он стал пригоден лишь для похода в кусты...<br/>', $LOGIN);
include_once 'modules/f_gain_item.php';
gain_item('i.q.que.toiletpaper', 1, $LOGIN);
}
}
示例10: teleport
function teleport($who, $loc_go)
{
# get_pl_info(), do_mysql();, get_npc_info();, loc();, put_error();, delete_from_loc();, add_to_loc();, addjournal();
require_once 'modules/f_get_pl_info.php';
require_once 'modules/f_get_npc_info.php';
require_once 'modules/f_loc.php';
require_once 'modules/f_add_to_loc.php';
// proverka dannyh
//$who = preg_replace ('/[^a-z\._0-9]/i', '', $who);
//$loc_go = preg_replace ('/[^a-z0-9\|]/i', '', $loc_go);
global $LOGIN;
$id;
$pi = is_player($who);
if ($pi) {
$id = $pi;
$login = $who;
$lq = do_mysql("SELECT location FROM players WHERE id_player = '" . $id . "';");
$loc = mysql_result($lq, 0);
//$loc = get_pl_info ($login, 'location');
$qg = do_mysql("SELECT gender FROM players WHERE id_player = '" . $id . "';");
$gender = mysql_result($qg, 0);
$n = 0;
// proverka na boj -
$q = do_mysql("SELECT in_battle FROM players WHERE id_player = '" . $id . "';");
$inb = mysql_result($q, 0);
$qg = do_mysql("SELECT name FROM players WHERE id_player = '" . $id . "';");
$name = mysql_result($qg, 0);
} else {
if (substr($who, 0, 2) == 'n.') {
$id = is_npc(substr($who, 2));
if (!$id) {
return 0;
}
$loc = get_npc_info($who, 'location');
$alo = do_mysql("SELECT name FROM npc WHERE id_npc = '" . $id . "';");
$login = mysql_result($alo, 0);
$name = $login;
$n = 1;
}
}
// karta na kotoroj stoit
$map_is = substr($loc, 0, 4);
// karta toj loki, na kotoruju poidut
$map_will = substr($loc_go, 0, 4);
// ESLI NA DRUGUJU KARU
if ($map_is != $map_will) {
// a eshe ustanovim flag show_info, po kotoromu potom opredelim, nado li pokazatq vstupitelqnyj tekst k loakacci
$show_info = 1;
} else {
// voobshem eto tazhe lokacija
// vstupitelqnyj tekst ne pisatqi
$show_info = 0;
}
global $NEWMAP;
$NEWMAP = 1;
if (!loc($loc_go, 'locinfo')) {
return 0;
}
// sotrem byvshij inloc
add_to_loc($loc_go, $who);
//////////////////////////////
// pitomec
$an = do_mysql("SELECT name, fullname FROM npc WHERE belongs = '" . $login . "' AND location = '" . $loc . "' AND move <> 0;");
$an = mysql_fetch_assoc($an);
if ($an['fullname']) {
$pit = ' и ' . $an['name'] . ' ';
add_to_loc($loc_go, $an['fullname']);
} else {
$pit = '';
}
if (substr($who, 0, 2) == 'n.') {
$map = substr($loc_go, 0, 4);
do_mysql("UPDATE npc SET location = '" . $loc_go . "', map = '" . $map . "' WHERE id_npc = '" . $id . "';");
} else {
do_mysql("UPDATE players SET location = '" . $loc_go . "' WHERE id_player = '" . $id . "';");
}
$loc2 = 'l.' . $loc;
// formiruem soobshenie.
if ($pit) {
$gone = 'исчезли';
$come = 'появиись';
} else {
if (!isset($gender)) {
// dlja npc, esliimja konchaetsja na 'a', to skorej vsego devushka
$len = strlen($login);
$len2 = $len - 1;
if (substr($login, $len2) == 'а') {
$gone = 'исчезла';
$come = 'появилась';
} else {
$gone = 'исчез';
$come = 'появился';
}
} else {
if ($gender == 'male') {
$gone = 'исчез';
$come = 'появился';
}
if ($gender == 'female') {
$gone = 'исчезлa';
//.........這裏部分代碼省略.........
示例11: parsePara
function parsePara($p)
{
$ul = false;
$return = "";
$split = preg_split('/[\\n\\r]{3,}/', $p);
foreach ($split as $subp) {
if ("<" == substr($subp, 0, 1)) {
if ($ul) {
$ul = false;
$return .= "</ul>" . PHP_EOL;
}
$return .= loc($subp) . PHP_EOL;
} elseif ("*" == substr($subp, 0, 1)) {
if (!$ul) {
$ul = true;
$return .= "<ul>" . PHP_EOL;
}
$subsplit = preg_split('/[\\n\\r]{1,}/', $subp);
foreach ($subsplit as $subsubp) {
if ("*" == substr($subsubp, 0, 1)) {
$return .= " <li class='new'>" . loc(substr($subsubp, 1)) . "</li>" . PHP_EOL;
} else {
$return .= " <li>" . loc($subsubp) . "</li>" . PHP_EOL;
}
}
} else {
if ($ul) {
$ul = false;
$return .= "</ul>" . PHP_EOL;
}
$return .= "<p>" . loc($subp) . "</p>" . PHP_EOL;
}
}
if ($ul) {
$ul = false;
$return .= "</ul>" . PHP_EOL;
}
return $return;
}
示例12: loc
<?php
// ispolqzuem bombu
// podkljuchaetsja iz sp_use_food, ispolqzuet ego peremennye
if (!isset($_GET['to'])) {
// pokazyvaem vybor lokacii
include_once 'modules/f_loc.php';
$lc = loc($p['location'], 'near');
$f = '';
foreach ($lc as $key => $val) {
if (!$key) {
continue;
}
switch ($key) {
case 1:
$st = 'сз';
break;
case 2:
$st = 'с';
break;
case 3:
$st = 'св';
break;
case 4:
$st = 'з';
break;
case 5:
$st = 'в';
break;
case 6:
$st = 'юз';
break;
示例13: loc
<br>
<a href="history.php" class="menu5"><div class="div_t"><?php
loc('HISTORY');
?>
</div></a>
<br>
<a href="bms.php" class="menu6"><div class="div_t"><?php
loc('BMS');
?>
</div></a>
<br>
<a href="settings.php" class="menu7"><div class="div_t"><?php
loc('INFO');
?>
</div></a>
<br>
<a href="/setup/index.php" class="menu8"><div class="div_t"><?php
loc('SYSTEM');
?>
</div></a>
<br>
<a href="/master/index.php" class="menu9"><div class="div_t"><?php
loc('MASTER-NODE');
?>
</div></a>
<br>
</div>
</b>
</body>
</html>
示例14: mysql_free_result
}
mysql_free_result($result);
mysql_close($db);
?>
</fieldset>
<input type="button" onclick="open_nodes()" value="<?php
loc('OPEN');
?>
"> 
<input type="button" onclick="select_all()" value="<?php
loc('SELECT_ALL');
?>
"> 
<input type="button" onclick="deselect_all()" value="<?php
loc('UNSELECT_ALL');
?>
">
</div>
<script>
var nodes=<?php
echo "[";
foreach ($t as $val) {
echo $val . ",";
}
echo "'\$'];";
?>
function open_nodes() {
var i=0;
while (nodes[i]!='$') {
示例15: substr
<?php
// peredvizhenie npc po lokacii
// peredvizhem vseh npc, kotorye umejut dvigatsja v svoei karte
$map = substr($p['location'], 0, 4);
include_once 'modules/f_loc.php';
include_once 'modules/f_go_to_loc.php';
$qn = do_mysql("SELECT fullname, location, in_battle FROM npc WHERE map = '" . $map . "' AND move > 0 AND move < 10000 AND belongs = '0';");
while ($n = mysql_fetch_assoc($qn)) {
if ($n['in_battle']) {
continue;
}
$near = loc($n['location'], 'near');
$num = array_rand($near);
$n_loc = $near[$num];
go_to_loc($n['fullname'], $n_loc[0], $num);
}
do_mysql("UPDATE gamesys SET npc_move = '" . $time . "' WHERE month = '" . $mon . "';");