本文整理汇总了PHP中check_fields函数的典型用法代码示例。如果您正苦于以下问题:PHP check_fields函数的具体用法?PHP check_fields怎么用?PHP check_fields使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_fields函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dirname
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
$page['title'] = _('Status of Web monitoring');
$page['file'] = 'httpmon.php';
$page['hist_arg'] = array('groupid', 'hostid');
define('ZBX_PAGE_DO_REFRESH', 1);
require_once dirname(__FILE__) . '/include/page_header.php';
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields = array('fullscreen' => array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1'), null), 'groupid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'hostid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null));
check_fields($fields);
/*
* Permissions
*/
if (get_request('groupid') && !API::HostGroup()->isReadable(array($_REQUEST['groupid']))) {
access_deny();
}
if (get_request('hostid') && !API::Host()->isReadable(array($_REQUEST['hostid']))) {
access_deny();
}
validate_sort_and_sortorder('name', ZBX_SORT_DOWN);
$options = array('groups' => array('real_hosts' => true, 'with_httptests' => true), 'hosts' => array('with_monitored_items' => true, 'with_httptests' => true), 'hostid' => get_request('hostid', null), 'groupid' => get_request('groupid', null));
$pageFilter = new CPageFilter($options);
$_REQUEST['groupid'] = $pageFilter->groupid;
$_REQUEST['hostid'] = $pageFilter->hostid;
$displayNodes = is_array(get_current_nodeid()) && $pageFilter->groupid == 0 && $pageFilter->hostid == 0;
示例2: explode
$vals = explode(',', substr($validation, COMBO_PATTERN_LENGTH, zbx_strlen($validation) - COMBO_PATTERN_LENGTH - 4));
$control = new CComboBox($fname, $macrosData[$exprPart['expression']]);
foreach ($vals as $v) {
$control->addItem($v, $v);
}
} else {
$control = new CTextBox($fname, $macrosData[$exprPart['expression']], 30);
}
$fields[$fname] = array($info['type'], O_OPT, null, $validation, 'isset({test_expression})', $exprPart['expression']);
}
$data_table->addRow(new CRow(array($exprPart['expression'], is_array($info) || !isset($definedErrorPhrases[$info]) ? $info['value_type'] : new CCol($definedErrorPhrases[$info], 'disaster'), $control)));
}
}
//---------------------------------- CHECKS ------------------------------------
$fields['test_expression'] = array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null);
if (!check_fields($fields)) {
$test = false;
}
//------------------------ <ACTIONS> ---------------------------
if (isset($_REQUEST['test_expression'])) {
show_messages();
$test = true;
} else {
$test = false;
}
//------------------------ </ACTIONS> --------------------------
//------------------------ <FORM> ---------------------------
$frm_test = new CFormTable(_('Test'), 'tr_testexpr.php');
$frm_test->setHelp('web.testexpr.service.php');
$frm_test->setTableClass('formlongtable formtable');
$frm_test->addVar('form_refresh', get_request('form_refresh', 1));
示例3: dirname
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
require_once dirname(__FILE__) . '/include/graphs.inc.php';
$page['file'] = 'chart3.php';
$page['type'] = PAGE_TYPE_IMAGE;
require_once dirname(__FILE__) . '/include/page_header.php';
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields = array('period' => array(T_ZBX_INT, O_OPT, P_NZERO, BETWEEN(ZBX_MIN_PERIOD, ZBX_MAX_PERIOD), null), 'stime' => array(T_ZBX_INT, O_OPT, P_NZERO, null, null), 'httptestid' => array(T_ZBX_INT, O_OPT, P_NZERO, null, null), 'http_item_type' => array(T_ZBX_INT, O_OPT, null, null, null), 'name' => array(T_ZBX_STR, O_OPT, null, null, null), 'width' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), null), 'height' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), null), 'ymin_type' => array(T_ZBX_INT, O_OPT, null, IN('0,1,2'), null), 'ymax_type' => array(T_ZBX_INT, O_OPT, null, IN('0,1,2'), null), 'ymin_itemid' => array(T_ZBX_INT, O_OPT, null, DB_ID, null), 'ymax_itemid' => array(T_ZBX_INT, O_OPT, null, DB_ID, null), 'legend' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'showworkperiod' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'showtriggers' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'graphtype' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'yaxismin' => array(T_ZBX_DBL, O_OPT, null, null, null), 'yaxismax' => array(T_ZBX_DBL, O_OPT, null, null, null), 'percent_left' => array(T_ZBX_DBL, O_OPT, null, BETWEEN(0, 100), null), 'percent_right' => array(T_ZBX_DBL, O_OPT, null, BETWEEN(0, 100), null), 'items' => array(T_ZBX_STR, O_OPT, null, null, null));
$isDataValid = check_fields($fields);
if ($httptestid = get_request('httptestid', false)) {
$color = array('current' => 0, 0 => array('next' => '1'), 1 => array('color' => 'Red', 'next' => '2'), 2 => array('color' => 'Dark Green', 'next' => '3'), 3 => array('color' => 'Blue', 'next' => '4'), 4 => array('color' => 'Dark Yellow', 'next' => '5'), 5 => array('color' => 'Cyan', 'next' => '6'), 6 => array('color' => 'Gray', 'next' => '7'), 7 => array('color' => 'Dark Red', 'next' => '8'), 8 => array('color' => 'Green', 'next' => '9'), 9 => array('color' => 'Dark Blue', 'next' => '10'), 10 => array('color' => 'Yellow', 'next' => '11'), 11 => array('color' => 'Black', 'next' => '1'));
$items = array();
$dbItems = DBselect('SELECT i.itemid' . ' FROM httpstepitem hi,items i,httpstep hs' . ' WHERE i.itemid=hi.itemid' . ' AND hs.httptestid=' . $httptestid . ' AND hs.httpstepid=hi.httpstepid' . ' AND hi.type=' . get_request('http_item_type', HTTPSTEP_ITEM_TYPE_TIME) . ' ORDER BY hs.no DESC');
while ($item = DBfetch($dbItems)) {
$itemColor = $color[$color['current'] = $color[$color['current']]['next']]['color'];
$items[] = array('itemid' => $item['itemid'], 'color' => $itemColor);
}
$httptest = get_httptest_by_httptestid($httptestid);
$name = $httptest['name'];
} else {
$items = get_request('items', array());
asort_by_key($items, 'sortorder');
$dbItems = API::Item()->get(array('webitems' => true, 'itemids' => zbx_objectValues($items, 'itemid'), 'nodeids' => get_current_nodeid(true), 'output' => API_OUTPUT_SHORTEN, 'preservekeys' => true, 'filter' => array('flags' => null)));
$dbItems = zbx_toHash($dbItems, 'itemid');
示例4: personen_liste
break;
case "person_erfassen_alt":
personen_liste();
// seitlicher block
$form = new mietkonto();
$form->erstelle_formular("Neue Person erfassen", NULL);
iframe_start();
// echo "person erfassen";
if (!isset($submit_person)) {
person_erfassen_form();
}
if (isset($submit_person)) {
echo "<pre>";
// print_r($_REQUEST);
echo "</pre>";
check_fields();
}
if (isset($submit_person_direkt)) {
person_in_db_eintragen_direkt();
}
if (isset($_REQUEST[person_speichern])) {
person_in_db_eintragen();
}
iframe_end();
$form->ende_formular();
break;
/* Neues Personeneingabeformular mit Geschlechteingabe in die Details */
/* Neues Personeneingabeformular mit Geschlechteingabe in die Details */
case "person_erfassen":
$p = new personen();
$p->form_person_erfassen();
示例5: dirname
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
require_once dirname(__FILE__) . '/include/setup.inc.php';
$page['title'] = _('Installation');
$page['file'] = 'setup.php';
if (!defined('PAGE_HEADER_LOADED') && !defined('ZBX_PAGE_NO_MENU')) {
define('ZBX_PAGE_NO_MENU', 1);
}
define('ZBX_PAGE_NO_THEME', true);
// don't load any themes for this page
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields = array('distributed' => array(T_ZBX_STR, O_OPT, null, null, null), 'trouble' => array(T_ZBX_STR, O_OPT, null, null, null), 'type' => array(T_ZBX_STR, O_OPT, null, IN('"' . ZBX_DB_MYSQL . '","' . ZBX_DB_POSTGRESQL . '","' . ZBX_DB_ORACLE . '","' . ZBX_DB_DB2 . '","' . ZBX_DB_SQLITE3 . '"'), null), 'server' => array(T_ZBX_STR, O_OPT, null, null, null), 'port' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), null, _('Port')), 'database' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, null, _('Database name')), 'user' => array(T_ZBX_STR, O_OPT, null, null, null), 'password' => array(T_ZBX_STR, O_OPT, null, null, null), 'schema' => array(T_ZBX_STR, O_OPT, null, null, null), 'zbx_server' => array(T_ZBX_STR, O_OPT, null, null, null), 'zbx_server_name' => array(T_ZBX_STR, O_OPT, null, null, null), 'zbx_server_port' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), null, _('Port')), 'message' => array(T_ZBX_STR, O_OPT, null, null, null), 'nodename' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, null), 'nodeid' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 999), null), 'save_config' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'retry' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'cancel' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'finish' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'next' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'back' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'form' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'form_refresh' => array(T_ZBX_INT, O_OPT, null, null, null));
check_fields($fields, false);
global $ZBX_CONFIG;
if (isset($_REQUEST['cancel']) || isset($_REQUEST['finish'])) {
zbx_unsetcookie('ZBX_CONFIG');
redirect('index.php');
}
$ZBX_CONFIG = get_cookie('ZBX_CONFIG', null);
$ZBX_CONFIG = isset($ZBX_CONFIG) ? unserialize($ZBX_CONFIG) : array();
if (!isset($ZBX_CONFIG['step'])) {
$ZBX_CONFIG['step'] = 0;
}
if (!isset($ZBX_CONFIG['agree'])) {
$ZBX_CONFIG['agree'] = false;
}
$ZBX_CONFIG['allowed_db'] = array();
// MYSQL
示例6: dirname
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
require_once dirname(__FILE__) . '/include/reports.inc.php';
$page['title'] = _('Bar reports');
$page['file'] = 'report6.php';
$page['hist_arg'] = array('period');
$page['scripts'] = array('class.calendar.js');
require_once dirname(__FILE__) . '/include/page_header.php';
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields = array('config' => array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1,2,3'), null), 'groupid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'hostids' => array(T_ZBX_INT, O_OPT, null, DB_ID, 'isset({config})&&({config}==3)&&isset({report_show})&&!isset({groupids})'), 'groupids' => array(T_ZBX_INT, O_OPT, null, DB_ID, 'isset({config})&&({config}==3)&&isset({report_show})&&!isset({hostids})'), 'itemid' => array(T_ZBX_INT, O_OPT, null, DB_ID . NOT_ZERO, 'isset({config})&&({config}==3)&&isset({report_show})'), 'items' => array(T_ZBX_STR, O_OPT, null, DB_ID, 'isset({report_show})&&!isset({delete_period})&&(isset({config})&&({config}!=3)||!isset({config}))', _('Items')), 'new_graph_item' => array(T_ZBX_STR, O_OPT, null, null, null), 'group_gid' => array(T_ZBX_STR, O_OPT, null, null, null), 'title' => array(T_ZBX_STR, O_OPT, null, null, null), 'xlabel' => array(T_ZBX_STR, O_OPT, null, null, null), 'ylabel' => array(T_ZBX_STR, O_OPT, null, null, null), 'showlegend' => array(T_ZBX_STR, O_OPT, null, null, null), 'sorttype' => array(T_ZBX_INT, O_OPT, null, null, null), 'scaletype' => array(T_ZBX_INT, O_OPT, null, null, null), 'avgperiod' => array(T_ZBX_INT, O_OPT, null, null, null), 'periods' => array(T_ZBX_STR, O_OPT, null, null, 'isset({report_show})&&!isset({delete_item})&&(isset({config})&&({config}==2))', _('Period')), 'new_period' => array(T_ZBX_STR, O_OPT, null, null, null), 'group_pid' => array(T_ZBX_STR, O_OPT, null, null, null), 'palette' => array(T_ZBX_INT, O_OPT, null, null, null), 'palettetype' => array(T_ZBX_INT, O_OPT, null, null, null), 'delete_item' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'delete_period' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'report_show' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'report_timesince' => array(T_ZBX_INT, O_OPT, P_UNSET_EMPTY, null, null), 'report_timetill' => array(T_ZBX_INT, O_OPT, P_UNSET_EMPTY, null, null), 'favobj' => array(T_ZBX_STR, O_OPT, P_ACT, null, null), 'favref' => array(T_ZBX_STR, O_OPT, P_ACT, NOT_EMPTY, 'isset({favobj})'), 'favstate' => array(T_ZBX_INT, O_OPT, P_ACT, NOT_EMPTY, 'isset({favobj})&&("filter"=={favobj})'));
$isValid = check_fields($fields);
if (isset($_REQUEST['new_graph_item'])) {
$_REQUEST['items'] = get_request('items', array());
$newItem = get_request('new_graph_item', array());
foreach ($_REQUEST['items'] as $item) {
if (bccomp($newItem['itemid'], $item['itemid']) == 0 && $newItem['calc_fnc'] == $item['calc_fnc'] && $newItem['caption'] == $item['caption']) {
$itemExists = true;
break;
}
}
if (!isset($itemExists)) {
array_push($_REQUEST['items'], $newItem);
}
}
// validate permissions
if (get_request('config') == 3) {
示例7: check_fields
$full_name = $_POST['ab_full_name'];
$address1 = $_POST['ab_street_address1'];
$address2 = $_POST['ab_street_address2'];
$city = $_POST['ab_city'];
$state = $_POST['ab_state'];
$zipcode = $_POST['ab_zipcode'];
$country = $_POST['ab_country'];
$phone = $_POST['ab_phone'];
$full_name = check_fields($full_name);
$address1 = check_fields($address1);
$ddress2 = check_fields($address2);
$city = check_fields($city);
$state = check_fields($state);
$zipcode = check_fields($zipcode);
$country = check_fields($country);
$phone = check_fields($phone);
$query = "INSERT INTO address_book (ab_customer_id, ab_full_name, ab_street_address1, ab_street_address2, ab_city, ab_state, ab_zipcode, ab_country, ab_phone) ";
$query .= " VALUES ({$customer_id}, '{$full_name}', '{$address1}', '{$address2}', '{$city}', '{$state}', '{$zipcode}', '{$country}', '{$phone}')";
if (mysql_query($query)) {
?>
<script>
alert("Customer Address Informacion saved successfully");
window.location = "../admin/customer_edit_report.php?customer_id=<?php
echo $customer_id;
?>
";
</script>
<?php
} else {
示例8: redirect
<?php
require_once 'includes/load.php';
include_once 'includes/header.php';
if (is_logged_in()) {
//ako je vec ulogovan
echo redirect('staff.php');
//prebaci ga na staff.php
}
if (isset($_POST['submit'])) {
//ako je izvrseno slanje podataka
//provjere za greske
$field_names = array('username', 'password');
$names_max = array('username' => 40, 'password' => 40);
//1. da li su popunjena sva obavezna polja
$errors1 = check_fields($field_names);
//$errors1 varijabla ce biti niz, ciji su elementi
//name-ovi polja koja su ostala prazna
//2. da li je prekoracen max broj karaktera
$errors2 = check_max($names_max);
//$errors2 varijabla ce biti niz, ciji su elementi
//name-ovi polja koja imaju vise od karaktera od dozvoljenih
$errors = array_merge($errors1, $errors2);
//array_merge sastavlja prosledjene nizove u jedan
if (empty($errors)) {
$username = mysqli_real_escape_string($conn, $_POST['username']);
$password = mysqli_real_escape_string($conn, $_POST['password']);
$query = "SELECT * FROM users WHERE username='{$username}'";
$result = mysqli_query($conn, $query);
confirm_query($result);
if (mysqli_num_rows($result) == 1) {
示例9: check_fields
$zipcode = $_POST["ab_zipcode"];
$country = $_POST["ab_country"];
$phone = $_POST["ab_phone"];
//Checking fields
$street1 = check_fields($street1);
$street2 = check_fields($street2);
$city = check_fields($city);
$state = check_fields($state);
$zipcode = check_fields($zipcode);
$country = check_fields($country);
$phone = check_fields($phone);
$gender = check_fields($gender);
$first_name = check_fields($first_name);
$last_name = check_fields($last_name);
$email = check_fields($email);
$password = md5(check_fields($password));
$query = "SELECT * FROM customer WHERE customer_email = '{$email}'";
$result = mysql_query($query);
$count = mysql_num_rows($result);
if ($count > 0) {
exit('Fail to create account. Email exists !');
}
$query = "INSERT INTO customer (customer_gender, customer_first_name, customer_last_name, customer_email, customer_password,";
$query .= " ab_street_address1, ab_street_address2, ab_city, ab_state, ab_zipcode, ab_country, ab_phone ,customer_date_registered, customer_last_login) ";
$query .= " VALUES ('{$gender}', '{$first_name}','{$last_name}','{$email}','{$password}', '{$street1}','{$street2}','{$city}','{$state}','{$zipcode}','{$country}','{$phone}', now(), now())";
if (mysql_query($query)) {
//echo 'Account Created !';
$_SESSION['customer_id'] = mysql_insert_id();
$_SESSION['customer_first_name'] = $first_name;
header("Location: ../checkout.php");
} else {
示例10: cpg_error
if ($CPG_SESS['admin']['page'] != 'users') {
cpg_error(_ERROR_BAD_LINK, _SEC_ERROR);
}
$username = Fix_Quotes($_POST['username'], 1);
$email = Fix_Quotes($_POST['email'], 1);
$password = Fix_Quotes($_POST['password'], 1);
if ($password != Fix_Quotes($_POST['password_confirm'], 1)) {
cpg_error(_PASSDIFFERENT);
} else {
if (strlen($password) < $MAIN_CFG['member']['minpass'] && $password != '') {
cpg_error(_YOUPASSMUSTBE . ' <b>' . $MAIN_CFG['member']['minpass'] . '</b> ' . _CHARLONG);
}
}
userCheck($_POST['username'], $_POST['email']);
$fieldlist = $valuelist = '';
check_fields($fieldlist, $valuelist, $fields);
if (empty($password)) {
$password = make_pass(8, 5);
}
$result = $db->sql_query('INSERT INTO ' . $user_prefix . '_users (username, user_email, user_password, user_regdate, user_avatar' . $fieldlist . ') ' . "VALUES ('{$username}', '{$email}', '" . md5($password) . "', '" . time() . "', '" . $MAIN_CFG['avatar']['default'] . "'" . $valuelist . ')');
$message = _WELCOMETO . " {$MAIN_CFG['global']['sitename']}!\n\n" . _YOUUSEDEMAIL . " ({$email}) " . _TOREGISTER . " {$MAIN_CFG['global']['sitename']}.\n\n " . _FOLLOWINGMEM . "\n" . _USERNAME . ": {$username}\n" . _PASSWORD . ": {$password}";
send_mail($dummy, $message, 0, _ACTIVATIONSUB, $email, $username);
URL::redirect(URL::admin());
} else {
if ($_POST['mode'] == 'promoteConf') {
if ($CPG_SESS['admin']['page'] != 'users') {
cpg_error(_ERROR_BAD_LINK, _SEC_ERROR);
}
if (can_admin()) {
list($num) = $db->sql_ufetchrow("SELECT COUNT(*) FROM " . $prefix . "_admins WHERE aid='{$_POST['aid']}'", SQL_NUM);
if ($num > 0) {
示例11: dirname
**/
require_once dirname(__FILE__) . '/include/classes/core/Z.php';
try {
Z::getInstance()->run(ZBase::EXEC_MODE_SETUP);
} catch (Exception $e) {
$warningView = new CView('general.warning', array('message' => 'Configuration file error: ' . $e->getMessage()));
$warningView->render();
exit;
}
require_once dirname(__FILE__) . '/include/setup.inc.php';
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields = array('type' => array(T_ZBX_STR, O_OPT, null, IN('"' . ZBX_DB_MYSQL . '","' . ZBX_DB_POSTGRESQL . '","' . ZBX_DB_ORACLE . '","' . ZBX_DB_DB2 . '","' . ZBX_DB_SQLITE3 . '"'), null), 'server' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, null, _('Database host')), 'port' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), null, _('Database port')), 'database' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, null, _('Database name')), 'user' => array(T_ZBX_STR, O_OPT, null, null, null), 'password' => array(T_ZBX_STR, O_OPT, null, null, null), 'schema' => array(T_ZBX_STR, O_OPT, null, null, null), 'zbx_server' => array(T_ZBX_STR, O_OPT, null, null, null), 'zbx_server_name' => array(T_ZBX_STR, O_OPT, null, null, null), 'zbx_server_port' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), null, _('Port')), 'message' => array(T_ZBX_STR, O_OPT, null, null, null), 'save_config' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'retry' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'cancel' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'finish' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'next' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'back' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'form' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'form_refresh' => array(T_ZBX_INT, O_OPT, null, null, null));
// config
$ZBX_CONFIG = get_cookie('ZBX_CONFIG', null);
$ZBX_CONFIG = isset($ZBX_CONFIG) ? unserialize($ZBX_CONFIG) : array();
$ZBX_CONFIG['check_fields_result'] = check_fields($fields, false);
if (!isset($ZBX_CONFIG['step'])) {
$ZBX_CONFIG['step'] = 0;
}
// if a guest or a non-super admin user is logged in
if (CWebUser::$data && CWebUser::getType() < USER_TYPE_SUPER_ADMIN) {
// on the last step of the setup we always have a guest user logged in;
// when he presses the "Finish" button he must be redirected to the login screen
if (CWebUser::isGuest() && $ZBX_CONFIG['step'] == 5 && hasRequest('finish')) {
zbx_unsetcookie('ZBX_CONFIG');
redirect('index.php');
} elseif (!(CWebUser::isGuest() && $ZBX_CONFIG['step'] == 5)) {
access_deny(ACCESS_DENY_PAGE);
}
} elseif (hasRequest('cancel') || hasRequest('finish')) {
zbx_unsetcookie('ZBX_CONFIG');
示例12: fill_board
<?php
$rows = $_POST["num_rows"];
$cols = $_POST["num_cols"];
$mines = $_POST["num_mines"];
$board = fill_board($rows, $cols, $mines);
// Call to Function Fill_Board
$board = check_fields($board);
// Call to Function Check_fields
show_board($board);
// Call to Function Show_Board
/**
-- Function fill_board(param1,param2,param3) --
@param1 int $num_rows Number of Rows.
@param2 int $num_cols Number of Columns.
@param3 int $mines Number of mines.
@return Array .
**/
function fill_board($num_rows, $num_cols, $mines)
{
$board = array(array());
// Setup the board with a 2 dimensional array, X/Y axis.
// Setup the Board with 0 values in all fields.
for ($f = 0; $f < $num_rows; $f++) {
for ($c = 0; $c < $num_cols; $c++) {
$board[$f][$c] = "0";
}
}
// Place all the mines given by the $mines parameter randomly.
示例13: check_fields
<?php
//==============================================================+
// File name : process_category.php
// Begin : 2014-04-05
// Last Update : 2014-04-24
//
// Description : To add category into the category table.
//
//
// Author: Natanael Sanchez Melchor
//
// (c) Copyright:
// Natanael Sanchez Melchor
// http://www.natanaelsanchez.comxa.com
// natanaelsm83@gmail.com
//==============================================================+
require_once 'db_connection.php';
require_once 'functions.php';
//Product Variables
$category_name = $_POST['category_name'];
$category_description = $_POST['category_description'];
$category_name = check_fields($category_name);
$category_description = check_fields($category_description);
//Query to insert the product
$sql = "INSERT INTO category (category_name, category_description) VALUES ('{$category_name}', '{$category_description}')";
if (mysql_query($sql)) {
header("Location: ../admin/category.php");
} else {
echo mysql_error();
}
示例14: dirname
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
require_once dirname(__FILE__) . '/include/classes/core/Z.php';
$page['file'] = 'setup.php';
try {
Z::getInstance()->run(ZBase::EXEC_MODE_SETUP);
} catch (Exception $e) {
(new CView('general.warning', ['header' => $e->getMessage(), 'messages' => [], 'theme' => ZBX_DEFAULT_THEME]))->render();
exit;
}
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields = ['type' => [T_ZBX_STR, O_OPT, null, IN('"' . ZBX_DB_MYSQL . '","' . ZBX_DB_POSTGRESQL . '","' . ZBX_DB_ORACLE . '","' . ZBX_DB_DB2 . '","' . ZBX_DB_SQLITE3 . '"'), null], 'server' => [T_ZBX_STR, O_OPT, null, null, null], 'port' => [T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), null, _('Database port')], 'database' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, null, _('Database name')], 'user' => [T_ZBX_STR, O_OPT, null, null, null], 'password' => [T_ZBX_STR, O_OPT, null, null, null], 'schema' => [T_ZBX_STR, O_OPT, null, null, null], 'zbx_server' => [T_ZBX_STR, O_OPT, null, null, null], 'zbx_server_name' => [T_ZBX_STR, O_OPT, null, null, null], 'zbx_server_port' => [T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), null, _('Port')], 'save_config' => [T_ZBX_STR, O_OPT, P_SYS, null, null], 'retry' => [T_ZBX_STR, O_OPT, P_SYS, null, null], 'cancel' => [T_ZBX_STR, O_OPT, P_SYS, null, null], 'finish' => [T_ZBX_STR, O_OPT, P_SYS, null, null], 'next' => [T_ZBX_STR, O_OPT, P_SYS, null, null], 'back' => [T_ZBX_STR, O_OPT, P_SYS, null, null]];
CSession::start();
CSession::setValue('check_fields_result', check_fields($fields, false));
if (!CSession::keyExists('step')) {
CSession::setValue('step', 0);
}
// if a guest or a non-super admin user is logged in
if (CWebUser::$data && CWebUser::getType() < USER_TYPE_SUPER_ADMIN) {
// on the last step of the setup we always have a guest user logged in;
// when he presses the "Finish" button he must be redirected to the login screen
if (CWebUser::isGuest() && CSession::getValue('step') == 5 && hasRequest('finish')) {
CSession::clear();
redirect('index.php');
} elseif (!(CWebUser::isGuest() && CSession::getValue('step') == 5)) {
access_deny(ACCESS_DENY_PAGE);
}
} elseif (hasRequest('cancel') || hasRequest('finish')) {
CSession::clear();
示例15: register_finish
function register_finish()
{
global $db, $user_cfg, $user_prefix, $sitename, $sec_code, $CPG_SESS, $userinfo, $MAIN_CFG;
if ($sec_code & 4) {
if (!validate_secimg()) {
cpg_error(_SECCODEINCOR);
}
}
$fields = $_SESSION['REGISTER'];
if (empty($fields['username'])) {
cpg_error('session gone...');
}
$random = empty($fields['password']);
if ($random) {
$fields['password'] = make_pass(8, 5);
}
$user_email = $fields['email'];
$fieldlist = $valuelist = '';
check_fields($fieldlist, $valuelist, $fields, false);
$username = $fields['username'];
$password = $random ? "\n" . _PASSWORD . ': ' . $fields['password'] : '';
mt_srand((double) microtime() * 1000000);
$check_num = mt_rand(0, 1000000);
$check_num = md5($check_num);
$new_password = md5($fields['password']);
$user_regdate = time();
if ($user_cfg['useactivate'] || $user_cfg['requireadmin']) {
$result = $db->sql_query("INSERT INTO " . $user_prefix . "_users_temp (username, user_email, user_password, user_regdate, check_num, time" . $fieldlist . ") VALUES ('{$username}', '{$user_email}', '{$new_password}', '{$user_regdate}', '{$check_num}', {$user_regdate} {$valuelist})");
} else {
$result = $db->sql_query("INSERT INTO " . $user_prefix . "_users (username, user_email, user_password, user_regdate, user_lastvisit, user_avatar {$fieldlist}) VALUES ('{$username}', '{$user_email}', '{$new_password}', '{$user_regdate}', {$user_regdate}, '{$MAIN_CFG['avatar']['default']}' {$valuelist})");
if ($user_cfg['send_welcomepm']) {
welcome_pm();
}
}
$uid = $db->sql_nextid('user_id');
$finishlink = URL::index("&file=register&activate={$uid}&check_num={$check_num}", true, true);
$message = _WELCOMETO . " {$sitename}!\n\n" . _YOUUSEDEMAIL . " ({$user_email}) ";
if ($fields['coppa']) {
// $message = $lang['COPPA'];
// $email_template = 'coppa_welcome_inactive';
$message .= _TOAPPLY . " {$sitename}.\n\n" . _WAITAPPROVAL . "\n\n" . _FOLLOWINGMEM . "\n" . _USERNAME . ": {$username}{$password}";
$subject = _APPLICATIONSUB;
OpenTable();
echo "<center><b>" . _ACCOUNTRESERVED . "</b><br /><br />" . _YOUAREPENDING . "<br /><br />" . _THANKSAPPL . " {$sitename}!</center>";
} else {
if (!$user_cfg['requireadmin']) {
$message .= _TOREGISTER . " {$sitename}.\n\n";
OpenTable();
echo "<center><b>" . _ACCOUNTCREATED . "</b><br /><br />" . _YOUAREREGISTERED . "<br /><br />";
if ($user_cfg['useactivate']) {
echo _FINISHUSERCONF;
$message .= _TOFINISHUSER . "\n\n {$finishlink}\n\n";
//<- Is the activation link in email. DJMaze
$subject = _ACTIVATIONSUB;
} else {
echo _FINISHUSERCONF2 . '<a href="' . URL::index() . '">' . _FINISHUSERCONF3 . '</a>.';
$subject = _REGISTRATIONSUB;
}
echo '<br /><br />' . _THANKSUSER . " {$sitename}!</center>";
$message .= _FOLLOWINGMEM . "\n" . _USERNAME . ": {$username}{$password}";
} else {
$message .= _TOAPPLY . " {$sitename}.\n\n" . _WAITAPPROVAL . "\n\n" . _FOLLOWINGMEM . "\n" . _USERNAME . ": {$username}{$password}";
$subject = _APPLICATIONSUB;
OpenTable();
echo '<center><b>' . _ACCOUNTRESERVED . '</b><br /><br />' . _YOUAREPENDING . '<br /><br />' . _THANKSAPPL . " {$sitename}!</center>";
}
}
$from = 'noreply@' . str_replace('www.', '', $MAIN_CFG['server']['domain']);
if (!send_mail($mailer_message, $message, 0, $subject, $user_email, $username, $from)) {
echo 'Member mail: ' . $mailer_message;
}
if ($user_cfg['sendaddmail']) {
if ($user_cfg['requireadmin']) {
$subject = "{$sitename} - " . _MEMAPL;
} else {
$subject = "{$sitename} - " . _MEMADD;
}
$message = "{$username} has been added to {$sitename}.\n\nUser IP: " . decode_ip($userinfo['user_ip']) . "\n--------------------------------------------------------\nDo not reply to this message!!";
if (!send_mail($mailer_message, $message, 0, $subject)) {
echo "Admin mail: " . $mailer_message;
}
}
CloseTable();
unset($_SESSION['REGISTER']);
}