'localhost', 'db' => '', 'user' => '', 'pass' => '' ); $db_table = 'links'; $ext = array('zip', 'rar', 'pdf', 'djvu', 'epub', 'doc'); $filesize = array( 'from' => 1400000, 'to' => 10000000 ); function db_connect() { global $db, $sql_link; if (!$sql_link) { $sql_link = mysql_connect($db["host"], $db["user"], $db["pass"]); if (!$sql_link) exit; if (!mysql_select_db($db["db"], $sql_link)) exit; mysql_query("SET NAMES utf8;"); } } function getRandom($l, $type = 'string') { $a = Array( "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"); $m = ""; for ($i = 0; $i < $l; $i++) { if ($type == 'string') $m.=$a[rand(0, 61)]; if ($type == 'num') $m.=rand(0, 9); } return $m; } function original_filename($data) { global $ext; $separators = array('-', '_', '.'); $extension = $ext[rand(0, count($ext) - 1)]; return array('original_filename' => str_replace(' ', $separators[rand(0, count($separators) - 1)], $data) . '.' . $extension, 'extension' => $extension ); } function filename($data) { $data = preg_replace('/[^0-9a-zA-Z]/i', ' ', htmlspecialchars_decode($data)); while (strpos($data, ' ') !== false) $data = str_replace(' ', ' ', $data); return $data; } function fakelink($key) { $links = array( array( 'storage_id' => 15, 'store' => 'rapidshare', 'url' => "http://rapidshare.com/files/" . rand(100000000, 999999999) . "/" . urlencode($key) ), array( 'storage_id' => 4, 'store' => '4Shared', 'url' => "http://www.4shared.com/" . getRandom(9) . "/" . urlencode($key) . ".htm" ), array( 'storage_id' => 5, 'store' => 'depositfiles', 'url' => "http://depositfiles.com/files/" . getRandom(9) ), array( 'storage_id' => 17, 'store' => 'uploading', 'url' => "http://uploading.com/files/" . strtolower(getRandom(8)) . "/" . urlencode($key) ), array( 'storage_id' => 7, 'store' => 'extabit', 'url' =>"http://extabit.com/file/".strtolower(getRandom(13))."/" ), array( 'storage_id' => 8, 'store' => 'filefactory', 'url' =>"http://www.filefactory.com/file/".getRandom(rand(7, 14))."/n/".urlencode($key) ), array( 'storage_id' => 10, 'store' => 'gigasize', 'url' =>"http://www.gigasize.com/get.php?d=".strtolower(getRandom(11)) ), array( 'storage_id' => 11, 'store' => 'hotfile', 'url' =>"http://hotfile.com/dl/".getRandom(9, 'num')."/".strtolower(getRandom(11)).".html" ), array( 'storage_id' => 12, 'store' => 'letitbit', 'url' =>"http://letitbit.net/download/".getRandom(rand(4, 6), 'num').".".md5(getRandom(10))."/".urlencode($key).".html" ), array( 'storage_id' => 13, 'store' => 'mediafire', 'url' =>"http://www.mediafire.com/?".strtolower(getRandom(11)) ), array( 'storage_id' => 14, 'store' => 'netload', 'url' =>"http://netload.in/date".getRandom(11)."/".urlencode($key).".htm" ), array( 'storage_id' => 16, 'store' => 'sendspace', 'url' =>"http://www.sendspace.com/file/".strtolower(getRandom(6)) ) ); return $links[rand(0, count($links) - 1)]; } $file = file_get_contents($filename); $nr = substr_count($file, ''); for ($i = 0; $i < $nr; $i++) { $file = substr($file, strpos($file, '') + 12); $data[$i]['sourcelink'] = strip_tags(substr($file, 0, strpos($file, ''))); $file = substr($file, strpos($file, '') + 7); $data[$i]['title'] = strip_tags(substr($file, 0, strpos($file, ''))); $file = substr($file, strpos($file, '') + 13); $data[$i]['description'] = strip_tags(substr($file, 0, strpos($file, ''))); } $result = array(); for ($i = 0; $i < $nr; $i++) { if ($data[$i]['title'] != 'none') { $arr['added'] = date("Y-m-d H:i:s"); //0000-00-00 00:00:00 $arr['sourcelink'] = $data[$i]['sourcelink']; $arr['title'] = $data[$i]['title']; $arr['description'] = $data[$i]['description']; $arr['filename'] = filename($data[$i]['title']); $link = fakelink($arr['filename']); $arr['url'] = $link['url']; $arr['filesize'] = rand(round($filesize['from'] / 1000), round($filesize['to'] / 1000)) . rand(100, 999); $arr['store'] = $link['store']; $arr['storage_id'] = $link['storage_id']; $arr['status'] = 1; $extension = original_filename($arr['filename']); $arr['original_filename'] = $extension['original_filename']; $arr['group_id'] = getRandom(19, 'num'); $arr['extension'] = $extension['extension']; $arr['part_num'] = 0; $arr['group_size']=$arr['filesize']; $arr['group_length'] = 1; array_push($result, $arr); unset($arr); } } db_connect(); $nr = count($result); $success = 0; for ($i = 0; $i < $nr; $i++) { $query = "insert into $db_table (" . implode(', ', array_keys($result[$i])) . ") values ("; foreach ($result[$i] as $k => $v) { $query.='"' . mysql_real_escape_string(htmlspecialchars($v)) . '", '; } $query = substr($query, 0, strlen($query) - 2); $query.=');'; $r = mysql_query($query); if ($r) { $success++; } } echo "$success added successfuly"; ?>