if (!is_dir($uploadsDir['basedir'] . '/wpcu3er')) { @mkdir($uploadsDir['basedir'] . '/wpcu3er', 0777); } $writable = true; if (is_writable($uploadsDir['basedir'] . '/wpcu3er')) { touch($uploadsDir['basedir'] . '/wpcu3er/temp.txt'); if (!is_writable($uploadsDir['basedir'] . '/wpcu3er/temp.txt')) { $writable = false; } } else { $writable = false; } $basedir = $writable === true ? $uploadsDir['basedir'] . '/wpcu3er' : $uploadsDir['path']; $baseurl = $writable === true ? $uploadsDir['baseurl'] . '/wpcu3er' : $uploadsDir['url']; if ($_GET['url'] != '') { $rand = cu3er__getRand($basedir . '/'); $uplDir = $basedir . '/' . $rand . '/'; $save_path = $baseurl . '/' . $rand . '/'; $url = urldecode($_GET['url']); $urlParsed = parse_url($url); if ($urlParsed['host'] != 'getcu3er.com' && $urlParsed['host'] != '' . SERVER_IP . '') { die('We accept projects only from getcu3er.com website'); } if ($urlParsed['host'] == 'getcu3er.com') { $url = str_replace('getcu3er.com', '' . SERVER_IP . '', $url); } $file_name = explode("/", $url); $file_name = $file_name[sizeof($file_name) - 1]; $cu3er = file_get_contents($url); $handle = fopen($uplDir . '/' . $file_name, 'w+'); fwrite($handle, $cu3er);
function cu3er__getRand($loc) { $rand = mt_rand(1, 10000); if (!is_dir($loc . $rand)) { mkdir($loc . $rand); chmod($loc . $rand, 0777); return $rand; } else { cu3er__getRand($loc); } }