Using Default Apikey.

\n"; } if (!$cantlogin && !empty($upload_acc['filecloud_io']['user']) && !empty($upload_acc['filecloud_io']['pass'])) { $_REQUEST['up_uselogin'] = 'yes'; $_REQUEST['up_login'] = $upload_acc['filecloud_io']['user']; $_REQUEST['up_pass'] = $upload_acc['filecloud_io']['pass']; $_REQUEST['action'] = 'FORM'; echo "

Using Default Login.

\n"; } if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'FORM') $continue_up=true; else { echo "
"; echo "
filecloud.io Apikey*
"; if (!$cantlogin) echo "

 Use login?"; echo "
\n\t"; if (!$cantlogin) echo "\n"; echo "\t\n

*You can set it as default in ".basename(__FILE__)."
\n
\n"; echo "\n"; } if ($continue_up) { $not_done = $uselogin = false; $login = true; if ($fsize < 5120) html_error('The file is too small for upload.'); // They don't accept files under 5 KB :D // Ping api $page = geturl ('api.filecloud.io', 80, '/api-ping.api');is_page($page); is_notpresent($page, '"message":"pong"', 'Error: filecloud.io api is down?.'); // Login if (!empty($_REQUEST['up_uselogin']) && $_REQUEST['up_uselogin'] == 'yes' && !empty($_REQUEST['up_login']) && !empty($_REQUEST['up_pass'])) { echo "\n
Getting Apikey for filecloud.io
\n"; $post = array(); $post['username'] = urlencode($_REQUEST['up_login']); $post['password'] = urlencode($_REQUEST['up_pass']); if (!$usecurl) { $page = geturl ('secure.filecloud.io', 0, '/api-fetch_apikey.api', 'https://secure.filecloud.io/api-fetch_apikey.api', 0, $post, 0, 0, 0, 0, 'https'); // Port is overridden to 443 . is_page($page); } else $page = cURL ('https://secure.filecloud.io/api-fetch_apikey.api', $post); is_present($page, '"status":"error"', 'Login Failed: "'.str_replace('\\','',cut_str($page, '"message":"','"')).'"'); is_notpresent($page, '"akey":"', "Login Failed: Akey not found."); $_REQUEST['up_apikey'] = cut_str($page, '"akey":"', '"'); $uselogin = true; } else if(empty($_REQUEST['up_apikey'])) { $login = false; echo "
Neither Apikey nor Login were found or are empty, using non member upload.
\n"; } if ($login && !$uselogin) { // Check Apikey... $_REQUEST['up_apikey'] = trim($_REQUEST['up_apikey']); echo "\n
Checking Apikey
\n"; $page = geturl ('filecloud.io', 80, '/files.html', '', 'auth='.urlencode($_REQUEST['up_apikey']));is_page($page); is_present($page, 'you are not authorized to view this page', 'Invalid apikey.'); } // Retrive upload ID echo "\n
\n\n
Retrive upload ID
\n"; $page = geturl('api.filecloud.io', 80, '/api-fetch_upload_url.api?response=text', '', 0, array('akey' => $_REQUEST['up_apikey']));is_page($page); is_present($page, 'status: error', 'Upload Failed: "'.htmlentities(cut_str($page, 'message: ', "\n")).'"'); if (!preg_match('@upload_url: http://(s\d+\.filecloud\.io)(/[^\r|\n]+)@i', $page, $loc)) html_error('Upload server not found.', 0); $post = array(); if ($login) $post['akey'] = $_REQUEST['up_apikey']; $up_loc = "http://{$loc[1]}{$loc[2]}?response=text"; // Uploading echo "\n"; $url = parse_url($up_loc); $upfiles = upfile($url['host'], !empty($url['port']) ? $url['port'] : 80, $url['path'].(!empty($url['query']) ? '?'.$url['query'] : ''), '', 0, $post, $lfile, $lname, 'Filedata'); // Upload Finished echo ""; is_page($upfiles); is_present($upfiles, 'status: error', 'Upload Error: "'.htmlentities(cut_str($upfiles, 'message: ',"\n")).'"'); if (preg_match('@ukey: (\w+)@i', $upfiles, $dl)) { $download_link = 'http://filecloud.io/'.$dl[1]; if(preg_match('@name: ([^\r|\n]+)@i', $upfiles, $fn)) $download_link .= '/' . $fn[1]; if ($uselogin) echo "\n\n\n
filecloud.io Apikey:
\n"; } else html_error('Download link not found.', 0); } //[09-8-2012] (Re)Written by Th3-822. //[05-11-2012] Fixed post-upload error msg && added check for min filesize. - Th3-822 ?>