# 求大牛分析下php上传突破方法！！

**URL:** <https://forum.90sec.com/t/topic/3358>\
**Category:** 交流讨论\
**Created:** [2012 年3 月 20 日 08:04 UTC](https://forum.90sec.com/t/topic/3358 "2012-03-20T08:04:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

作者： ![929041889](https://forum.90sec.com/letter_avatar_proxy/v4/letter/9/b4bc9f/32.png) [@929041889](https://forum.90sec.com/u/929041889)\
发布日期： [2012 年3 月 20 日 08:04 UTC](https://forum.90sec.com/t/topic/3358/1 "2012-03-20T08:04:38Z")

</div>

_本帖最后由 Green\_leaves 于 2012-6-15 16:35 编辑_

这个系统是linux系统，如何进行上传突破呢！！求大牛分析下，感谢了！！  
由于是linux用分号没得办法！！

```php

<?php
require("../lib/pub_config.php");
require("../lib/config.php");
$pathbase="/data/wwwroot/".$cfg["music_pass"]."/";
if($_GET["action"]=="save")
{
	if($_FILES['userfile']['error']!=0){
		echo "<script>alert('".$_FILES['userfile']['error']."上传文件失败,可能的原因:\\n\\n1,上传的文件的大小超过了15MB;\\n2,没有找到要上传的文件;\\n3,文件只有部分被上传;\\n\\n请重试!');top.close()</script>";
		exit;
	}
	$FileSize	=$_FILES['userfile']['size'];
	if($FileSize>15000000) //判断文件大小
	{
		echo "<script>alert('上传的文件超过15MB,请重新上传！');top.close();</script>";
		@unlink($_FILES['userfile']['name']);	//删除临时文件
		exit;
	}
	$fn	=split("\.",$_FILES['userfile']['name']);
	$fileExtName	=strtolower(".".$fn[count($fn)-1]);
	if($fileExtName!=".wma" && $fileExtName!=".mp3")	//判断扩展名是否正确
	{
		echo "<script>alert('".$fileExtName."上传的文件格式有错误，必须是wma或mp3格式!');window.close();</script>";
		@unlink($_FILES['userfile']['name']);	//删除临时文件
		exit;
	}
	$path =date("Ymd");
	if(!file_exists($pathbase.$path)){
		mkdir($pathbase.$path,0777);
		chown($pathbase.$path,"nobody");
	}
	$fn =md5(time()).$fileExtName;
	$_srcfile	=$pathbase.$path."/".$fn;
	$_url ="/".$path."/".$fn;
	move_uploaded_file($_FILES['userfile']['tmp_name'],$_srcfile);
	chmod($_srcfile,0777);
	echo "<script>alert('".$_FILES['userfile']['tmp_name'].">".$_srcfile."上传成功!');top.setValue('".$_url."');top.close();</script>";
	exit;
}
?>

```

---

<div class="post-metadata">

作者： ![0ps](https://forum.90sec.com/user_avatar/forum.90sec.com/0ps/32/11430_2.png) [@0ps](https://forum.90sec.com/u/0ps)\
发布日期： [2012 年3 月 20 日 08:12 UTC](https://forum.90sec.com/t/topic/3358/2 "2012-03-20T08:12:11Z")

</div>

banzou999？{:4\_63:}

---

<div class="post-metadata">

作者： ![user56](https://forum.90sec.com/user_avatar/forum.90sec.com/user56/32/11423_2.png) [@user56](https://forum.90sec.com/u/user56)\
发布日期： [2012 年3 月 20 日 09:15 UTC](https://forum.90sec.com/t/topic/3358/3 "2012-03-20T09:15:06Z")

</div>

\*\*回复 [1#](http://www.90sec.org/redirect.php?goto=findpost&pid=19523&ptid=1856) _hkcrazy_ \*\*

```
没看出来有问题。

```

---

<div class="post-metadata">

作者： ![user40](https://forum.90sec.com/user_avatar/forum.90sec.com/user40/32/11393_2.png) [@user40](https://forum.90sec.com/u/user40)\
发布日期： [2012 年3 月 21 日 03:29 UTC](https://forum.90sec.com/t/topic/3358/4 "2012-03-21T03:29:54Z")

</div>

{:4\_06:}{:4\_06:}我也没发现代码有啥问题····
