本文整理汇总了PHP中postval函数的典型用法代码示例。如果您正苦于以下问题:PHP postval函数的具体用法?PHP postval怎么用?PHP postval使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了postval函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_notify
/**
* Handle notify URLs from PayPal
*/
public function action_notify()
{
file_put_contents(PATH_ROOT . "/paypal.log", print_r($_POST, true), FILE_APPEND);
// TODO: remove this when tested on production
if (!isset($_POST['receiver_email']) || $_POST['receiver_email'] != 'henrist@henrist.net') {
die;
}
// should really check for duplicates, but we don't
// but it must be "completed"
if (!isset($_POST['payment_status']) || $_POST['payment_status'] != 'Completed') {
die;
}
// verify it
$verify = Donation::verifyPayPalData($_POST);
if (!$verify) {
die;
}
// check for user etc
$custom = postval("custom");
if (!preg_match('~^(.*):(.*);public=(0|1)$~', $custom, $matches)) {
die;
}
trigger_error("should add");
$player = null;
if ($matches[1] != "gjest") {
// find this player
$result = DB::get()->query("\n\t\t\t\tSELECT up_id\n\t\t\t\tFROM users_players\n\t\t\t\t\tLEFT JOIN users ON up_u_id = u_id\n\t\t\t\t\tLEFT JOIN sessions ON u_id = ses_u_id\n\t\t\t\tWHERE ses_id = " . DB::quote($matches[1]) . " AND up_id = " . DB::quote($matches[2]) . " LIMIT 1");
if ($up_id = $result->fetchColumn(0)) {
$player = \player::get($up_id);
}
}
$time = \ess::$b->date->parse(postval("payment_date"));
// add it
$d = Donation::create(postval("mc_gross"), $time, $matches[3] ? $player->id : null);
putlog("CREWCHAN", sprintf("%%uDONASJON:%%u %s %s ble donert av %s", postval("mc_currency"), postval("mc_gross"), $player ? $player->data['up_name'] . ($matches[3] ? ' (synlig)' : ' (som anonym)') : 'anonym gjest'));
// no output
die;
}
示例2: show
protected function show()
{
// tittel på meldingstråden
ess::$b->page->add_title($this->thread->data_thread['it_title']);
// sett opp deltakere
$deltakere = array();
$c = access::has("crewet");
foreach ($this->thread->receivers as $row) {
if ($this->thread->data_rel && $this->thread->data_rel['ir_up_id'] == $row['ir_up_id']) {
continue;
}
$p = $row['ir_deleted'] != 0 || $row['up_access_level'] == 0 && (!access::has("crewet") || $row['u_access_level'] == 0 || $row['u_active_up_id'] != $row['ir_up_id']);
$deltakere[] = ($p ? '<span class="user_strike">' : '') . '<user id="' . $row['ir_up_id'] . '" />' . ($p ? '</span>' : '');
}
$deltakere_siste = array_pop($deltakere);
$this->add_receivers();
// overskrift
if ($this->thread->restrict || !$this->thread->can_reply_receivers) {
echo '
<h1>Melding: ' . htmlspecialchars($this->thread->data_thread['it_title']) . '</h1>';
} else {
echo '
<form action="" method="post">
<h1><span class="red">' . show_sbutton("Slett", 'name="slettalle" onclick="return confirm(\'Dette vil slette meldingstråden for alle deltakere. Denne handlingen kan ikke angres uten videre. Fortsette?\')"') . '</span> Melding: ' . htmlspecialchars($this->thread->data_thread['it_title']) . '</h1>
</form>';
}
// tittel og verktøy
echo '
<form action="innboks" method="post">
<p class="im_tools top h_right">
<a href="innboks' . ($this->thread->data_rel ? '' : '?user=' . urlencode($this->thread->data_rel['up_name'])) . '">Tilbake til meldinger</a>
<input type="hidden" name="it_id[]" value="' . $this->thread->id . '" />' . (!isset($_GET['reply']) && $this->can_reply ? '
' . show_sbutton("Opprett svar", 'name="reply" accesskey="s"', 'reply_link_form_show') : '') . ($this->thread->data_rel ? '
<span class="red">' . show_sbutton("Slett", 'name="slett" accesskey="d" onclick="return confirm(\'Er du sikker på at du vil slette meldingen?\')"') . '</span>' : '') . '
</p>
</form>';
// deltakere
if ($deltakere_siste) {
echo '
<p id="im_deltakere"><span id="im_deltakere_i">Deltakere: ' . (count($deltakere) > 0 ? implode(", ", $deltakere) . ' og ' : '') . $deltakere_siste . '</span></p>';
if (!$this->thread->can_reply_access) {
echo '
<p>Du har ikke mulighet til å svare i denne meldingen.</p>';
} elseif (!$this->thread->can_reply_receivers) {
echo '
<p>Det er ingen mottakere du kan svare til.</p>';
}
} else {
echo '
<p>Det er ingen andre deltakere enn deg selv i denne meldingstråden.</p>';
}
// flere sider?
if ($this->pagei->pages > 1) {
echo '
<p class="c">' . $this->pagei->pagenumbers(array("goto")) . '</p>';
}
// svarskjema
echo '
<div id="container_reply"' . (!isset($_GET['reply']) ? ' style="display: none"' : '') . '>
<form action="' . htmlspecialchars(game::address(PHP_SELF, $_GET, array(), array("reply" => true))) . '" method="post" onsubmit="this.onsubmit=function(){return false;}">
<div class="section" style="margin-top:0">
<h3>Skriv svar</h3>
<dl class="dd_auto_100">
<dt>Innhold</dt>
<dd><textarea name="melding" rows="10" cols="75" id="textContent">' . htmlspecialchars(postval("melding")) . '</textarea></dd>
<dt' . (isset($_POST['preview']) && isset($_POST['melding']) ? '' : ' style="display: none"') . ' id="previewDT">Forhåndsvisning</dt>
<dd' . (isset($_POST['preview']) && isset($_POST['melding']) ? '' : ' style="display: none"') . ' id="previewDD">' . (!isset($_POST['melding']) || empty($_POST['melding']) ? 'Tom melding?!' : game::bb_to_html($_POST['melding'])) . '</dd>
</dl>
<h3 class="c">
' . show_sbutton("Send melding", 'name="post" accesskey="s"') . '
' . show_sbutton("Forhåndsvis", 'name="preview" accesskey="p" id="reply_link_preview"') . '
</h3>
</div>
</form>
</div>';
// meldingene
echo '
<div id="innboks">';
// hent meldingene på denne siden
$result = $this->thread->get_messages($this->pagei->start, $this->limit);
$i = 0;
$last_id = 0;
while ($row = $result->fetch()) {
$e = $this->pagei->total - $i - ($this->pagei->active - 1) * $this->pagei->per_page;
if ($i == 0) {
$last_id = $row['im_id'];
}
echo $this->thread->reply_format($row, $e, $this->highlight_im_id == $row['im_id'], $i < $this->new);
$i++;
}
echo '
</div>';
if (!isset($_GET['reply']) && $this->can_reply || $this->thread->data_rel) {
echo '
<form action="innboks" method="post">
<input type="hidden" name="it_id[]" value="' . $this->thread->id . '" />' . ($this->thread->data_rel ? '
<p class="im_tools bottom left" id="im_mark"></p>' : '') . '
<p class="im_tools bottom">' . (!isset($_GET['reply']) && $this->can_reply ? '
' . show_sbutton("Opprett svar", 'name="reply" accesskey="s"', 'reply_link_form_show') : '') . ($this->thread->data_rel ? '
<span class="red">' . show_sbutton("Slett", 'name="slett" accesskey="d" onclick="return confirm(\'Er du sikker på at du vil slette meldingen?\')"') . '</span>' : '') . '
//.........这里部分代码省略.........
示例3: page_training_show
/**
* Våpentrening
*/
protected function page_training_show()
{
// sett opp og test for anti-bot
$this->training_antibot = new antibot(login::$user->id, "training", 7);
if (MAIN_SERVER) {
$this->training_antibot->check_required();
}
// sett opp skjema
$this->training_form = \Kofradia\Form::getByDomain("training", login::$user);
// ventetid?
$wait = max(0, login::$user->player->data['up_weapon_training_next'] - time());
// skal vi trene våpenet?
if (isset($_POST['wt']) && $this->training_form->validateHashOrAlert(null, "Våpentrening")) {
// kan vi ikke trene nå?
if ($wait > 0) {
redirect::handle();
}
// finnes ikke valget?
$id = (int) postval("training_id");
if (!isset(self::$trainings[$id])) {
ess::$b->page->add_message("Du må velge et alternativ.", "error");
redirect::handle();
}
$opt = self::$trainings[$id];
// lagre valget for neste gang
ess::session_put("training_id", $id);
// har ikke nok cash?
if ($opt['price'] > login::$user->player->data['up_cash']) {
ess::$b->page->add_message("Du har ikke nok penger til å utføre våpentreningen.");
redirect::handle();
}
$f = self::TRAINING_MAX * $opt['percent'];
$next_old = login::$user->player->data['up_weapon_training_next'] ? ' = ' . login::$user->player->data['up_weapon_training_next'] : ' IS NULL';
// utfør våpentrening
$a = \Kofradia\DB::get()->exec("\n\t\t\t\tUPDATE users_players\n\t\t\t\tSET up_weapon_training = up_weapon_training + (1 - up_weapon_training) * {$f}, up_weapon_training_next = " . (time() + $opt['wait']) . ", up_cash = up_cash - {$opt['price']}\n\t\t\t\tWHERE up_id = " . login::$user->player->id . " AND up_cash >= {$opt['price']} AND up_weapon_training_next{$next_old}");
// ikke oppdatert?
if ($a == 0) {
ess::$b->page->add_message("Kunne ikke utføre våpentrening.", "error");
} else {
$this->training_antibot->increase_counter();
ess::$b->page->add_message("Du trente opp våpenet ditt og våpentreningen økte med " . game::format_num((1 - login::$user->player->data['up_weapon_training']) * $f * 100, 2) . " %.");
}
redirect::handle();
}
$training = login::$user->player->data['up_weapon_training'] * 100;
echo '
<div class="bg1_c xsmall">
<h1 class="bg1">Våpentrening<span class="left2"></span><span class="right2"></span></h1>
<div class="bg1">';
if ($wait > 0) {
echo '
<p class="c">Du må vente ' . game::counter($wait, true) . ' før du kan trene våpenet på nytt.</p>';
} else {
// vis alternativene
echo '
<form action="" method="post">
' . $this->training_form->getHTMLInput() . '
<table class="table tablemt center">
<thead>
<tr>
<th>Pris</th>
<th>Ventetid</th>
</tr>
</thead>
<tbody>';
$i = 0;
$match = ess::session_get("training_id") ?: 0;
foreach (self::$trainings as $id => $row) {
echo '
<tr class="box_handle' . (++$i % 2 == 0 ? ' color' : '') . '">
<td class="r"><input type="radio" name="training_id"' . ($match == $id ? ' checked="checked"' : '') . ' value="' . $id . '" />' . game::format_cash($row['price']) . '</td>
<td class="r">' . game::timespan($row['wait']) . '</td>
</tr>';
}
echo '
</tbody>
</table>
<p class="c">' . show_sbutton("Utfør", 'name="wt"') . '</p>
</form>';
}
echo '
<div class="progressbar p' . ($training < 28 ? ' levelcrit' : ($training < 35 ? ' levelwarn' : '')) . '">
<div class="progress" style="width: ' . round(min(100, $training)) . '%">
<p>Våpentrening: ' . ($training == 100 ? '100' : game::format_num($training, 2)) . ' %</p>
</div>
</div>
<p>Du har en <b>' . htmlspecialchars(login::$user->player->weapon->data['name']) . '</b> med <b>' . game::format_num(login::$user->player->data['up_weapon_bullets']) . '</b> ' . fword('kule', 'kuler', login::$user->player->data['up_weapon_bullets']) . '.</p>
<p>Våpentreningen din synker jevnlig i løpet av dagen, og du er nødt til å trene for å holde oppe våpentreningen din. Hvis våpentreningen din faller under 25 %, risikerer du å miste våpenet ditt.</p>
<p>Bedre våpentrening fører til:</p>
<ul class="spacer">
<li>Du forbedrer treffsikkerheten din</li>
<li>Du øker skuddtakten samtidig som treffsikkerheten forblir den samme</li>
</ul>
</div>
</div>';
}
示例4: step3
function step3()
{
$referers = array(1 => array("Via google eller en annen søkeside", false), array("En venn tipset meg", false), array("Leste det på en nettside", "Lenke til nettsiden"), array("Så en reklameannonse", "Lenke til nettsiden"), array("Så det i et forum", "Lenke til forumet"), array("Annet", "Spesifiser"));
// er skjemaet sendt inn?
if ($_SERVER['REQUEST_METHOD'] == "POST") {
// sjekk for gyldig trinn
if (!isset($_POST['step']) || $_POST['step'] != 3) {
redirect::handle();
}
// spillernavn, passord1, passord2, referer1, referer2
$brukernavn = postval("brukernavn");
$passord1 = postval("passord1");
$passord2 = postval("passord2");
$referer1 = postval("referer1");
$referer2 = trim(postval("referer2"));
// diverse spørringer
$result1 = \Kofradia\DB::get()->query("SELECT " . \Kofradia\DB::quoteNoNull($brukernavn) . " REGEXP regex AS m, error FROM regex_checks WHERE (type = 'reg_user_special' OR type = 'reg_user_strength') HAVING m = 1");
$result2 = \Kofradia\DB::get()->query("SELECT up_id FROM users_players WHERE up_name = " . \Kofradia\DB::quote($brukernavn));
$result3 = \Kofradia\DB::get()->query("SELECT id FROM registration WHERE user = " . \Kofradia\DB::quote($brukernavn));
$result4 = \Kofradia\DB::get()->query("SELECT " . \Kofradia\DB::quoteNoNull($passord1) . " REGEXP regex AS m, error FROM regex_checks WHERE type = 'reg_pass' HAVING m = 1");
// sjekk spillernavn
if ($result1->rowCount() > 0) {
$feil = array();
while ($row = $result1->fetch()) {
$feil[] = '<li>' . htmlspecialchars($row['error']) . '</li>';
}
ess::$b->page->add_message("Spillernavnet var ikke gyldig:<ul>" . implode("", $feil) . "</ul>", "error");
} elseif ($result2->rowCount() > 0) {
ess::$b->page->add_message("Spillernavnet er allerede tatt! Velg et annet.", "error");
} elseif ($result3->rowCount() > 0) {
ess::$b->page->add_message("Noen holder allerede på å registrere seg med dette spillernavnet. Velg et annet.", "error");
} elseif ($result4->rowCount() > 0) {
$feil = array();
while ($row = $result4->fetch()) {
$feil[] = '<li>' . htmlspecialchars($row['error']) . '</li>';
}
ess::$b->page->add_message("Passordet var ikke gyldig:<ul>" . implode("", $feil) . "</ul>", "error");
} elseif ($passord1 == $brukernavn) {
ess::$b->page->add_message("Passordet kan ikke være det samme som spillernavnet.", "error");
} elseif ($passord1 != $passord2) {
ess::$b->page->add_message("Passordene var ikke like med hverandre.", "error");
} elseif (!isset($referers[$referer1])) {
ess::$b->page->add_message("Velg et gyldig alternativ for hvor du hørte om Kofradia.", "error");
} elseif ($referers[$referer1][1] && empty($referer2)) {
ess::$b->page->add_message("Fyll ut feltet for mer informasjon for hvor du hørte om Kofradia.", "error");
} else {
$referer = $referers[$referer1][0] . "|" . $referer2;
// oppdater databasen
\Kofradia\DB::get()->exec("UPDATE registration SET user = " . \Kofradia\DB::quote($brukernavn) . ", referer = " . \Kofradia\DB::quote($referer) . ", pass = " . \Kofradia\DB::quote(password::hash($passord1, null, 'user')) . " WHERE id = {$this->id}");
$_SESSION[$GLOBALS['__server']['session_prefix'] . 'reg']['step'] = 4;
redirect::handle();
}
}
$refs = array();
foreach ($referers as $ref) {
if ($ref[1]) {
$refs[] = "'" . addslashes($ref[1]) . "'";
} else {
$refs[] = "false";
}
}
ess::$b->page->add_js('var referers = [false,' . implode(",", $refs) . '];
function checkReferer(elm)
{
var index = elm.selectedIndex + (elm.options[0].value == "" ? 0 : 1);
var ref = referers[index];
var elms = $$(".referer2p");
var text = $("referer2i");
if (ref)
{
text.innerHTML = ref;
elms.each(function(elm){elm.setStyle("display", "");});
}
else
{
elms.each(function(elm){elm.setStyle("display", "none");});
}
}');
echo '
<form action="registrer" method="post">
<input type="hidden" name="abort" />
<h1>Brukerinformasjon</h1>
<p class="h_right">' . show_sbutton("Avbryt registrering", 'onclick="return confirm(\'Er du sikker på at du vil AVBRYTE?\')"') . '</p>
</form>
<p>Det er nå tid for å velge spillernavn og passord. Spillernavnet vil du ikke kunne endre senere, mens passordet kan endres når du ønsker og nullstilles via e-post.</p>
<p>Tips: Trykk «Gå videre» for å sjekke om spillernavnet er ledig før du fyller inn passordet for å slippe å fylle inn passordet hver gang.</p>
<boxes />
<form action="registrer" method="post">
<input type="hidden" name="step" value="3" />
<dl class="dl_30">
<dt>Ønsket spillernavn</dt>
<dd><input type="text" name="brukernavn" value="' . htmlspecialchars(postval("brukernavn")) . '" class="styled w120" /></dd>
<dt>Passord</dt>
<dd><input type="password" name="passord1" class="styled w120" /></dd>
<dt>Gjenta passord</dt>
<dd><input type="password" name="passord2" class="styled w120" /></dd>
<dt>Hvor hørte du om Kofradia?</dt>
<dd>
<select name="referer1" id="referer_select" onchange="checkReferer(this)">';
$selected = postval("referer1", false);
//.........这里部分代码省略.........
示例5: __construct
//.........这里部分代码省略.........
$row['class_extra'] = 'forum_focus';
}
if ($reply_id == $row['fr_id'] || $fs_id == $row['fr_id']) {
$row['h2_extra'] = 'id="forum_scroll_here"';
// vis bokser her
if ($reply_id == $row['fr_id'] || $fs_id == $row['fr_id']) {
echo '
<boxes />';
}
}
// vis html for svaret
echo $this->topic->forum->template_topic_reply($row);
}
}
// oppdatere sist sett?
$time = $last_time != 0 ? $last_time : $this->topic->info['ft_time'];
// legge til?
if (login::$logged_in && empty($this->topic->info['fs_time'])) {
\Kofradia\DB::get()->exec("INSERT IGNORE INTO forum_seen SET fs_ft_id = {$this->topic->id}, fs_u_id = " . login::$user->id . ", fs_time = {$time}");
} elseif (login::$logged_in && $time > $this->topic->info['fs_time']) {
\Kofradia\DB::get()->exec("UPDATE forum_seen SET fs_time = GREATEST(fs_time, {$time}) WHERE fs_ft_id = {$this->topic->id} AND fs_u_id = " . login::$user->id);
}
echo '
</div>';
// vis svarskjema
echo '
<div' . ($reply_form ? '' : ' style="display: none"') . ' id="container_reply">' . ($reply_form ? '
<boxes />' : '') . '
<form action="' . htmlspecialchars(game::address("topic", $_GET, array("replyid", "fs"), array("reply" => true))) . '" method="post"' . ($reply_form ? ' id="forum_scroll_here"' : '') . '>
<div class="section forum_reply_edit_c">
<h2>Svar</h2>
<dl class="dl_2x">
<dt>Innhold</dt>
<dd><textarea name="text" rows="20" cols="75" id="replyText">' . htmlspecialchars(postval("text")) . '</textarea></dd>';
// vise ekstra alternativer?
if (access::has("forum_mod") || $this->topic->forum->id >= 5 && $this->topic->forum->id <= 7) {
$no_concat = isset($_POST['no_concatenate']) || $_SERVER['REQUEST_METHOD'] != "POST" && $this->topic->forum->id >= 5 && $this->topic->forum->id <= 7;
$announce_text = $this->topic->forum->id >= 5 && $this->topic->forum->id <= 7 ? 'Legg til logg i spilleloggen til medlemmer av Crewet.' : 'Annonser på #kofradia kanalen';
echo '
<dt>Ekstra</dt>
<dd>' . (!$this->topic->forum->ff ? '
<input type="checkbox" name="announce" id="announce"' . (isset($_POST['announce']) ? ' checked="checked"' : '') . ' /><label for="announce"> ' . $announce_text . '</label><br />' : '') . '
<input type="checkbox" name="no_concatenate" id="no_concatenate"' . ($no_concat ? ' checked="checked"' : '') . ' /><label for="no_concatenate"> <u>Ikke</u> kombiner sammen med siste melding.</label>
</dd>';
}
echo '
</dl>
<p class="c">
' . show_sbutton("Legg til svar", 'name="post" accesskey="s" id="forum_reply_button_add"') . '
' . show_sbutton("Forhåndsvis", 'name="preview" accesskey="p" id="forum_reply_button_preview"') . '
</p>
</div>
<div id="reply_preview" class="forum">';
// forhåndsvise?
if (login::$logged_in && isset($_POST['preview'])) {
$data = array("ft_id" => $this->topic->id, "fr_text" => postval("text"), "fr_up_id" => login::$user->player->id, "up_name" => login::$user->player->data['up_name'], "up_access_level" => login::$user->player->data['up_access_level'], "up_points" => login::$user->player->data['up_points'], "upr_rank_pos" => login::$user->player->data['upr_rank_pos'], "up_forum_signature" => login::$user->player->data['up_forum_signature'], "up_profile_image_url" => login::$user->player->data['up_profile_image_url'], "fs_new" => \Kofradia\Forum\Category::$fs_check);
echo \Kofradia\Forum\Category::template_topic_reply_preview($data);
}
echo '</div>
</form>
</div>';
// linker i bunn
if (login::$logged_in) {
echo '
<form action="" method="post">
<input type="hidden" name="sid" value="' . login::$info['ses_id'] . '" />
示例6: Element
access::no_guest();
$_base->page->add_title("BB-testing");
$_base->page->add_js_domready('
new Element("input", {"type": "button", "value": "Vis resultat med AJAX", "class": "button"}).addEvent("click", function()
{
$("ajaxcontainer").setStyle("display", "block");
$("ajaxcontent").set("html", "<p>Henter data..</p>");
preview($("textcontent").value, $("ajaxcontent"));
//preview_bb(event, $("textcontent").value, ["ajaxcontainer"], "ajaxcontent");
}).inject($("ajaxbutton"));');
echo '
<div class="bg1_c large">
<h1 class="bg1">BB-testing<span class="left"></span><span class="right"></span></h1>
<div class="bg1">
<p>Her kan du teste diverse BB-koder. Du kan også forhåndsvise profilen din på <a href="' . $__server['relative_path'] . '/min_side?a=profil">rediger profil</a>.</p>
<form action="" method="post">
<p><b>BB-kode</b>: (<a href="' . ess::$s['relative_path'] . '/node/11">Hjelp</a>)</p>
<p><textarea name="bb" rows="13" cols="100" style="width: 97%" id="textcontent">' . htmlspecialchars(postval("bb")) . '</textarea></p>
<p class="c">' . show_sbutton("Vis resultat") . ' <span id="ajaxbutton"></span></p>
</form>
</div>
</div>
<div class="bg1_c large' . (!isset($_POST['bb']) ? ' hide' : '') . '" id="ajaxcontainer">
<h1 class="bg1">Resultat<span class="left"></span><span class="right"></span></h1>
<div class="bg1">
<div class="p" id="ajaxcontent">' . game::bb_to_html(postval("bb")) . '</div>
</div>
</div>';
$_base->page->load();
示例7: postval
<?php
/**
* Forhåndsvisning av forumtråd
*
* Inndata:
* - topic_id [optional]
* - text
*/
require "../../../app/ajax.php";
ajax::require_user();
// kontroller lås
ajax::validate_lock(true);
global $_base, $_game;
// sett opp tekst
$text = postval("text");
if (empty($text)) {
$text = "Mangler innhold.";
}
// forhåndsviser vi en redigert forumtråd?
if (isset($_POST['topic_id'])) {
// hent forumtråden
$topic = new \Kofradia\Forum\TopicAjax($_POST['topic_id']);
// sett opp data
$data = $topic->extended_info();
$data['ft_text'] = $text;
$data['ft_last_edit'] = time();
$data['ft_last_edit_up_id'] = login::$user->player->id;
} else {
// sett opp data
$data = array("ft_text" => $text);
示例8: utpress
/**
* Kontroller inndata og utfør utpressing
*/
public function utpress()
{
// wait time?
if (($wait = $this->ut->getWait()) > 0) {
\ess::$b->page->add_message("Du må vente " . \game::counter($wait, true) . " før du kan utføre en ny utpressing.", "error");
return;
}
// validate form
$form_info = '';
if ($this->ut->up->data['up_utpressing_last']) {
$form_info = sprintf("Siste=%s;", \game::timespan($this->ut->up->data['up_utpressing_last'], \game::TIME_ABS | \game::TIME_SHORT | \game::TIME_NOBOLD));
} else {
$form_info = "First;";
}
if ($wait) {
$form_info .= sprintf("%%c11Ventetid=%s%%c", \game::timespan($wait, \game::TIME_SHORT | \game::TIME_NOBOLD));
} else {
$form_info .= "%c9No-wait%c";
}
if (!$this->form->validateHashOrAlert(postval('hash'), $form_info)) {
return;
}
// mangler alternativ?
$option = $this->ut->getOption(postval("opt"));
if (!$option) {
\ess::$b->page->add_message("Du må velge et alternativ.", "error");
return;
}
// lagre valg for neste gang
\ess::session_put("utpressing_opt_key", postval("opt"));
// forsøk utpressing
$result = $this->ut->utpress($option);
if ($msg = $result->getMessage()) {
\ess::$b->page->add_message($msg);
}
// oppdater anti-bot
$this->antibot->increase_counter();
}
示例9: elseif
access::need("crewet");
if (!isset($_POST['u_id'])) {
ajax::text("ERROR", ajax::TYPE_INVALID);
}
// sjekk bruker
$user = user::get($_POST['u_id']);
if (!$user) {
ajax::text("ERROR:USER-404", ajax::TYPE_404);
}
// hente rapporteringer MOT brukeren?
$data = "";
if (postval("a") == "to") {
$data .= '
<p class="c">Andre brukere som har rapportert denne brukeren.</p>';
$where = " AND r_up_id = up_id";
} elseif (postval("a") == "from") {
$data .= '
<p class="c">Rapporteringer som brukeren selv har opprettet.</p>';
$where = " AND r_source_up_id = up_id";
} else {
$data .= '
<p class="c">Alle rapporteringer denne brukeren er involvert i.</p>';
$where = " AND (r_source_up_id = up_id OR r_up_id = up_id)";
}
$pagei = new pagei(pagei::ACTIVE_POST, "s", pagei::PER_PAGE, 10);
$result = $pagei->query("\n\tSELECT r_id, r_source_up_id, r_up_id, r_type, r_type_id, r_time, r_note, r_state, r_crew_up_id, r_crew_note, r_crew_time\n\tFROM rapportering, users_players\n\tWHERE up_u_id = {$user->id}{$where}\n\tORDER BY IFNULL(r_crew_time, r_time) DESC");
if ($pagei->total == 0) {
ajax::html(parse_html($data . '
<p class="c">Ingen oppføringer ble funnet.</p>'));
}
$raps = array();
示例10: show
//.........这里部分代码省略.........
$sort->append("asc", "Wanted nivå", "up_wanted_level, up_fengsel_time DESC");
$sort->append("desc", "Wanted nivå", "up_wanted_level DESC, up_fengsel_time DESC");
$sort->append("asc", "Tid igjen", "up_fengsel_time");
$sort->append("desc", "Tid igjen", "up_fengsel_time DESC");
$sort->set_active(requestval("sort"), 5);
// hent folk i fengsel
$sort_info = $sort->active();
$pagei = new pagei(pagei::ACTIVE_GET, "side", pagei::PER_PAGE, 15);
$result = $pagei->query("\n\t\t\tSELECT up_id, up_name, up_access_level, up_fengsel_time, up_fengsel_num, up_fengsel_dusor, ROUND(up_fengsel_dusor * " . self::DUSOR_PROFIT . ") up_fengsel_dusor_get, up_wanted_level\n\t\t\tFROM users_players\n\t\t\tWHERE up_fengsel_time > " . time() . " AND up_access_level != 0\n\t\t\tORDER BY {$sort_info['params']}");
$num = $result->rowCount();
echo '
<div class="bg1_c ' . ($num == 0 ? 'xsmall' : 'xlarge') . '">
<h1 class="bg1">Fengsel<span class="left"></span><span class="right"></span></h1>
<p class="h_right"><a href="node/16">Hjelp</a></p>
<div class="bg1">
<form action="" method="post">
<p class="c dark">Ditt wanted nivå er på ' . game::format_number($this->up->data['up_wanted_level'] / 10, 1) . ' %.</p>';
if ($num == 0) {
echo '
<p class="c dark">Ingen er i fengselet for øyeblikket.</p>
<p class="c"><a href="' . htmlspecialchars(game::address("fengsel", $_GET)) . '" class="button">Oppdater</a></p>';
} else {
echo '
<table class="table center" width="100%">
<thead>
<tr>
<th>Spiller ' . $sort->show_link(0, 1) . '</th>
<th>Wanted<br />nivå ' . $sort->show_link(2, 3) . '</th>
<th>Utbrytning<br />sannsynlighet</th>
<th>Ca. poeng</th>
<th>Dusør</th>
<th>Tid igjen ' . $sort->show_link(4, 5) . '</th>
</tr>
</thead>
<tbody>';
$i = 0;
while ($row = $result->fetch()) {
$prefix = "";
$attr = new attr("class");
if (++$i % 2 == 0) {
$attr->add("color");
}
if (!$this->up->fengsel_check()) {
$attr->add("box_handle");
$prefix = '<input type="radio" name="up_id" value="' . $row['up_id'] . '_' . $row['up_fengsel_time'] . '_' . $row['up_fengsel_dusor'] . '" /> ';
}
$time = $row['up_fengsel_time'] - time();
$prob = self::calc_prob($time, $row['up_wanted_level'] / 10);
$points = self::calc_points($prob);
echo '
<tr' . $attr->build() . '>
<td>' . $prefix . game::profile_link($row['up_id'], $row['up_name'], $row['up_access_level']) . '</td>
<td class="c">' . game::format_number($row['up_wanted_level'] / 10, 1) . ' %</td>
<td class="c">' . game::format_number($prob, 1) . ' %</td>
<td class="c">' . game::format_num($points) . '</td>
<td class="r nowrap">' . game::format_cash($row['up_fengsel_dusor_get']) . '</td>
<td class="r">' . game::counter($time) . '</td>
</tr>';
}
echo '
</tbody>
</table>
<p class="c">' . (($wait = $this->up->fengsel_wait()) == 0 ? '
' . show_sbutton("Bryt ut", 'name="brytut"') : '
Du er i fengsel og slipper ut om ' . game::counter($wait, true) . '.
</p>
<p class="c">') . '
<a href="' . htmlspecialchars(game::address("fengsel", $_GET)) . '" class="button">Oppdater</a>
</p>';
// flere sider?
if ($pagei->pages > 1) {
echo '
<div class="hr"></div>
<p class="c">
' . $pagei->pagenumbers() . '
</p>';
}
}
echo '
</form>
</div>
</div>';
// testing
if (!MAIN_SERVER || access::is_nostat() && access::has("mod")) {
echo '
<div class="bg1_c xxsmall bg1_padding">
<h1 class="bg1">' . (MAIN_SERVER ? 'No-stat' : 'Testing') . '<span class="left"></span><span class="right"></span></h1>
<div class="bg1">
<form action="" method="post">' . ($this->up->fengsel_check() ? '
<p class="c">' . show_sbutton("Gå ut av fengsel", 'name="remove"') . '</p>' : '
<dl class="dd_right dl_2x">
<dt>Tid</dt>
<dd><input type="text" name="time" value="' . htmlspecialchars(postval("time", 20)) . '" class="styled w40" /> sekunder</dd>
</dl>
<p class="c">' . show_sbutton("Gå inn i fensgel") . '</p>') . '
</form>
</div>
</div>';
}
}
示例11: htmlspecialchars
}
echo '
</dd>
<dt> </dt>
<dd><input type="radio" id="f_' . $key . '" name="f" value="' . $key . '"' . ($search_from_id == $key ? ' checked="checked"' : '') . ' onclick="$(\'u_name\').focus()" /><label for="f_' . $key . '"> Spesifiser: </label><input type="text" name="u" value="' . htmlspecialchars(postval("u")) . '" class="styled w100" id="u_name" onfocus="$(\'f_' . $key . '\').checked=true" /></dd>
</dl>
<h3 class="c">
' . show_sbutton("Utfør søk", 'name="search"') . '
</h3>
</div>
</form>';
// søke?
if (isset($_POST['search'])) {
$title_search = postval("title");
$text_search = postval("text");
// finn ut delene av spørringen
$title_parts = search_query($title_search);
$text_parts = search_query($text_search);
if (count($title_parts[0]) == 0 && count($text_parts[0]) == 0 && $search_from_id != 4) {
echo '
<h2>
Søkeresultater
</h2>
<p>
Skal du ikke søke etter noe?!
</p>';
} else {
// sett opp søkespørringen
$search = "";
if (count($title_parts[0]) > 0) {
示例12: page_crew
//.........这里部分代码省略.........
<p class="c">Ingen oppføringer eksisterer.</p>';
} else {
$rows = array();
while ($row = $result->fetch()) {
$rows[$row['lc_id']] = $row;
}
$data = crewlog::load_summary_data($rows);
$logs = array();
foreach ($data as $row) {
// hent sammendrag
$summary = crewlog::make_summary($row, NULL, $row['lc_a_up_id'] != page_min_side::$active_player->id);
$day = ess::$b->date->get($row['lc_time'])->format(date::FORMAT_NOTIME);
$logs[$day][] = '<p><span class="time">' . ess::$b->date->get($row['lc_time'])->format("H:i") . ':</span> ' . $summary . '</p>';
}
ess::$b->page->add_css('.crewlog .time { color: #888888; padding-right: 5px }');
foreach ($logs as $day => $items) {
echo '
<div class="bg1_c">
<h1 class="bg1">' . $day . '<span class="left2"></span><span class="right2"></span></h1>
<div class="bg1 crewlog">
' . implode('
', $items) . '
</div>
</div>';
}
echo '
<p class="c">' . $pagei->pagenumbers() . '</p>';
}
echo '
</div>';
} elseif ($subpage2 == "addlog" && access::has("forum_mod")) {
// legge til?
if (isset($_POST['notat'])) {
$notat = trim(postval("notat"));
$notat_bb = trim(game::bb_to_html($notat));
if (empty($notat_bb)) {
ess::$b->page->add_message("Notatet kan ikke være tomt.", "error");
} else {
// legg til i crewloggen
crewlog::log("user_add_note", page_min_side::$active_player->id, $notat);
ess::$b->page->add_message("Notatet ble registrert.");
redirect::handle(page_min_side::addr());
}
}
ess::$b->page->add_title("Nytt notat");
ess::$b->page->add_js_domready('$("notat_felt").focus();');
echo '
<div class="bg1_c">
<h1 class="bg1">Legg til notat i crewloggen<span class="left2"></span><span class="right2"></span></h1>
<div class="bg1">
<p>Notat: (Vil bli lagt til som vanlig logg i <a href="' . htmlspecialchars(page_min_side::addr(NULL)) . '">Crewloggen</a>.)</p>
<form action="" method="post">
<p><textarea name="notat" id="notat_felt" rows="10" cols="30" style="width: 98%; overflow: auto">' . htmlspecialchars(postval("notat")) . '</textarea></p>
<p>' . show_sbutton("Legg til notat") . '</p>
</form>
</div>
</div>';
} elseif ($subpage2 == "blokk") {
ess::$b->page->add_title("Blokkeringer");
$type = false;
if (isset($_GET['t'])) {
// kontroller type
$type_id = intval($_GET['t']);
// fant ikke?
if (!isset(blokkeringer::$types[$type_id])) {
ess::$b->page->add_message("Ugyldig type '.{$type_id}.'.", "error");
示例13: handle_check_start
public function handle_check_start()
{
// vise resultat?
if ($this->data['poker_state'] == self::STATE_COMPLETE) {
$this->mark_seen_starter();
} elseif ($this->data['poker_state'] == self::STATE_FREE) {
// kan trekkes tilbake?
$this->can_pullback = access::has("admin") || $this->data['poker_time_start'] + self::PULLBACK_TIME <= time();
// ønsker vi å trekke tilbake?
if ($this->can_pullback && isset($_POST['pullback'])) {
// kontroller ID
if (postval("pullback") != $this->id) {
redirect::handle();
}
// trekk tilbake
if ($this->pullback()) {
ess::$b->page->add_message("Du trakk tilbake pokerunden din og fikk tilbake " . game::format_cash($this->data['poker_cash']) . ".");
}
redirect::handle();
}
} elseif ($this->data['poker_state'] == self::STATE_BEGIN) {
// har vi valgt ut kort?
if (isset($_POST['state1'])) {
// kontroller ID
if (postval("state1") != $this->id) {
redirect::handle();
}
// beholde noen kort?
$replace = array(0, 1, 2, 3, 4);
if (isset($_POST['kort']) && is_array($_POST['kort'])) {
// gå gjennom hver og fjern fra den vi skal beholde
for ($i = 0; $i < 5; $i++) {
if (isset($_POST['kort'][$i])) {
unset($replace[$i]);
}
}
}
$this->starter_replace_cards($replace);
$dont_save = access::has("admin") && isset($_POST['renew']);
$res = $this->start_save($dont_save);
if (!$dont_save || !$res) {
redirect::handle();
}
}
}
$this->show(self::SHOW_STARTER);
}
示例14: utfor
/**
* Utfør kriminalitet
*/
protected function utfor()
{
// form sjekking
if (!$this->form->validateHashOrAlert(null, ($this->krim->last ? "Siste=" . game::timespan($this->krim->last['last'], game::TIME_ABS | game::TIME_SHORT | game::TIME_NOBOLD) . ";" : "First;") . ($this->krim->wait ? "%c11Ventetid=" . game::timespan($this->krim->wait, game::TIME_SHORT | game::TIME_NOBOLD) . "%c" : "%c9No-wait%c"))) {
return;
}
// kontroller at vi ikke har noe ventetid
if ($this->krim->wait) {
redirect::handle();
}
// finn id
$id = intval(postval("theid"));
if (!$id) {
$found = false;
foreach ($_POST as $name => $val) {
$matches = false;
if (preg_match("/^id([1-9]+|[1-9][0-9]+)\$/Du", $name, $matches)) {
$id = $matches[1];
}
}
}
// har ikke oppføringen?
if (!isset($this->krim->options[$id])) {
ess::$b->page->add_message("Ugyldig valg.", "error");
redirect::handle();
}
// lagre valget
ess::session_put("krim_last_id", $id);
// utfør kriminalitet
$result = $this->krim->utfor($id);
$fengsel_msg = $result['wanted_change'] > 0 ? ' Wanted nivået økte med ' . game::format_number($result['wanted_change'] / 10, 1) . ' %.' : '';
$msg = $result['success'] ? $this->krim->get_random_message($id, true, $result['cash'], $result['rank']) : $this->krim->get_random_message($id, false);
ess::$b->page->add_message($msg . $fengsel_msg);
// oppdater anti-bot
$this->antibot->increase_counter();
// oppdater siden
redirect::handle();
}
示例15: show
/**
* Vis banken
*/
protected function show()
{
ess::$b->page->add_js('
var user_bank = ' . js_encode(game::format_cash($this->up->data['up_bank'])) . ';
var user_cash = ' . js_encode(game::format_cash($this->up->data['up_cash'])) . ';');
ess::$b->page->add_js_domready('
$$(".bank_amount_set").each(function(elm)
{
var amount = elm.get("rel").substring(0, 4) == "bank" ? user_bank : user_cash;
var e_id = elm.get("rel").substring(5);
elm
.appendText(" (")
.grab(new Element("a", {"text":"alt"}).addEvent("click", function()
{
$(e_id).set("value", amount);
}))
.appendText(")");
});');
echo '
<div class="bg1_c small" style="width: 420px">
<h1 class="bg1">
Banken
<span class="left"></span><span class="right"></span>
</h1>
<p class="h_left">
<a href="' . ess::$s['rpath'] . '/node/31">Hjelp</a>
</p>
<p class="h_right">' . (!isset(login::$extended_access['authed']) ? '
<a href="banken?logout">Logg ut av banken</a>' : '') . '
<a href="banken?authc">Endre pass</a>
</p>
<div class="bg1" style="padding: 0 15px">
<!-- bankkonto informasjon -->
<div style="width: 50%; margin-left: -5px; float: left">
<h2 class="bg1">Bankkonto informasjon<span class="left2"></span><span class="right2"></span></h2>
<div class="bg1">
<dl class="dd_right">
<dt>Kontoeier</dt>
<dd>' . game::profile_link() . '</dd>
<dt>Bankfirma</dt>
<dd><a href="ff/?ff_id=' . $this->bank->id . '">' . htmlspecialchars($this->bank->data['ff_name']) . '</a></dd>
<dt><abbr title="Overføringstap">Overf.tap</abbr></dt>
<dd>' . $this->bank->overforingstap * 100 . ' %</dd>
<dt>Plassering</dt>
<dd>' . (!isset(game::$bydeler[$this->bank->data['br_b_id']]) ? '<span style="color: #777777">Ukjent</span>' : htmlspecialchars(game::$bydeler[$this->bank->data['br_b_id']]['name'])) . '</dd>
<dt>Balanse</dt>
<dd>' . game::format_cash($this->up->data['up_bank']) . '</dd>
</dl>
<p class="c">
<a href="javascript:void(0)" onclick="this.parentNode.style.display=\'none\'; document.getElementById(\'bank_stats\').style.display=\'block\'">Vis statistikk</a>
</p>
<div id="bank_stats" style="display: none">
<dl class="dd_right">
<dt>Sendt</dt>
<dd>' . game::format_number($this->up->data['up_bank_num_sent']) . ' stk</dd>
<dd>' . game::format_cash($this->up->data['up_bank_sent']) . '</dd>
</dl>
<dl class="dd_right">
<dt>Mottatt</dt>
<dd>' . game::format_number($this->up->data['up_bank_num_received']) . ' stk</dd>
<dd>' . game::format_cash($this->up->data['up_bank_received']) . '</dd>
</dl>
<dl class="dd_right">
<dt>Overskudd</dt>
<dd>' . game::format_cash($this->up->data['up_bank_profit']) . '</dd>
</dl>
<dl class="dd_right">
<dt><abbr title="Overføringstap">Overf.tap</abbr></dt>
<dd>' . game::format_cash($this->up->data['up_bank_charge']) . '</dd>
</dl>
<dl class="dd_right">
<dt>Renter</dt>
<dd>' . game::format_number($this->up->data['up_interest_num']) . ' stk</dd>
<dd>' . game::format_cash($this->up->data['up_interest_total']) . '</dd>
</dl>
</div>
<form action="" method="post">
<p class="c">' . show_sbutton("Bytt bank", 'name="switch"') . '</p>
</form>
</div>
</div>
<!-- send penger -->
<div style="width: 50%; margin-right: -5px; float: right">
<h2 class="bg1">Send penger<span class="left2"></span><span class="right2"></span></h2>
<div class="bg1">
<form action="" method="post">
<input type="hidden" name="sid" value="' . login::$info['ses_id'] . '" />
<input type="hidden" name="a" value="send" />
<dl class="dd_right dl_2x">
<dt>Mottaker</dt>
<dd><input type="text" name="mottaker" value="' . htmlspecialchars(postval("mottaker")) . '" class="styled w100" /></dd>
<dt>Kontakt?</dt>
<dd>
<select onchange="if(this.value==\'\')var name=prompt(\'Brukernavn?\');else var name=this.value;if(name)document.getElementsByName(\'mottaker\')[0].value=name;this.selectedIndex=0" style="width: 110px; overflow: hidden">
<option>Velg kontakt</option>';
//.........这里部分代码省略.........