9月
18
原文参见:
http://download.eclipse.org/tools/pdt/downloads/
update地址: http://download.eclipse.org/tools/pdt/updates/
依赖:
wst
SHIT!我使用update安装不了,系统告诉我:
Unable to complete action for feature "PDT Feature" due to errors.
The File "/tmp/1611919292/eclipse/.update/1190120959966/1190120959970/eclipse20065.tmp" is not a valid JAR file. [error in opening zip file]
error in opening zip file
The File "/tmp/1611919292/eclipse/.update/1190120959966/1190120959970/eclipse20065.tmp" is not a valid JAR file. [error in opening zip file]
error in opening zip file
昏死!无条件放弃,还是坚持 phpeclipse!
作者 rollenc
8月
31
Security Enhancements and Fixes in PHP 5.2.4:
* Fixed a floating point exception inside wordwrap() (Reported by Mattias Bengtsson)
* Fixed several integer overflows inside the GD extension (Reported by Mattias Bengtsson)
* Fixed size calculation in chunk_split() (Reported by Gerhard Wagner)
* Fixed integer overflow in str[c]spn(). (Reported by Stanislav Malyshev)
* Fixed money_format() not to accept multiple %i or %n tokens. (Reported by Stanislav Malyshev)
* Fixed zend_alter_ini_entry() memory_limit interruption vulnerability. (Reported by Stefan Esser)
* Fixed INFILE LOCAL option handling with MySQL extensions not to be allowed when open_basedir or safe_mode is active. (Reported by Stanislav Malyshev)
* Fixed session.save_path and error_log values to be checked against open_basedir and safe_mode (CVE-2007-3378) (Reported by Maksymilian Arciemowicz)
* Fixed a possible invalid read in glob() win32 implementation (CVE-2007-3806) (Reported by shinnai)
* Fixed a possible buffer overflow in php_openssl_make_REQ (Reported by zatanzlatan at hotbrev dot com)
* Fixed an open_basedir bypass inside glob() function (Reported by dr at peytz dot dk)
* Fixed a possible open_basedir bypass inside session extension when the session file is a symlink (Reported by c dot i dot morris at durham dot ac dot uk)
* Improved fix for MOPB-03-2007.
* Corrected fix for CVE-2007-2872.
Defined tags for this entry:
PHP
作者 rollenc
8月
17
如果机器支持apache配置文件.htaccess(一般虚拟机都是支持的),但是并不容许你修改php.ini文件时,你可以使用以下代码来修改一些变量:
只适用于php做为apache的module的情况
<IfModule mod_php5.c>
php_value include_path ".:/usr/local/lib/php;"
</IfModule>
<IfModule mod_php4.c>
php_value include_path ".:/usr/local/lib/php"
</IfModule>
但是,不要使用
<IfModule mod_php5.c>
php_value error_reporting E_ALL
</IfModule>
这样的内容,因为E_ALL是php.ini中定义的常量,在apache中是无效的,任何没有定义的常量都被会解释为0或者空值。
因此以上内容将被解释为不报告任何错误,而不是所有错误。
如果php是做为cgi加载的,那么你可以通过ini_set来实现
$include_path =
ini_get('include_path');
ini_set('include_path',
$include_path.
':/home/rollenc/myphplib');
//注意Linux目录分割符是 : 和windows使用的 ; 不同
作者 rollenc
7月
18
Drupal通过C风格的字符串输出格式实现了对sql语句的安全过滤。
使用方法:
db_query
("SELECT n.nid FROM {node} n WHERE n.type = '%s'",
$type);
//正确做法//这不等于以下语句,使用sprintf并不能避免mysql注入。db_query
(sprintf("SELECT n.nid FROM {node} n WHERE n.type = '%s'",
$type));
//不正确
drupal db_query核心代码如下:
/**
* Indicates the place holders that should be replaced in _db_query_callback().
*/define('DB_QUERY_REGEXP',
'/(%d|%s|%%|%f|%b)/');
/**
* Runs a basic query in the active database.
*
* User-supplied arguments to the query should be passed in as separate
* parameters so that they can be properly escaped to avoid SQL injection
* attacks.
*
* @param $query
* A string containing an SQL query.
* @param ...
* A variable number of arguments which are substituted into the query
* using printf() syntax. Instead of a variable number of query arguments,
* you may also pass a single array containing the query arguments.
* Valid %-modifiers are: %s, %d, %f, %b (binary data, do not enclose
* in '') and %%.
*
* NOTE: using this syntax will cast NULL and FALSE values to decimal 0,
* and TRUE values to decimal 1.
*
* @return
* A database query result resource, or FALSE if the query was not
* executed correctly.
*/function db_query
($query) { $args =
func_get_args();
array_shift($args);
$query = db_prefix_tables
($query);
if (isset($args[0]) and
is_array($args[0])) { // 'All arguments in one array' syntax $args =
$args[0];
} _db_query_callback
($args,
TRUE);
$query =
preg_replace_callback(DB_QUERY_REGEXP,
'_db_query_callback',
$query);
return _db_query
($query);
}/**
* Helper function for db_query().
*/function _db_query_callback
($match,
$init =
FALSE) { static $args =
NULL;
if ($init) { $args =
$match;
return;
} switch ($match[1]) { case '%d':
// We must use type casting to int to convert FALSE/NULL/(TRUE?) return (int
) array_shift($args);
// We don't need db_escape_string as numbers are db-safe case '%s':
return db_escape_string
(array_shift($args));
case '%%':
return '%';
case '%f':
return (float
) array_shift($args);
case '%b':
// binary data return db_encode_blob
(array_shift($args));
}}
参考:
http://drupal.org/node/101496
作者 rollenc
5月
23
“
{@*}” 用于在docblock中表示注释结束符号
*/
“
-, +, #, o” 用来简写
<li>, &ul;ul>, 等列表项,但是不支持多层结构,你只能用它们来表示单层列表
“
#@+and
#@-” #@+是模板开始符,在此申明之后的所有申明,都会自动继承此申明的标记。直到出现模板结束符
#@-
作者 rollenc
4月
20
两域名分别为:
phpapp.cn
phpapplication.cn
这是为php系列的第三个重要域名了。
整个一条php社区线形成了:
function(phpfunction.cn) -> library(phplibrary.cn) -> application(phpapplication.cn)
目前我会重点做一下library。网址:
http://www.phplibrary.cn
如
三马说的,等解决了吃饭的问题,我们要好好做些事情出来!
Defined tags for this entry:
php
作者 rollenc
4月
17
phplibrary上线好几天了,一直没有什么动静。
发布一下,我最近会每天会更新一个library上线,也来希望大家能够多多参与。
Defined tags for this entry:
php
作者 rollenc
4月
13
经过一周的纯正PHP5环境下的工作,我确定了自己现在的事情:
把现有的环境当成试验场。
前一阵学习了不少的重构,设计模式等只是,但是,以前的开发一直要考虑PHP4的兼容性,故而在编码上看起来不伦不类的。受到语言限制,也有诸多的模式实现起来非常困难或者诡异。现在我可以大胆的进行完整的OOP。
把所有沉睡的知识召唤醒来吧!
UML,OOP,PHP5,Design patterns,Refactoring...
作者 rollenc
3月
21
当magic_quotes_gpc设置为1时,GPCF的数据将被addslashes。
这里是使用程序还原原始数据的代码,相当于把magic_quotes_gpc设置为0。
if (get_magic_quotes_gpc()) { // check magic_quotes_gpc state function strip_quotes
(&
$var) { if (is_array($var) array_walk($var,
'strip_quotes');
else $var =
stripslashes($var);
}// Handle GPCforeach (array('GET',
'POST',
'COOKIE') as $v) if (!
empty($
{"_".
$v})) array_walk($
{"_".
$v},
'strip_quotes');
// Original file names may contain escaped data as wellif (!
empty($_FILES)) foreach ($_FILES as $k =>
$v) { $_FILES[$k]['name'] =
stripslashes($v['name']);
}
或者更快的解决方法: