本文整理汇总了PHP中clearCookies函数的典型用法代码示例。如果您正苦于以下问题:PHP clearCookies函数的具体用法?PHP clearCookies怎么用?PHP clearCookies使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了clearCookies函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: logoutUser
function logoutUser()
{
header("Content-Type: text/html; charset=utf-8");
logLogout(getCookie('ID'));
if (getCookie('ID')) {
connectDatabase();
slashArray($_COOKIE);
// reset session id
$sessionId = rand_string(32);
$update = "UPDATE users SET session_id='{$sessionId}' WHERE sha256_user='" . getCookie('ID') . "'";
$result = mysql_query($update);
$sessionId = rand_string(32);
}
//this deletes the cookies
clearCookies();
header("Location: index.php");
}
示例2: elseif
}
} elseif (str_in_array(getRequest('go'), array('activate', 'disable')) && hasRequest('g_hostdruleid')) {
$groupHostDiscoveryRuleId = getRequest('g_hostdruleid');
$enable = getRequest('go') == 'activate';
DBstart();
$result = $enable ? activate_item($groupHostDiscoveryRuleId) : disable_item($groupHostDiscoveryRuleId);
$result = DBend($result);
$updated = count($groupHostDiscoveryRuleId);
$messageSuccess = $enable ? _n('Discovery rule enabled', 'Discovery rules enabled', $updated) : _n('Discovery rule disabled', 'Discovery rules disabled', $updated);
$messageFailed = $enable ? _n('Cannot enable discovery rules', 'Cannot enable discovery rules', $updated) : _n('Cannot disable discovery rules', 'Cannot disable discovery rules', $updated);
show_messages($result, $messageSuccess, $messageFailed);
clearCookies($result, getRequest('hostid'));
} elseif ($_REQUEST['go'] == 'delete' && isset($_REQUEST['g_hostdruleid'])) {
$goResult = API::DiscoveryRule()->delete($_REQUEST['g_hostdruleid']);
show_messages($goResult, _('Discovery rules deleted'), _('Cannot delete discovery rules'));
clearCookies($goResult, $_REQUEST['hostid']);
}
/*
* Display
*/
if (isset($_REQUEST['form'])) {
$data = getItemFormData(array('is_discovery_rule' => true));
$data['page_header'] = _('CONFIGURATION OF DISCOVERY RULES');
// render view
$itemView = new CView('configuration.item.edit', $data);
$itemView->render();
$itemView->show();
} else {
$data = array('hostid' => get_request('hostid', 0), 'host' => $host, 'showErrorColumn' => $host['status'] != HOST_STATUS_TEMPLATE);
$sortfield = getPageSortField('name');
// discoveries
示例3: header
<?php
header('Content-type:text/html;charset=utf-8');
error_reporting(E_ALL & ~E_NOTICE);
function clearCookies()
{
setCookie('username', '', time() - 3600);
setCookie('password', '', time() - 3600);
}
/*判断用户执行的是否是登录操作*/
if ($_GET['action'] == 'login') {
//先清除原有的cookie
clearCookies();
if ($_POST['username'] == 'gyz' && $_POST['password'] == 'gyz.123') {
//通过验证后将当前登录者的信息存储至客户端的cookie文件中
setCookie('username', $_POST['username'], time() + 3600 * 24 * 7);
setCookie('isLogin', 1, time() + 3600 * 24 * 7);
//显示登录后的主页面
header('Location:home.php');
} else {
die(nl2br("\n用户名或密码错误!\n"));
}
} else {
if ($_GET['action'] == 'logout') {
//clearCookies();
setCookie('isLogin', '', time() - 1);
}
}
?>
<!DOCTYPE HTML>
<html>
示例4: foreach
}
}
} else {
$goResult = API::TemplateScreen()->delete($screenids);
if ($goResult) {
$templatedScreens = API::TemplateScreen()->get(array('screenids' => $screenids, 'output' => API_OUTPUT_EXTEND, 'editable' => true));
foreach ($templatedScreens as $screen) {
add_audit_details(AUDIT_ACTION_DELETE, AUDIT_RESOURCE_SCREEN, $screen['screenid'], $screen['name']);
}
}
}
if ($goResult) {
unset($_REQUEST['screenid'], $_REQUEST['form']);
}
show_messages($goResult, _('Screen deleted'), _('Cannot delete screen'));
clearCookies($goResult);
}
/*
* Display
*/
if (isset($_REQUEST['form'])) {
$data = array('form' => get_request('form', null), 'screenid' => get_request('screenid', null), 'templateid' => get_request('templateid', null));
// screen
if (!empty($data['screenid'])) {
$options = array('screenids' => $data['screenid'], 'editable' => true, 'output' => API_OUTPUT_EXTEND);
if (!empty($data['templateid'])) {
$screens = API::TemplateScreen()->get($options);
} else {
$screens = API::Screen()->get($options);
}
$data['screen'] = reset($screens);
示例5: DBstart
DBstart();
$result = updateHostStatus($actHosts, $status);
$result = DBend($result);
$updated = count($actHosts);
$messageSuccess = $enable ? _n('Host enabled', 'Hosts enabled', $updated) : _n('Host disabled', 'Hosts disabled', $updated);
$messageFailed = $enable ? _n('Cannot enable host', 'Cannot enable hosts', $updated) : _n('Cannot disable host', 'Cannot disable hosts', $updated);
################################################################
# update racktables object
require_once 'racktablesapi.php';
$response = updateObjectStatus($hostNames, $status);
if (isset($response['error'])) {
show_messages(false, '', "Updating racktables object is failed. Error message:" . $response['error']);
}
################################################################
show_messages($result, $messageSuccess, $messageFailed);
clearCookies($result);
}
}
/*
* Display
*/
$hostsWidget = new CWidget();
$pageFilter = new CPageFilter(array('groups' => array('real_hosts' => true, 'editable' => true), 'groupid' => get_request('groupid', null)));
$_REQUEST['groupid'] = $pageFilter->groupid;
$_REQUEST['hostid'] = get_request('hostid', 0);
if ($_REQUEST['go'] == 'massupdate' && isset($_REQUEST['hosts'])) {
$hostsWidget->addPageHeader(_('CONFIGURATION OF HOSTS'));
$data = array('hosts' => get_request('hosts', array()), 'visible' => get_request('visible', array()), 'mass_replace_tpls' => get_request('mass_replace_tpls'), 'mass_clear_tpls' => get_request('mass_clear_tpls'), 'groups' => get_request('groups', array()), 'newgroup' => get_request('newgroup', ''), 'status' => get_request('status', HOST_STATUS_MONITORED), 'proxy_hostid' => get_request('proxy_hostid', ''), 'ipmi_authtype' => get_request('ipmi_authtype', -1), 'ipmi_privilege' => get_request('ipmi_privilege', 2), 'ipmi_username' => get_request('ipmi_username', ''), 'ipmi_password' => get_request('ipmi_password', ''), 'inventory_mode' => get_request('inventory_mode', HOST_INVENTORY_DISABLED), 'host_inventory' => get_request('host_inventory', array()), 'templates' => get_request('templates', array()));
// sort templates
natsort($data['templates']);
// get groups
示例6: elseif
} elseif (isset($_SESSION['SESS_LOGIN_SITE'])) {
$domain = $_SESSION['SESS_LOGIN_SITE'];
}
loadLogiksApp($domain);
$relink = "";
if (isset($_REQUEST['relink'])) {
$relink = $_REQUEST['relink'];
}
// $dbLogLink=LogDB::singleton()->getLogDBCon();
// $q1=$dbLogLink->_updateQ("lgks_log_login",
// array('logout_time'=>date('Y-m-d H:i:s'), 'status'=>'LOGGED OUT'),
// array(
// "user"=>$_SESSION['SESS_USER_ID'],
// "status"=>"LOGGED IN",
// )
// )." AND (token='{$_SESSION['SESS_TOKEN']}' OR mauth_key='{$_SESSION['MAUTH_KEY']}')";
// $dbLogLink->executeQuery($q1,true);
clearCookies(null);
session_destroy();
if (strlen($relink) > 0) {
if ($relink == "#") {
header("Location:" . _link(getConfig("PAGE_HOME")));
} else {
header("Location:{$relink}");
}
} else {
header("Location:" . _link(getConfig("PAGE_HOME")));
}
?>
<h5>Redirecting To Login Screen ...</h5>
示例7: DBend
$goResult = DBend($goResult);
show_messages($goResult, _('History cleared'), $goResult);
clearCookies($goResult, get_request('hostid'));
} elseif ($_REQUEST['go'] == 'delete' && isset($_REQUEST['group_itemid'])) {
DBstart();
$group_itemid = $_REQUEST['group_itemid'];
$itemsToDelete = API::Item()->get(array('output' => array('key_', 'itemid'), 'selectHosts' => array('name'), 'itemids' => $group_itemid, 'preservekeys' => true));
$goResult = API::Item()->delete($group_itemid);
if ($goResult) {
foreach ($itemsToDelete as $item) {
$host = reset($item['hosts']);
add_audit(AUDIT_ACTION_DELETE, AUDIT_RESOURCE_ITEM, _('Item') . ' [' . $item['key_'] . '] [' . $item['itemid'] . '] ' . _('Host') . ' [' . $host['name'] . ']');
}
}
show_messages(DBend($goResult), _('Items deleted'), _('Cannot delete items'));
clearCookies($goResult, get_request('hostid'));
}
/*
* Display
*/
if (isset($_REQUEST['form']) && str_in_array($_REQUEST['form'], array(_('Create item'), 'update', 'clone'))) {
$data = getItemFormData();
$data['page_header'] = _('CONFIGURATION OF ITEMS');
// render view
$itemView = new CView('configuration.item.edit', $data);
$itemView->render();
$itemView->show();
} elseif ($_REQUEST['go'] == 'massupdate' || isset($_REQUEST['massupdate']) && isset($_REQUEST['group_itemid'])) {
$data = array('form' => get_request('form'), 'hostid' => get_request('hostid'), 'itemids' => get_request('group_itemid', array()), 'description' => get_request('description', ''), 'delay' => get_request('delay', ZBX_ITEM_DELAY_DEFAULT), 'delay_flex' => get_request('delay_flex', array()), 'history' => get_request('history', 90), 'status' => get_request('status', 0), 'type' => get_request('type', 0), 'interfaceid' => get_request('interfaceid', 0), 'snmp_community' => get_request('snmp_community', 'public'), 'port' => get_request('port', ''), 'value_type' => get_request('value_type', ITEM_VALUE_TYPE_UINT64), 'data_type' => get_request('data_type', ITEM_DATA_TYPE_DECIMAL), 'trapper_hosts' => get_request('trapper_hosts', ''), 'units' => get_request('units', ''), 'authtype' => get_request('authtype', ''), 'username' => get_request('username', ''), 'password' => get_request('password', ''), 'publickey' => get_request('publickey', ''), 'privatekey' => get_request('privatekey', ''), 'valuemapid' => get_request('valuemapid', 0), 'delta' => get_request('delta', 0), 'trends' => get_request('trends', DAY_IN_YEAR), 'applications' => get_request('applications', array()), 'snmpv3_contextname' => get_request('snmpv3_contextname', ''), 'snmpv3_securityname' => get_request('snmpv3_securityname', ''), 'snmpv3_securitylevel' => get_request('snmpv3_securitylevel', 0), 'snmpv3_authprotocol' => get_request('snmpv3_authprotocol', ITEM_AUTHPROTOCOL_MD5), 'snmpv3_authpassphrase' => get_request('snmpv3_authpassphrase', ''), 'snmpv3_privprotocol' => get_request('snmpv3_privprotocol', ITEM_PRIVPROTOCOL_DES), 'snmpv3_privpassphrase' => get_request('snmpv3_privpassphrase', ''), 'formula' => get_request('formula', '1'), 'logtimefmt' => get_request('logtimefmt', ''), 'initial_item_type' => null, 'multiple_interface_types' => false, 'visible' => get_request('visible', array()));
// hosts
$data['hosts'] = API::Host()->get(array('itemids' => $data['itemids'], 'selectInterfaces' => API_OUTPUT_EXTEND));
示例8: access_deny
if (!isset($dbGroups[$groupid])) {
access_deny();
}
}
$options['groupids'] = $_REQUEST['copy_targetid'];
}
$dbHosts = API::Host()->get($options);
DBstart();
foreach ($_REQUEST['group_graphid'] as $graphid) {
foreach ($dbHosts as $host) {
$goResult &= (bool) copyGraphToHost($graphid, $host['hostid']);
}
}
$goResult = DBend($goResult);
show_messages($goResult, _('Graphs copied'), _('Cannot copy graphs'));
clearCookies($goResult, empty($_REQUEST['parent_discoveryid']) ? $_REQUEST['hostid'] : $_REQUEST['parent_discoveryid']);
$_REQUEST['go'] = 'none2';
} else {
error(_('No target selected.'));
}
show_messages();
}
/*
* Display
*/
$pageFilter = new CPageFilter(array('groups' => array('not_proxy_hosts' => true, 'editable' => true), 'hosts' => array('editable' => true, 'templated_hosts' => true), 'groupid' => get_request('groupid', null), 'hostid' => get_request('hostid', null)));
if (empty($_REQUEST['parent_discoveryid'])) {
if ($pageFilter->groupid > 0) {
$_REQUEST['groupid'] = $pageFilter->groupid;
}
if ($pageFilter->hostid > 0) {
示例9: clearCookies
}
CProfile::update('web.tr_status.filter.ack_status', $_REQUEST['ack_status'], PROFILE_TYPE_INT);
} else {
$_REQUEST['ack_status'] = $config['event_ack_enable'] == EVENT_ACK_DISABLED ? ZBX_ACK_STS_ANY : CProfile::get('web.tr_status.filter.ack_status', ZBX_ACK_STS_ANY);
}
// txt select
if (isset($_REQUEST['txt_select'])) {
CProfile::update('web.tr_status.filter.txt_select', $_REQUEST['txt_select'], PROFILE_TYPE_STR);
} else {
$_REQUEST['txt_select'] = CProfile::get('web.tr_status.filter.txt_select', '');
}
/*
* Clean cookies
*/
if (get_request('show_events') != CProfile::get('web.tr_status.filter.show_events')) {
clearCookies(true);
}
/*
* Page sorting
*/
validate_sort_and_sortorder('lastchange', ZBX_SORT_DOWN);
/*
* Play sound
*/
$mute = CProfile::get('web.tr_status.mute', 0);
if (isset($audio) && !$mute) {
play_sound($audio);
}
/*
* Display
*/
示例10: foreach
foreach ($dbTriggerPrototypes as $dbTriggerPrototype) {
$update[] = array('triggerid' => $dbTriggerPrototype['triggerid'], 'status' => $status);
}
$result = API::TriggerPrototype()->update($update);
} else {
$result = true;
}
$updated = count($update);
$messageSuccess = $enable ? _n('Trigger prototype enabled', 'Trigger prototypes enabled', $updated) : _n('Trigger prototype disabled', 'Trigger prototypes disabled', $updated);
$messageFailed = $enable ? _n('Cannot enable trigger prototype', 'Cannot enable trigger prototypes', $updated) : _n('Cannot disable trigger prototype', 'Cannot disable trigger prototypes', $updated);
show_messages($result, $messageSuccess, $messageFailed);
clearCookies($result, getRequest('parent_discoveryid'));
} elseif (getRequest('go') == 'delete' && hasRequest('g_triggerid')) {
$result = API::TriggerPrototype()->delete(getRequest('g_triggerid'));
show_messages($result, _('Trigger prototypes deleted'), _('Cannot delete trigger prototypes'));
clearCookies($result, getRequest('parent_discoveryid'));
}
/*
* Display
*/
if ($_REQUEST['go'] == 'massupdate' && isset($_REQUEST['g_triggerid'])) {
$triggersView = new CView('configuration.triggers.massupdate', getTriggerMassupdateFormData());
$triggersView->render();
$triggersView->show();
} elseif (isset($_REQUEST['form'])) {
$triggersView = new CView('configuration.triggers.edit', getTriggerFormData());
$triggersView->render();
$triggersView->show();
} else {
$data = array('parent_discoveryid' => get_request('parent_discoveryid'), 'showErrorColumn' => false, 'discovery_rule' => $discovery_rule, 'hostid' => get_request('hostid'), 'showdisabled' => get_request('showdisabled', 1), 'triggers' => array(), 'displayNodes' => false);
CProfile::update('web.triggers.showdisabled', $data['showdisabled'], PROFILE_TYPE_INT);
示例11: changeCookie
function changeCookie()
{
// header("Content-Type: text/html; charset=utf-8");
//Checks if there is a login cookie
if (getCookie('ID')) {
if (!get_magic_quotes_gpc()) {
$funcHash = addslashes(getCookie('ID'));
$funcSession = addslashes(getCookie('Session_ID'));
} else {
$funcHash = getCookie('ID');
$funcSession = getCookie('Session_ID');
}
$funcCheck = mysql_query("SELECT * FROM users WHERE sha256_user = '{$funcHash}'");
if ($funcCheck) {
while ($funcInfo = mysql_fetch_array($funcCheck)) {
// this resets the stored session id
$funcNewSession = rand_string(32);
$funcUpdate = "UPDATE users SET session_id='{$funcNewSession}' WHERE sha256_user='{$funcHash}'";
$funcResult = mysql_query($funcUpdate);
if ($funcSession != $funcInfo['session_id']) {
//this deletes the cookie
clearCookies();
// clear the variable values
$funcHash = rand_string(32);
$funcSession = rand_string(32);
$funcNewSession = rand_string(32);
$funcCheck = rand_string(32);
$funcInfo = rand_string(32);
// kick them out
header('Location: logout.php');
} else {
// reset the cookie
setCookies($funcHash, $funcNewSession);
}
}
} else {
//this deletes the cookie
clearCookies();
// clear the variable values
$funcHash = rand_string(32);
$funcSession = rand_string(32);
$funcNewSession = rand_string(32);
$funcCheck = rand_string(32);
$funcInfo = rand_string(32);
// kick them out
header('Location: logout.php');
}
} else {
//this deletes the cookie
clearCookies();
// clear the variable values
$funcHash = rand_string(32);
$funcSession = rand_string(32);
$funcNewSession = rand_string(32);
$funcCheck = rand_string(32);
$funcInfo = rand_string(32);
// kick them out
header('Location: logout.php');
}
// clear the variable values
$funcHash = rand_string(32);
$funcNewSession = rand_string(32);
$funcSession = rand_string(32);
$funcCheck = rand_string(32);
$funcInfo = rand_string(32);
}
示例12: foreach
foreach ((array) getRequest('group_hostid') as $hostPrototypeId) {
$update[] = array('hostid' => $hostPrototypeId, 'status' => $status);
}
$result = API::HostPrototype()->update($update);
DBend($result);
$updated = count($update);
$messageSuccess = $enable ? _n('Host prototype enabled', 'Host prototypes enabled', $updated) : _n('Host prototype disabled', 'Host prototypes disabled', $updated);
$messageFailed = $enable ? _n('Cannot enable host prototype', 'Cannot enable host prototypes', $updated) : _n('Cannot disable host prototype', 'Cannot disable host prototypes', $updated);
show_messages($result, $messageSuccess, $messageFailed);
clearCookies($result, $discoveryRule['itemid']);
} elseif ($_REQUEST['go'] == 'delete' && isset($_REQUEST['group_hostid'])) {
DBstart();
$go_result = API::HostPrototype()->delete($_REQUEST['group_hostid']);
show_messages($go_result, _('Host prototypes deleted'), _('Cannot delete host prototypes'));
DBend($go_result);
clearCookies($go_result, $discoveryRule['itemid']);
}
/*
* Display
*/
if (isset($_REQUEST['form'])) {
$data = array('discovery_rule' => $discoveryRule, 'host_prototype' => array('hostid' => get_request('hostid'), 'templateid' => get_request('templateid'), 'host' => get_request('host'), 'name' => get_request('name'), 'status' => get_request('status', HOST_STATUS_MONITORED), 'templates' => array(), 'inventory' => array('inventory_mode' => get_request('inventory_mode', HOST_INVENTORY_DISABLED)), 'groupPrototypes' => get_request('group_prototypes', array())), 'groups' => array());
// add already linked and new templates
$data['host_prototype']['templates'] = API::Template()->get(array('output' => array('templateid', 'name'), 'templateids' => get_request('templates', array())));
// add parent host
$parentHost = API::Host()->get(array('output' => API_OUTPUT_EXTEND, 'selectGroups' => array('groupid', 'name'), 'selectInterfaces' => API_OUTPUT_EXTEND, 'selectMacros' => API_OUTPUT_EXTEND, 'hostids' => $discoveryRule['hostid'], 'templated_hosts' => true));
$parentHost = reset($parentHost);
$data['parent_host'] = $parentHost;
if (get_request('group_links')) {
$data['groups'] = API::HostGroup()->get(array('output' => API_OUTPUT_EXTEND, 'groupids' => get_request('group_links'), 'editable' => true, 'preservekeys' => true));
}
示例13: getRequest
$hostId = getRequest('hostid');
$enable = getRequest('go') == 'activate';
$updated = 0;
DBstart();
foreach (getRequest('applications') as $id => $appid) {
$dbItems = DBselect('SELECT ia.itemid,i.hostid,i.key_' . ' FROM items_applications ia' . ' LEFT JOIN items i ON ia.itemid=i.itemid' . ' WHERE ia.applicationid=' . zbx_dbstr($appid) . ' AND i.hostid=' . zbx_dbstr($hostId) . ' AND i.type<>' . ITEM_TYPE_HTTPTEST . andDbNode('ia.applicationid'));
while ($item = DBfetch($dbItems)) {
$result &= $enable ? activate_item($item['itemid']) : disable_item($item['itemid']);
$updated++;
}
}
$result = DBend($result);
$messageSuccess = $enable ? _n('Item enabled', 'Items enabled', $updated) : _n('Item disabled', 'Items disabled', $updated);
$messageFailed = $enable ? _n('Cannot enable item', 'Cannot enable items', $updated) : _n('Cannot disable item', 'Cannot disable items', $updated);
show_messages($result, $messageSuccess, $messageFailed);
clearCookies($result, $hostId);
}
/*
* Display
*/
if (isset($_REQUEST['form'])) {
$data = array('applicationid' => get_request('applicationid'), 'groupid' => get_request('groupid', 0), 'form' => get_request('form'), 'form_refresh' => get_request('form_refresh', 0));
if (isset($data['applicationid']) && !isset($_REQUEST['form_refresh'])) {
$dbApplication = reset($dbApplication);
$data['appname'] = $dbApplication['name'];
$data['hostid'] = $dbApplication['hostid'];
} else {
$data['appname'] = get_request('appname', '');
$data['hostid'] = get_request('hostid');
}
// render view