文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>来自Claroline论谈的安全建议,也适用于其它PHP程序

来自Claroline论谈的安全建议,也适用于其它PHP程序

时间:2009-02-05  来源:lsstarboy

Here are some conventions to follow when developping a Claroline module :

1. do not use php short tags '<?', always use '<?php'

2. never use external data coming from the user directly : all input data MUST filtered and validated BEFORE using them

3. as a consequence : never use the super globals variables $_REQUEST, $_GET, $_POST or $_COOKIE directly in SQL or HTML code :
3.1. always escape SQL variables using casting for numbers or claro_sql_escape() for strings, the use of addslashes is DEPRECATED since in it does not take mysql escaped chars into account, not respecting this rule leads to potential execution of arbitrary SQL queries !
3.2. always protect external data in display by using htmlspecialchars() or striptags() functions or a similar mechanism, not respecting this rule leads to potential data stealing from the user web navigator (cookies, session identifier, identity theft...)

4. avoid the use of the global namespace through either the global key worg or the $GLOBALS super variable, not repsecting this rule can lead to strange side-effect bugs

5. use the Claroline API provided by the kernel libraries like sql.lib.php, init.lib.php, path.lib.php, module.lib.php, icon.lib.php, file.lib.php, fileManage.lib.php... they have been written to answer common tasks and issues in the Claroline platform and to ensure common behaviour in all the scripts

6. avoid mixing php and html code (except in the Claroline 1.9 template system) to enhance code readability and maintenance

7. as a consequence always separate business logic from display

A more complete developer's documentation will follow as soon as possible.

Thanks for helping to make Claroline a better LMS.

Regards,
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载