Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1179311
  • 博文数量: 252
  • 博客积分: 5421
  • 博客等级: 大校
  • 技术积分: 2418
  • 用 户 组: 普通用户
  • 注册时间: 2007-06-17 12:59
文章分类

全部博文(252)

文章存档

2017年(3)

2016年(18)

2015年(31)

2014年(18)

2013年(7)

2012年(8)

2011年(12)

2010年(30)

2009年(32)

2008年(57)

2007年(36)

分类:

2007-12-19 10:59:18

一、magic_quotes_gpc = Off
有这样的一个html页面
<form action='1.php' method='get'>
    
<input type='text' name=asd/f'gh/a.b.c/>
    
<input type='submit' value='submit'>
form>
其中text控件命名为:asd/f'gh/a.b.c/ ,将此页面提交到1.php进行处理,method用get还是post方法无所谓。
1.php
php
print_r($_GET);
echo '
';
print $_GET['asd/f\'gh/a_b_c/']
?> 
输入ssssssss点击提交,显示:
--------------------------------------------------------
Array ( [asd/f'gh/a_b_c/] => ssssssss )
ssssssss
--------------------------------------------------------
总结:input控件命名中的点号变为下划线。
另注:asp中input控件命名中的点号不变,取变量可用:Request.QueryString("asd/f'gh/a.b.c/")
二、magic_quotes_gpc = On
1.php改为
php
print_r($_GET);
echo '
';
print $_GET['asd/f\\\'gh/a_b_c/']
?> 
提交后显示:
----------------------------------------------------------
Array ( [asd/f\'gh/a_b_c/] => ssssssss )
ssssssss
----------------------------------------------------------
总结:input控件命名中的点号变为下划线;并且单引号被自动加上一个反斜线进行转义,所以名字中增加了反斜线,在php中取传递来的值时要对GET变量名中的反斜线进行转义。
阅读(2046) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~