<If "%{REMOTE_ADDR} == 'XXX.XXX.XXX.XXX' || %{REMOTE_ADDR} == 'YYY.YYY.YYY.YYY' ">
Options +Indexes +FollowSymLinks +MultiViews
Require all granted
</If>
<Else>
Options +Indexes +FollowSymLinks +MultiViews
Require all denied
</Else>
class Uploader{
var $userid;
var $uploadURL;
var $postParams = array ();
function Uploader($userid){
$this->userid = $userid;
$ch = curl_init('http://w1w.yt/api/upload.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$postResult = curl_exec($ch);
curl_close($ch);
$res = json_decode($postResult);
//var_dump($res);
$this->uploadURL = $res->action;
foreach($res->postparams as $fieldName => $fieldValue){
$this->postParams[$fieldName] = $fieldValue;
}
$this->postParams['userid'] = $userid;
}
function UploadFile($file){
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_URL, $this->uploadURL);
curl_setopt($ch, CURLOPT_POST, 1);
$this->postParams['upfile']=new CURLFile($file);
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->postParams);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$postResult = curl_exec($ch);
if (curl_errno($ch)){
print curl_error($ch);
print "Unable to upload file.";
}
curl_close($ch);
$result = json_decode($postResult, true);
if(isset($result['error'])) return false;
else{
$url='http://w1w.yt/api/upload.php?get=short&userfileid='.$result['userfileid'];//short URL
$ch=curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$postResult = curl_exec($ch);
curl_close($ch);
return $postResult;
}
}
}
function Uploader($userid){
$this->userid = $userid;
$ch = curl_init('http://w1w.yt/api/upload.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$postResult = curl_exec($ch);
curl_close($ch);
$res = json_decode($postResult);
//var_dump($res);
$this->uploadURL = $res->action;
foreach($res->postparams as $fieldName => $fieldValue){
$this->postParams[$fieldName] = $fieldValue;
}
$this->postParams['userid'] = $userid;
}