不要再用PHP的代码简写方式<?=$var?>

Posted in PHP on January 25th, 2007 by Adam

以前看过WP的代码规范,其中对No Shorthand PHP的提示不是很重视,因为偷懒很多代码都用的是简写。最近终于尝到了苦头。PHP5下会出现如下错误:

syntax error, unexpected $end in

面对PHP Version 5.1.6,很多代码原本原样的echo出来。看来有些懒还是不能偷的。作为一名php coder,有必要看看PEAR上的代码规范文档,上面有很多举例。

不过我觉得懒还是有的偷的,可以利用模板原理,自动生成标准规范的PHP代码,不用自己编写的PHP code,只需要编辑模板,这样就不用不厌其烦的敲入 < ? PHP 啦。熟悉discuz的朋友应该知道,他的模板就是类似的应用。例如:

模板写法:{if(条件) echo 结果}

自动转换后: < ? php if(条件) echo 结果; ?>

Tags: ,

Lonely Planet旅行指南 – 全球旅行者的首选

Posted in 自助游 on January 17th, 2007 by Adam

lp.jpg
Lonely Planet 旅行指南系列 92折封顶!

“Lonely Planet旅行指南系列”,来自世界上最成功的独立旅行信息提供商Lonely Planet出版公司。30多年来,他们一直为旅行者提供独立、翔实、可信的旅行建议。他们出版的旅行指南因其无可比拟的权威性和独一无二的态度而成为各国旅行者的首选。

为什么叫Lonely Planet?

这个名字来自一首歌曲“Space Captain”, 歌中的原词本来是“Lovely Planet”,但托尼·惠勒听成了“Lonely Planet”。他喜欢这个美丽的错误,并坚持用了这个后来成为传奇的名字。

数字Lonely Planet

3:墨尔本,伦敦,旧金山三个办事处10:10 种语言出版旅行指南
20:20 个产品系列
32:创立32 年
300:每周在全球各大媒体出现300 次
350:来自20 个国家的350 名旅行者在全球各地为我们创作
400:全球400余名员工
600:600多个目的地(包括南极)的旅行指南,遍及世界

媒体评语:
“世界旅行图书的领导者”。
——《时代周刊》
“对旅行者来说是个可以信任的伙伴”
——《纽约时报》
“对于充满好奇心和独立思想的旅行者而言,Lonely Planet是最佳选择。”
——《华尔街日报》
“牙刷,护照,防晒霜,Lonely Planet……”
——路透社

PHP post error: Forbidden – You don't have permission to access

Posted in PHP on January 8th, 2007 by Adam

When we post a form with PHP, some errors maybe return, such as: 500 SERVER Error, or:

Forbidden
You don’t have permission to access /post.php on this server.Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Here are some explains may help:

We had installed a software to block attack against the web-server which caused the trouble for you.We have tweaked that to allow the URL format.

A similar reason same as the above explain, they will redirect your post, when your post includes some “security” words, such as: “inc”,”curl”.

Further more optional reasons:

In the control panel of hosting, the PHP scripts doesn’t need special permissions, but mod_php is configured in safe mode, so if I need PHP-CGI scripts or applications that install something, You need permissions (770). Besides, need to create a .htaccess file with the command: Options ExecCGI.

mod_security:
ModSecurityTM is an open source intrusion detection and prevention engine for web applications (or a web application firewall). Operating as an Apache Web server module or standalone, the purpose of ModSecurity is to increase web application security, protecting web applications from known and unknown attacks.

While mod_security can be a very powerful tool, misconfigured or overly strict rule sets can interfere with vBulletins Operation. Below for Apache users you can use an htaccess file and add a specific rule to disable mod_security.

Make or edit your forum .htaccess file and add the following code
Code:

< IfModule mod_security.c >
SecFilterEngine Off
SecFilterScanPOST Off
< /IfModule>

or

< IfModule mod_security.c>
SecFilterInheritance Off
< /IfModule>

place this file in your problem directory.
—————————————-

Tags:
RSS Feed