本文整理汇总了PHP中defaults函数的典型用法代码示例。如果您正苦于以下问题:PHP defaults函数的具体用法?PHP defaults怎么用?PHP defaults使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了defaults函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: defaults
// If set to 0:
// There will be no further authentication. You
// will have to handle this by yourself!
// If set to 1:
// You need to change ADMIN_PASSWORD to make
// this work!
defaults('ADMIN_USERNAME', 'flock');
// Admin Username
defaults('ADMIN_PASSWORD', 'flock6454');
// Admin Password - CHANGE THIS TO ENABLE!!!
// (beckerr) I'm using a clear text password here, because I've no good idea how to let
// users generate a md5 or crypt password in a easy way to fill it in above
//defaults('DATE_FORMAT', "d.m.Y H:i:s"); // German
defaults('DATE_FORMAT', 'Y/m/d H:i:s');
// US
defaults('GRAPH_SIZE', 200);
// Image size
//defaults('PROXY', 'tcp://127.0.0.1:8080');
////////// END OF DEFAULT CONFIG AREA /////////////////////////////////////////////////////////////
// "define if not defined"
function defaults($d, $v)
{
if (!defined($d)) {
define($d, $v);
}
// or just @define(...)
}
// rewrite $PHP_SELF to block XSS attacks
//
$PHP_SELF = isset($_SERVER['PHP_SELF']) ? htmlentities(strip_tags($_SERVER['PHP_SELF'], ''), ENT_QUOTES, 'UTF-8') : '';
$time = time();
示例2: preg_replace
<?php
/**
* Copyright (c) 2012 Onxshop Ltd (https://onxshop.com)
* Licensed under the New BSD License. See the file LICENSE.txt for details.
*
*/
/**
* detect onxshop project directory
*/
$onxshop_project_dir = preg_replace('/public_html\\/opt\\/apc/', '', dirname($_SERVER['SCRIPT_FILENAME']));
/**
* include Onxshop project configuration
*/
require_once $onxshop_project_dir . 'conf/global.php';
/**
* security check: allow to use only by debug IP
*/
if (!constant('ONXSHOP_IS_DEBUG_HOST')) {
echo "Sorry, you are not allowed to use this script. Add your IP address to debug host in conf/deployment.php";
exit;
}
/**
* set APC manager username and password same as Onxshop database user
*/
defaults('ADMIN_USERNAME', ONXSHOP_DB_USER);
defaults('ADMIN_PASSWORD', ONXSHOP_DB_PASSWORD);
示例3: defaults
<?php
defaults("USE_AUTHENTICATION", 0);
if (getenv("ENABLE_SYSTEM_ACCESS") != "true") {
header("HTTP/1.0 403 Forbidden");
exit;
}
if (getenv("SYSTEM_USERNAME") == "" || getenv("SYSTEM_PASSWORD") == "") {
header("HTTP/1.0 403 Forbidden");
exit;
}
if ($_SERVER["PHP_AUTH_USER"] == getenv("SYSTEM_USERNAME") && $_SERVER["PHP_AUTH_PW"] == getenv("SYSTEM_PASSWORD")) {
# Show page
} else {
header("WWW-Authenticate: Basic realm='System access'");
header("HTTP/1.0 401 Unauthorized");
print "Access denied!\n";
}
示例4: defaults
if('127.0.0.1'==$_SERVER['REMOTE_ADDR']) {
defaults('USE_AUTHENTICATION',0);
} else {
defaults('USE_AUTHENTICATION',1);
}
defaults('ADMIN_USERNAME','admin'); // Admin Username
defaults('ADMIN_PASSWORD','admin'); // Admin Password - CHANGE THIS TO ENABLE!!!
// (beckerr) I'm using a clear text password here, because I've no good idea how to let
// users generate a md5 or crypt password in a easy way to fill it in above
//defaults('DATE_FORMAT', "d.m.Y H:i:s"); // German
defaults('DATE_FORMAT', 'Y/m/d H:i:s'); // US
defaults('GRAPH_SIZE',200); // Image size
////////// END OF DEFAULT CONFIG AREA /////////////////////////////////////////////////////////////
// "define if not defined"
function defaults($d,$v) {
if (!defined($d)) define($d,$v); // or just @define(...)
}
// rewrite $PHP_SELF to block XSS attacks
//
$PHP_SELF= isset($_SERVER['PHP_SELF']) ? htmlentities(strip_tags($_SERVER['PHP_SELF'],''), ENT_QUOTES) : '';
$time = time();
$host = getenv('HOSTNAME');
if($host) { $host = '('.$host.')'; }
示例5: defaults
// If set to 0:
// There will be no further authentication. You
// will have to handle this by yourself!
// If set to 1:
// You need to change ADMIN_PASSWORD to make
// this work!
defaults('ADMIN_USERNAME', '');
// Admin Username
defaults('ADMIN_PASSWORD', '');
// Admin Password - CHANGE THIS TO ENABLE!!!
// (beckerr) I'm using a clear text password here, because I've no good idea how to let
// users generate a md5 or crypt password in a easy way to fill it in above
//defaults('DATE_FORMAT', "d.m.Y H:i:s"); // German
defaults('DATE_FORMAT', ' m/d/Y h:i:s A');
// US
defaults('GRAPH_SIZE', 150);
// Image size
//defaults('PROXY', 'tcp://127.0.0.1:8080');
////////// END OF DEFAULT CONFIG AREA /////////////////////////////////////////////////////////////
// "define if not defined"
function defaults($d, $v)
{
if (!defined($d)) {
define($d, $v);
}
// or just @define(...)
}
// rewrite $PHP_SELF to block XSS attacks
//
$PHP_SELF = isset($_SERVER['PHP_SELF']) ? htmlentities(strip_tags($_SERVER['PHP_SELF'], ''), ENT_QUOTES, 'UTF-8') : '';
$time = time();
示例6: defaults
<?php
function defaults($str = 'hello', $n = 1)
{
print $str . "\n";
print $n . "\n";
}
defaults();
defaults('hello world', 111);
示例7: defaults
<?php
defaults('ADMIN_USERNAME', 'playcrab');
// Admin Username
defaults('ADMIN_PASSWORD', 'airmud');
// Admin Password - CHANGE THIS TO ENABLE!!!
function defaults($d, $v)
{
if (!defined($d)) {
define($d, $v);
}
// or just @define(...)
}
if (ADMIN_PASSWORD != 'password') {
if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) || $_SERVER['PHP_AUTH_USER'] != ADMIN_USERNAME || $_SERVER['PHP_AUTH_PW'] != ADMIN_PASSWORD) {
Header("WWW-Authenticate: Basic realm=\"Login\"");
Header("HTTP/1.0 401 Unauthorized");
echo <<<EOB
\t\t\t<html><body>
\t\t\t<h1>Rejected!</h1>
\t\t\t<big>Wrong Username or Password!</big><br/> <br/>
\t\t<big><a href='{$PHP_SELF}?OB={$MYREQUEST['OB']}'>Continue...</a></big>
\t\t\t</body></html>
EOB;
exit;
} else {
$AUTHENTICATED = 1;
}
}
示例8: dirname
<?php
include_once dirname(__FILE__) . "/frame.class.inc";
include_once dirname(__FILE__) . "/class.unix.inc";
if (isset($_GET["restart"])) {
restart();
exit;
}
if (isset($_GET["status"])) {
status();
exit;
}
if (isset($_GET["defaults"])) {
defaults();
exit;
}
while (list($num, $line) = each($_GET)) {
$f[] = "{$num}={$line}";
}
writelogs_framework("unable to understand query !!!!!!!!!!!..." . @implode(",", $f), "main()", __FILE__, __LINE__);
die;
function restart()
{
$unix = new unix();
$php5 = $unix->LOCATE_PHP5_BIN();
$nohup = $unix->find_program("nohup");
$cmd = trim("{$nohup} /etc/init.d/milter-regex restart >/dev/null 2>&1 &");
writelogs_framework($cmd, __FUNCTION__, __FILE__, __LINE__);
shell_exec($cmd);
}
function status()
示例9: indexAction
public function indexAction()
{
global $MY_SELF, $MYREQUEST, $AUTHENTICATED, $col_black, $time, $MY_SELF_WO_SORT;
/*
+----------------------------------------------------------------------+
| APC |
+----------------------------------------------------------------------+
| Copyright (c) 2008 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Ralf Becker <beckerr@php.net> |
| Rasmus Lerdorf <rasmus@php.net> |
| Ilia Alshanetsky <ilia@prohost.org> |
+----------------------------------------------------------------------+
All other licensing and usage conditions are those of the PHP Group.
*/
$VERSION = '$Id: apc.php,v 3.68.2.2 2008/05/11 18:57:00 rasmus Exp $';
////////// READ OPTIONAL CONFIGURATION FILE ////////////
if (file_exists("apc.conf.php")) {
include "apc.conf.php";
}
////////////////////////////////////////////////////////
////////// BEGIN OF DEFAULT CONFIG AREA ///////////////////////////////////////////////////////////
defaults('USE_AUTHENTICATION', 0);
// Use (internal) authentication - best choice if
// no other authentication is available
// If set to 0:
// There will be no further authentication. You
// will have to handle this by yourself!
// If set to 1:
// You need to change ADMIN_PASSWORD to make
// this work!
defaults('ADMIN_USERNAME', 'apc');
// Admin Username
defaults('ADMIN_PASSWORD', 'password');
// Admin Password - CHANGE THIS TO ENABLE!!!
// (beckerr) I'm using a clear text password here, because I've no good idea how to let
// users generate a md5 or crypt password in a easy way to fill it in above
//defaults('DATE_FORMAT', "d.m.Y H:i:s"); // German
defaults('DATE_FORMAT', 'Y/m/d H:i:s');
// US
defaults('GRAPH_SIZE', 200);
// Image size
////////// END OF DEFAULT CONFIG AREA /////////////////////////////////////////////////////////////
// rewrite $PHP_SELF to block XSS attacks
//
$PHP_SELF = '/kwf/debug/apc';
$time = time();
$host = getenv('HOSTNAME');
if ($host) {
$host = '(' . $host . ')';
}
// operation constants
define('OB_HOST_STATS', 1);
define('OB_SYS_CACHE', 2);
define('OB_USER_CACHE', 3);
define('OB_SYS_CACHE_DIR', 4);
define('OB_VERSION_CHECK', 9);
// check validity of input variables
$vardom = array('OB' => '/^\\d+$/', 'CC' => '/^[01]$/', 'DU' => '/^.*$/', 'SH' => '/^[a-z0-9]+$/', 'IMG' => '/^[123]$/', 'LO' => '/^1$/', 'COUNT' => '/^\\d+$/', 'SCOPE' => '/^[AD]$/', 'SORT1' => '/^[AHSMCDTZ]$/', 'SORT2' => '/^[DA]$/', 'AGGR' => '/^\\d+$/', 'SEARCH' => '~^[a-zA-Z0-1/_.-]*$~');
// default cache mode
$cache_mode = 'opcode';
// cache scope
$scope_list = array('A' => 'cache_list', 'D' => 'deleted_list');
// handle POST and GET requests
if (empty($_REQUEST)) {
if (!empty($_GET) && !empty($_POST)) {
$_REQUEST = array_merge($_GET, $_POST);
} else {
if (!empty($_GET)) {
$_REQUEST = $_GET;
} else {
if (!empty($_POST)) {
$_REQUEST = $_POST;
} else {
$_REQUEST = array();
}
}
}
}
// check parameter syntax
foreach ($vardom as $var => $dom) {
if (!isset($_REQUEST[$var])) {
$MYREQUEST[$var] = NULL;
} else {
if (!is_array($_REQUEST[$var]) && preg_match($dom . 'D', $_REQUEST[$var])) {
$MYREQUEST[$var] = $_REQUEST[$var];
} else {
$MYREQUEST[$var] = $_REQUEST[$var] = NULL;
}
}
}
// check parameter sematics
//.........这里部分代码省略.........
示例10: defaults
<?php
defaults('ADMIN_USERNAME', 'apc');
// Admin Username
defaults('ADMIN_PASSWORD', 'apc');