Автор: frglik23
Дата сообщения: 15.10.2012 23:22
winboard, для mirrorcreator.com помимо добавления в файл myserver.xml, нужно в папке Scripts создать файл mirrorcreator.com.nut: вот с таким содержимым:
[more=mirrorcreator.com]
Код:
function regex_simple(data,regStr,start)
{
local ex = regexp(regStr);
local res = ex.capture(data, start);
local resultStr = "";
if(res != null){
resultStr = data.slice(res[1].begin, res[1].end);
}
return resultStr;
}
function b64e(str) {
local b64a = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"];
local a = [];
for(local i=0; i<str.len(); i++) {
a.append(str[i].tointeger());
};
local s = [];
local lPos = a.len() - a.len() % 3;
for (local i=0; i<lPos; i+=3) {
local t = (a[i]<<16) + (a[i+1]<<8) + a[i+2];
s.append( b64a[(t>>18)&0x3f] + b64a[(t>>12)&0x3f] + b64a[(t>>6)&0x3f] + b64a[t&0x3f] )
}
switch (a.len() - lPos) {
case 1 : local t = a[lPos]<<4; s.append( b64a[(t>>6)&0x3f] + b64a[t&0x3f] + "==" ); break;
case 2 : local t = (a[lPos]<<10) + (a[lPos+1]<<2); s.append( b64a[(t>>12)&0x3f] + b64a[(t>>6)&0x3f] + b64a[t&0x3f] + "=" ); break;
}
local str2 = "";
for (local i=0; i<s.len(); i++) {
str2 = str2 + s[i];
}
return str2;
}
function getFileSize(filename) {
local f = file(filename,"rb");
local l = f.len();
f = null; // close?
return l;
}
function r(num) {
return (rand() % num)
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function UploadFile(FileName, options)
{
local Alph = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];
local fid = Alph[r(Alph.len())] + Alph[r(Alph.len())] + Alph[r(Alph.len())] + Alph[r(Alph.len())] + Alph[r(Alph.len())] + Alph[r(Alph.len())];
//print("fid="+fid+"\r\n\r\n\r\n");
local fsize = getFileSize(FileName);
local fn = ExtractFileName(FileName);
local url = "http://www.mirrorcreator.com/fnvalidator.php?fn=" + fn + "%20(" + fsize + ");&fid=" + fid + ";"
//print(url)
nm.addQueryHeader("X-Requested-With", "XMLHttpRequest");
nm.doGet(url);
local fnv = nm.responseBody();
//print("fnv="+fnv+"\r\n\r\n\r\n");
nm.setUrl("http://www.mirrorcreator.com/uploadify/uploadify.php");
nm.addQueryHeader("X-Requested-With", "");
nm.addQueryHeader("User-Agent", "Shockwave Flash");
nm.addQueryParam("Filename", fn);
nm.addQueryParam("folder","/uploads");
nm.addQueryParamFile("Filedata", FileName,fn, "");
nm.addQueryParam("Upload","Submit Query");
nm.doUploadMultipartData();
local data = nm.responseBody();
//print("data="+data+"\r\n\r\n\r\n");
local fn2 = regex_simple(data, "\"fileName\":\\s*\"([^\"]+)\"", 0);
local pd = b64e( fn2 + "#0#"+fsize+";0;@e@#H#bayfiles;rapidgator;rghost;sendmyway;hipfile;freakshare;queenshare;sockshare;loadto;#P##SC#" );
//nm.setUrl();
nm.addQueryHeader("User-Agent", "");
nm.doGet("http://www.mirrorcreator.com/process.php?data=" + pd);
local data2 = nm.responseBody();
//print("data2="+data2+"\r\n\r\n\r\n");
url = regex_simple(data2, "\"(http://mir.cr/[^\"]+)\"", 0);
//url = regex_simple(data2, "\"(http://www.mirrorcreator.com/files/[^\"]+)\"", 0);
options.setViewUrl(url);
return 1;
}