添加执行远程上传目录功能
This commit is contained in:
parent
45b607d632
commit
f24ea5e1ef
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
$link = pg_connect("dbname=metadata user=gis password=gispassword host=210.77.68.241");
|
||||
if (!$link)
|
||||
{
|
||||
die("Error in connection: " . pg_last_error());
|
||||
}
|
||||
//安全检查:只接受来自westdc.westgis.ac.cn的访问
|
||||
if(@$_SERVER['HTTP_CLIENT_IP']){
|
||||
$onlineip=$_SERVER['HTTP_CLIENT_IP'];
|
||||
}elseif(@$_SERVER['HTTP_X_FORWARDED_FOR']){
|
||||
$onlineip=$_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
}else{
|
||||
$onlineip=$_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
if ($onlineip!='210.77.68.241' && $onlineip!='210.77.68.215' && $onlineip!='2002:d248:5070:4:214:22ff:fe08:d277')
|
||||
die("error! You are not permitted to visit this page.".$onlineip);
|
||||
//文件生成
|
||||
$uuid=$_GET['uuid'];
|
||||
if(empty($uuid) || !preg_match("/^[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}$/",$uuid))
|
||||
{
|
||||
die("uuid error! Error in parameter.".$uuid);
|
||||
}
|
||||
|
||||
$homedir='/disk1/WestDC/upload/'.$uuid;
|
||||
|
||||
$old=umask(0);
|
||||
@mkdir($homedir,0777);
|
||||
umask($old);
|
||||
|
||||
pg_free_result($result);
|
||||
pg_close($link);
|
||||
?>
|
Loading…
Reference in New Issue