本文整理汇总了PHP中check_cookie函数的典型用法代码示例。如果您正苦于以下问题:PHP check_cookie函数的具体用法?PHP check_cookie怎么用?PHP check_cookie使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_cookie函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Request
<?php
require_once 'check_cookie.php';
require_once 'show_list.php';
require_once 'Request.php';
require_once 'Assign.php';
require_once 'Users.php';
if (check_cookie($_SERVER['PHP_SELF'], 2)) {
$row_size = '1';
if (!empty($_POST)) {
// Update the 'approved' property
$req = new Request();
$approved = empty($_POST['approved']) ? 'false' : 'true';
$query = 'UPDATE request SET approved=' . $approved . ' WHERE id=' . $_POST['rid'];
$req->query($query);
// What's the id of the person this job is assigned to?
$user = new Users();
$user->fullname = $_POST['assign_to'];
$user->find();
$aid = $user->uid;
// Insert the new assignment
$asn = new Assign();
$asn->rid = $_POST['rid'];
$asn->hours = $_POST['hours'];
$asn->cost = str_replace('$', '', $_POST['cost']);
$asn->complete = parse_date($_POST);
$asn->aid = $aid;
$asn->insert();
header('Location: index.php');
}
// Initialize values!
示例2: View
function View()
{
$this->named_vars = array();
$this->header_sent = false;
global $db;
global $request;
$env =& environment();
if (isset($request->resource)) {
$this->collection = new Collection($request->resource);
} else {
$this->collection = new Collection(null);
}
$this->named_vars['db'] =& $db;
$this->named_vars['request'] =& $request;
$this->named_vars['collection'] =& $this->collection;
$this->named_vars['response'] =& $this;
if (check_cookie()) {
$this->named_vars['profile'] =& get_profile();
} else {
$this->named_vars['profile'] = false;
}
if (isset($request->resource) && $request->resource != 'introspection') {
$this->named_vars['resource'] =& $db->get_table($request->resource);
} else {
$this->named_vars['resource'] = false;
}
$this->named_vars['prefix'] = $db->prefix;
$this->controller = $request->controller;
load_apps();
$controller_path = controller_path();
// check for a controller file in controllers/[resource].php
if (isset($request->resource)) {
$cont = $controller_path . $request->resource . ".php";
if (file_exists($cont)) {
$this->controller = $request->resource . ".php";
} elseif (isset($request->templates_resource[$request->resource]) && file_exists($controller_path . $request->templates_resource[$request->resource] . ".php")) {
$this->controller = $request->templates_resource[$request->resource] . ".php";
} else {
if (isset($GLOBALS['PATH']['apps'])) {
foreach ($GLOBALS['PATH']['apps'] as $k => $v) {
if (file_exists($v['controller_path'] . $request->resource . ".php")) {
$this->controller = $request->resource . ".php";
$controller_path = $v['controller_path'];
}
}
}
}
}
if (is_file($controller_path . $this->controller)) {
require_once $controller_path . $this->controller;
} else {
trigger_error('Sorry, the controller was not found at ' . $controller_path . $this->controller, E_USER_ERROR);
}
if (!isset($env['content_types'])) {
trigger_error('Sorry, the content_types array was not found in the configuration file', E_USER_ERROR);
}
$this->negotiator = HTTP_Negotiate::choose($env['content_types']);
}
示例3: intval
$_CFG['resume_photo_dir'] = $_CFG['site_dir'] . "data/" . $_CFG['resume_photo_dir'] . "/";
$_CFG['resume_photo_dir_thumb'] = $_CFG['site_dir'] . "data/" . $_CFG['resume_photo_dir_thumb'] . "/";
$_CFG['hunter_photo_dir'] = $_CFG['site_dir'] . "data/hunter/";
$_CFG['hunter_photo_dir_thumb'] = $_CFG['site_dir'] . "data/hunter/thumb/";
$upfiles_dir = "../data/" . $_CFG['updir_images'] . "/";
$thumb_dir = "../data/" . $_CFG['updir_thumb'] . "/";
$certificate_dir = "../data/" . $_CFG['updir_certificate'] . "/";
$certificate_train_dir = "../data/" . $_CFG['updir_train_certificate'] . "/";
$hunter_dir = "../data/hunter/";
$thumbwidth = "115";
$thumbheight = "85";
if (empty($_GET['perpage'])) {
$_GET['perpage'] = 10;
}
$perpage = intval($_GET['perpage']);
require_once ADMIN_ROOT_PATH . 'include/admin_tpl.inc.php';
date_default_timezone_set("PRC");
if (empty($_SESSION['admin_id']) && $_REQUEST['act'] != 'login' && $_REQUEST['act'] != 'do_login' && $_REQUEST['act'] != 'logout') {
if ($_COOKIE['Qishi']['admin_id'] && $_COOKIE['Qishi']['admin_name'] && $_COOKIE['Qishi']['admin_pwd']) {
if (check_cookie($_COOKIE['Qishi']['admin_name'], $_COOKIE['Qishi']['admin_pwd'])) {
update_admin_info($_COOKIE['Qishi']['admin_name'], false);
} else {
setcookie("Qishi[admin_id]", '', 1, $QS_cookiepath, $QS_cookiedomain);
setcookie("Qishi[admin_name]", '', 1, $QS_cookiepath, $QS_cookiedomain);
setcookie("Qishi[admin_pwd]", '', 1, $QS_cookiepath, $QS_cookiedomain);
exit('<script type="text/javascript">top.location="admin_login.php?act=login";</script>');
}
} else {
exit('<script type="text/javascript">top.location="admin_login.php?act=login";</script>');
}
}
示例4: Music_Directory
<?php
/**
* Developed by Jay Gaha
* http://jaygaha.com.np
*/
include 'includes/inc-public.php';
include "includes/classes/class.music_dir.php";
$directory = new Music_Directory();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$arrData = array();
$arrData['rate'] = $_POST['rate'];
$arrData['parent_id'] = $_POST['pid'];
$arrData['type'] = $_POST['rate_type'];
$insert = false;
if (!check_cookie($arrData['parent_id']) && $arrData['rate']) {
$insert = $directory->add_rating($arrData);
}
if ($insert) {
$one_day = 86400 + time();
setcookie('star_' . $arrData['parent_id'], true, $one_day);
//set cookie for one day
}
return true;
}
$data['page_title'] = 'World Music Listing: Welcome';
$data['musicListing'] = $directory->getMusicDirectoryListing();
$data['wmlMusicListing'] = $directory->getMusicPropListingByField('field');
$data['wmlBanners'] = $directory->getBanners();
$data['wmlAllWML'] = $directory->getPost();
$data['wmlWMLMusic'] = $directory->getPost('music');
示例5: load_abuse
function load_abuse($id)
{
$f = ".\\data\\" . $id . ".dsc";
if (file_exists($f)) {
echo "<div id=\"content\">\t\t\n\t\t\t<img style=\"display:block; margin: 0 auto;\" src=\"data/{$id}.jpg\" />\n\t\t\t<br />";
$tmp = fopen($f, "r");
$file = file($f);
$count = count($file) - 4;
while ($l_in_tmp = fgets($tmp)) {
$a = explode("::", $l_in_tmp);
if ($l_in_tmp[0] == '#') {
continue;
} else {
if ($a[0] == 'meta') {
$m = explode("||", $a[1]);
echo "<span style=\"font-size: 9px; color:#696969;\"><b>Data dodania: </b>{$m['1']}</span>\n\t\t\t\t<span style=\"font-size: 9px; float:right; margin-left: 20px; font-weight:bold;\"><a href=\"?abuse={$id}\" id=\"viol\">Zgłoś naruszenie</a></span><br />\n\t\t\t\t<span style=\"font-size: 9px; color:#696969;\"><b>Użytkownik: </b>{$m['0']}</span><br />";
} else {
if ($a[0] == 'cats') {
$c = explode("||", $a[1]);
echo "<span style=\"font-size: 9px; color:#696969;\"><b>Kategorie: </b></span>";
for ($i = 0; $i < count($c); $i++) {
echo "<a href=\"?cat={$c[$i]}\" id=\"cat\">{$c[$i]}</a> ";
}
} else {
if ($a[0] == 'comments') {
echo "<span style=\"font-size: 10px; float:right;\"><a href=\"?id={$id}\" id=\"cat\">Komentarze [<b>{$count}</b>]</a></span>\n\t\t\t\t\t\t<br />";
echo "<span style=\"margin-left: 20px;\"><h2>Komentarze<h2></span>";
echo "</div><hr /><br />";
} else {
$comm = explode("||", $l_in_tmp);
echo "<div id=\"cmnt\"><span style=\"color: #dfdfdf;\">{$comm['1']}</span> <b>{$comm['0']}</b> <br /><span style=\"margin-left:20px; margin-top: 10px; word-wrap:break-word;\">{$comm['2']}</span></div><br />";
}
}
}
}
}
fclose($tmp);
if (isset($_COOKIE['MyCookie']) && isset($_COOKIE['PHPSESSID']) && isset($_COOKIE['Auth']) && check_cookie($_COOKIE['MyCookie'], $_COOKIE['PHPSESSID'], $_COOKIE['Auth'])) {
echo "<div id=\"cmnt\"><b>Wyślij zgłoszenie</b><br/>\n\t\t\t\t<form method=\"post\" action=\"?abuse={$id}\">\n\t\t\t\t<textarea name=\"comment\" rows=\"4\" cols=\"88\"></textarea><br />\n\t\t\t\t<input type=\"submit\" value=\"Wyślij\"></div>";
}
} else {
echo "<br />Nieprawidłowy identyfikator obrazu";
}
}
示例6: strip_pkcs7
function strip_pkcs7($padded_str)
{
$len = strlen($padded_str);
$pad = ord($padded_str[$len - 1]);
if (substr($padded_str, $len - $pad) != str_repeat(chr($pad), $pad)) {
throw new Exception(__FUNCTION__ . '(): Bad padding.');
}
return substr($padded_str, 0, $len - $pad);
}
function aes_cbc_cookie($string, $key)
{
$string = preg_replace('/(=|;)/', "'\$1'", $string);
$string = "comment1=cooking%20MCs;userdata={$string};comment2=%20like%20a%20pound%20of%20bacon";
return encrypt_aes_cbc($key, $string, 'YELLOW SUBMARINE');
}
function check_cookie($enc, $key)
{
return strpos(decrypt_aes_cbc($key, $enc, 'YELLOW SUBMARINE'), ';admin=true;') !== false;
}
$bsize = mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);
$evil = str_repeat('A', $bsize) . '1234;dmi=rue';
// Create a sacrificial block. The appended string ends up as the size of a single block, which is to be bit-flipped.
$key = random_aes_key(16);
$enc = aes_cbc_cookie($evil, $key);
$flip = "'FIS";
// The four characters (in order) to be XOR'd with the single quotes to produce '1234;admin=true'.
$evil = "{$flip[0]}{$flip[1]}{$flip[2]}{$flip[3]}";
$evil = str_repeat("", $bsize * 2) . $evil . str_repeat("", $bsize * 4);
if (check_cookie($enc ^ $evil, $key)) {
echo 'You win! :~)', PHP_EOL;
}
示例7: mysql_select_db
$sjk = mysql_select_db("app_chwdywp1", $con);
if (!$sjk) {
echo "bu cun zai";
} else {
mysql_select_db("app_chwdywp1", $con);
mysql_query("CREATE TABLE IF NOT EXISTS nmb_save ( num int(30),board int(30),id varchar(30),time varchar(30), text varchar(1000))");
mysql_query("CREATE TABLE IF NOT EXISTS nmb_id ( id float(30), name varchar(40),status int(30),time int(30))");
mysql_query("CREATE TABLE IF NOT EXISTS nmb_set ( item varchar(50), value varchar(30))");
init_set();
if (isset($_COOKIE['id'])) {
br();
br();
br();
echo "欢迎回来 " . $_COOKIE['name'];
} else {
if (check_cookie()) {
$new_id = check_id();
$new_time = time();
$new_name = "user_{$new_id}";
$cookie_expire = $new_time + 36000;
mysql_query("INSERT INTO nmb_id VALUES({$new_id},'{$new_name}',1,{$cookie_expire})");
setcookie('id', $new_id, $new_time + 36000);
setcookie('name', $new_name, $new_time + 36000);
br();
br();
br();
echo "已获得新身份 " . $new_name;
}
}
}
}
示例8: ob_start
}
// Enable output buffering
if (!defined('FORUM_DISABLE_BUFFERING')) {
// Should we use gzip output compression?
if ($luna_config['o_gzip'] && extension_loaded('zlib')) {
ob_start('ob_gzhandler');
} else {
ob_start();
}
}
// Define standard date/time formats
$forum_time_formats = array($luna_config['o_time_format'], 'H:i:s', 'H:i', 'g:i:s a', 'g:i a');
$forum_date_formats = array($luna_config['o_date_format'], 'Y-m-d', 'Y-d-m', 'd-m-Y', 'm-d-Y', 'M j Y', 'jS M Y');
// Check/update/set cookie and fetch user info
$luna_user = array();
check_cookie($luna_user);
// Load l10n
require_once FORUM_ROOT . 'include/pomo/MO.php';
require_once FORUM_ROOT . 'include/l10n.php';
// Attempt to load the language file
if (file_exists(FORUM_ROOT . 'lang/' . $luna_user['language'] . '/luna.mo')) {
load_textdomain('luna', FORUM_ROOT . 'lang/' . $luna_user['language'] . '/luna.mo');
} elseif (file_exists(FORUM_ROOT . 'lang/English/luna.mo')) {
load_textdomain('luna', FORUM_ROOT . 'lang/English/luna.mo');
} else {
error('There is no valid language pack \'' . luna_htmlspecialchars($luna_user['language']) . '\' installed. Please reinstall a language of that name');
}
// Check if we are to display a maintenance message
if ($luna_config['o_maintenance'] && $luna_user['g_id'] > FORUM_ADMIN && !defined('FORUM_TURN_OFF_MAINT')) {
maintenance_message();
}
示例9: last_id
$id = last_id() + 1;
if (fwrite($plik, $id . "||" . $login . "||" . md5("S417" . $id . "" . substr($login, 0, 3) . "" . $pass) . "||\n")) {
echo "Rejestracja zakończona pomyślnie!<br />";
} else {
echo "Błąd rejestracji!<br />";
}
fclose($plik);
$ref = $_SERVER['HTTP_REFERER'];
header("Location: " . $ref);
} else {
$ref = $_SERVER['HTTP_REFERER'];
header("Location: " . $ref);
echo "Nieprawidłowy login lub hasło!<br />";
}
} else {
if (isset($_POST['login']) && isset($_POST['password']) && isset($_COOKIE['MyCookie']) && isset($_COOKIE['PHPSESSID']) && isset($_COOKIE['Auth']) && check_cookie($_COOKIE['MyCookie'], $_COOKIE['PHPSESSID'], $_COOKIE['Auth'])) {
echo "Jesteś juz zarejestrowany!";
} else {
echo "<form method=\"post\" action=\"index.php\">\n\t\t\t\tLogin: <input style=\"margin-left: 12px; width: 120px;\" type=\"text\" name=\"login\"/><br />\n\t\t\t\tHasło: <input style=\"margin-left: 11px;width: 120px;\" type=\"password\" name=\"password\"/><br/>\n\t\t\t\t<input type=\"submit\" name=\"reg\" value=\"Rejestruj\">\n\t\t\t\t</form>";
}
}
?>
</div>
</div>
<div id="show" onClick="document.getElementById('log_show').style.display='none';document.getElementById('reg_show').style.display='none'">
<?php
if (isset($_GET['cat'])) {
$cat = $_GET['cat'];
include "gal.php";
} else {
if (isset($_COOKIE['MyCookie']) && isset($_COOKIE['PHPSESSID']) && isset($_COOKIE['Auth']) && isset($_GET['id']) && isset($_POST['comment'])) {
示例10: check_cookie
?>
';
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
id = <?php
echo $data['id'];
?>
;
$.fn.raty.defaults.path = 'public/images';
$.fn.raty.defaults.readOnly = "<?php
echo check_cookie($data['id']);
?>
";
$('#star').raty({score:"<?php
echo $data['rate'];
?>
",
click: function(score, evt) {
$.post('single_profile.php',{'rate':score,'pid':id, 'rate_type' : '<?php
echo $data["rate_type"];
?>
'},function(data)
{
$('#star').raty({score:score, readOnly:true});
}
)
示例11: security_init
function security_init()
{
global $request;
// add Routes -- route name, pattern to match, and default request parameters
$request->connect('openid_continue/:fromserver', array('action' => 'openid_continue'));
$request->connect('openid_continue');
$request->connect('openid_login_return');
$request->connect('openid_submit');
$request->connect('password_submit');
$request->connect('password_register');
$request->connect('openid_logout');
$request->connect('openid_login');
$request->connect('openid_login/:openid', array('action' => 'openid_login'));
$request->connect('email_login');
$request->connect('register');
$request->connect('email_submit');
$request->connect('ldap_login');
$request->connect('ldap_submit');
$request->connect('oauth_login');
$request->connect('facebook_login');
$request->routematch();
if (isset($_SESSION['fb_person_id']) && $_SESSION['fb_person_id'] > 0) {
$request->openid_complete = true;
return $_SESSION['fb_person_id'];
} elseif (isset($_SESSION['oauth_person_id']) && $_SESSION['oauth_person_id'] > 0) {
$request->openid_complete = true;
return $_SESSION['oauth_person_id'];
} elseif (isset($_SESSION['openid_complete']) && check_cookie()) {
if (!isset($request->openid_url) && $_SESSION['openid_complete'] == true) {
$request->openid_complete = true;
}
}
}
示例12: _
<?php
require __DIR__ . '/inc/init.php';
require __DIR__ . '/func/cookie.php';
if (isset($_SESSION['user']) || check_cookie()) {
header("Location: /");
exit;
}
$Title = _('Sign up ') . $oj_name;
?>
<!DOCTYPE html>
<html>
<?php
require __DIR__ . '/inc/head.php';
?>
<body style="background-image: url(<?php
echo $loginimg;
?>
)">
<div class="container">
<div class="row collapse">
<div class="panel panel-default panel-login" style="display:table;margin:auto">
<div class="panel-body">
<form id="form_reg" method="post">
<h1 class="text-center">
<?php
echo _('Sign up');
?>
</h1>
<hr>
示例13: session_start
<?php
static $check_login = 1;
if (!isset($_SESSION)) {
session_start();
}
if (!isset($_SESSION['user'])) {
if (!function_exists('check_cookie')) {
require __DIR__ . '/cookie.php';
}
if (!check_cookie()) {
if ($require_auth) {
header("location: /login.php");
exit;
}
} else {
if (!function_exists('login')) {
require __DIR__ . '/userlogin.php';
}
if (TRUE === login($_SESSION['user'], TRUE)) {
write_cookie(1);
}
}
}
示例14: ob_start
}
// Enable output buffering
if (!defined('PANTHER_DISABLE_BUFFERING')) {
// Should we use gzip output compression?
if ($panther_config['o_gzip'] && extension_loaded('zlib')) {
ob_start('ob_gzhandler');
} else {
ob_start();
}
}
// Define standard date/time formats
$forum_time_formats = array($panther_config['o_time_format'], 'H:i:s', 'H:i', 'g:i:s a', 'g:i a');
$forum_date_formats = array($panther_config['o_date_format'], 'd-m-Y', 'Y-m-d', 'Y-d-m', 'm-d-Y', 'M j Y', 'jS M Y');
// Check/update/set cookie and fetch user info
$panther_user = array();
check_cookie($panther_user);
$loader = new Twig_Loader_Filesystem(PANTHER_ROOT . 'include/templates');
$style_root = ($panther_config['o_style_path'] != 'style' ? $panther_config['o_style_path'] : PANTHER_ROOT . $panther_config['o_style_path']) . '/' . $panther_user['style'] . '/templates/';
$loader->addPath(PANTHER_ROOT . 'include/templates/', 'core');
if (file_exists($style_root)) {
// If the custom style doesn't use templates, then this is silly
$loader->addPath($style_root, 'style');
}
$tpl_manager = new Twig_Environment($loader, array('cache' => FORUM_CACHE_DIR . 'templates/' . $panther_user['style'], 'debug' => $panther_config['o_debug_mode'] == '1' ? true : false));
// Attempt to load the common language file
if (file_exists(PANTHER_ROOT . 'lang/' . $panther_user['language'] . '/common.php')) {
include PANTHER_ROOT . 'lang/' . $panther_user['language'] . '/common.php';
} else {
error_handler(E_ERROR, 'There is no valid language pack \'' . $panther_user['language'] . '\' installed.', __FILE__, __LINE__);
}
// Load the updater
示例15: generate_config_cache
// Load DB abstraction layer and connect
require PUN_ROOT . 'include/common_db.php';
// Load cached config
@(include PUN_ROOT . 'cache/cache_config.php');
if (!defined('PUN_CONFIG_LOADED')) {
include PUN_ROOT . 'include/cache.php';
generate_config_cache();
include PUN_ROOT . 'cache/cache_config.php';
}
// Enable output buffering
if (!defined('PUN_DISABLE_BUFFERING')) {
@ob_start();
}
// Check/update/set cookie and fetch user info
$pun_user = array();
check_cookie($pun_user);
// Attempt to load the common language file
@(include PUN_ROOT . 'lang/' . $pun_user['language'] . '/common.php');
if (!isset($lang_common)) {
exit('There is no valid language pack "' . pun_htmlspecialchars($pun_user['language']) . '" installed. Please reinstall a language of that name.');
}
@iconv_set_encoding('internal_encoding', 'UTF-8');
@mb_internal_encoding('UTF-8');
// Check if we are to display a maintenance message
if ($pun_config['o_maintenance'] && $pun_user['g_id'] > PUN_ADMIN && !defined('PUN_TURN_OFF_MAINT')) {
maintenance_message();
}
// Load cached bans
@(include PUN_ROOT . 'cache/cache_bans.php');
if (!defined('PUN_BANS_LOADED')) {
include_once PUN_ROOT . 'include/cache.php';