本文整理汇总了PHP中misc::clean方法的典型用法代码示例。如果您正苦于以下问题:PHP misc::clean方法的具体用法?PHP misc::clean怎么用?PHP misc::clean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类misc
的用法示例。
在下文中一共展示了misc::clean方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: switch
$node->checkAll(time());
switch ($_GET['action']) {
case 'add':
if ($flags['combat']) {
if (isset($_POST['name'], $_POST['attackerGroupUnitIds'], $_POST['attackerGroups'])) {
foreach ($_POST as $key => $value) {
if (!in_array($key, array('name', 'attackerGroupUnitIds', 'attackerGroups', 'attackerFocus'))) {
$_POST[$key] = misc::clean($value, 'numeric');
} else {
if (!in_array($key, array('name', 'attackerFocus'))) {
$nr = count($_POST[$key]);
for ($i = 0; $i < $nr; $i++) {
$_POST[$key][$i] = misc::clean($_POST[$key][$i], 'numeric');
}
} else {
$_POST[$key] = misc::clean($value);
}
}
}
$target = new node();
if ($target->get('name', $_POST['name']) == 'done') {
$targetUser = new user();
if ($targetUser->get('id', $target->data['user']) == 'done') {
$alliance = new alliance();
$targetAlliance = new alliance();
if ($targetAlliance->get('id', $targetUser->data['alliance']) == 'done' && $alliance->get('id', $_SESSION[$shortTitle . 'User']['alliance']) == 'done') {
$war = $alliance->getWar($targetAlliance->data['id']);
if (isset($war['type'])) {
$gotStatic = false;
$data = array();
$data['input']['attacker']['focus'] = $_POST['attackerFocus'];
示例2: foreach
<?php
include 'core/config.php';
include 'core/core.php';
include 'core/game.php';
include 'locales/' . $_SESSION[$shortTitle . 'User']['locale'] . '/gl.php';
$db->query('start transaction');
if (isset($_SESSION[$shortTitle . 'User']['id'], $_GET['action'])) {
foreach ($_POST as $key => $value) {
$_POST[$key] = misc::clean($value);
}
foreach ($_GET as $key => $value) {
$_GET[$key] = misc::clean($value);
}
$alliance = new alliance();
$status = $alliance->get('id', $_SESSION[$shortTitle . 'User']['alliance']);
switch ($_GET['action']) {
case 'get':
if ($_SESSION[$shortTitle . 'User']['alliance']) {
if ($status == 'done') {
$alliance->getAll();
} else {
$message = $ui[$status];
}
} else {
$invitations = alliance::getInvitations('user', $_SESSION[$shortTitle . 'User']['id']);
}
break;
case 'set':
$nodes = node::getList($_SESSION[$shortTitle . 'User']['id']);
$nodeList = '';
示例3: switch
$_POST[$key] = misc::clean($value);
}
switch ($_GET['action']) {
case 'login':
if (isset($_POST['name'], $_POST['password'])) {
$name = $_POST['name'];
$pass = sha1($_POST['password']);
if (isset($_POST['remember'])) {
$remember = 1;
} else {
$remember = 0;
}
} else {
if (isset($_COOKIE[$shortTitle . 'Name'], $_COOKIE[$shortTitle . 'Password'])) {
$name = misc::clean($_COOKIE[$shortTitle . 'Name']);
$pass = misc::clean($_COOKIE[$shortTitle . 'Password']);
$remember = 1;
}
}
if (isset($name, $pass)) {
$user = new user();
$status = $user->get('name', $name);
if ($status == 'done') {
if ($flags['login'] || $user->data['level'] == 3) {
if ($user->data['password'] == $pass) {
if ($user->data['level']) {
$user->data['ip'] = $_SERVER['REMOTE_ADDR'];
$user->data['lastVisit'] = strftime('%Y-%m-%d %H:%M:%S', time());
$user->set();
$_SESSION[$shortTitle . 'User'] = $user->data;
if ($remember) {
示例4: rand
<?php
include 'core/config.php';
include 'core/core.php';
$db->query('start transaction');
if (isset($_POST['x'], $_POST['y'])) {
$x = misc::clean($_POST['x']);
$y = misc::clean($_POST['y']);
} else {
$x = rand(0, 49);
$y = rand(0, 49);
}
$grid = new grid();
$grid->get($x, $y);
if (isset($status) && $status == 'error') {
$db->query('rollback');
} else {
$db->query('commit');
}
include 'templates/' . $_SESSION[$shortTitle . 'User']['template'] . '/getGrid.php';
示例5: grid
<?php
include 'core/config.php';
include 'core/core.php';
$db->query('start transaction');
if (isset($_GET['x'], $_GET['y'])) {
$x = misc::clean($_GET['x'], 'numeric');
$y = misc::clean($_GET['y'], 'numeric');
$vars = 'x=' . $x . '&y=' . $y;
}
$grid = new grid();
$grid->getAll();
if (isset($status) && $status == 'error') {
$db->query('rollback');
} else {
$db->query('commit');
}
include 'templates/' . $_SESSION[$shortTitle . 'User']['template'] . '/grid.php';